Skip to content

Instantly share code, notes, and snippets.

View shramee's full-sized avatar
🥳
Coding party

Shramee Srivastav shramee

🥳
Coding party
View GitHub Profile
@shramee
shramee / TransferUI.tsx
Created October 14, 2025 20:44
Reusable UI components
import React, { useEffect, useState } from 'react';
import { Field, Dropdown, InputField, Button, DropdownOption, baseUIBoxClasses } from './UI';
import { RotateCcw, Send, DollarSign, User, Link, WalletMinimal } from 'lucide-react';
import StarknetWalletGate from './StarknetWalletGate';
import { useAccount, useContract, useProvider, useSendTransaction } from '@starknet-react/core';
import { init as garagaInit } from 'garaga';
import { uint256 } from "starknet"
import { useMist } from '@mistcash/react';
import { generateClaimingKey, txSecret } from '@mistcash/crypto';
import { ERC20_ABI, tokensData, tokensMap } from '@mistcash/config';
@shramee
shramee / UI.tsx
Created October 14, 2025 20:41
Reusable UI components
import React, { ReactNode, useState } from 'react';
import { ChevronDown, Globe, Zap, DollarSign, User, Link, Mail, Coins, RotateCcw, Send, RefreshCw } from 'lucide-react';
export const baseUIBoxClasses = "w-full rounded-lg font-medium transition-colors flex items-center justify-center gap-2";
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children: ReactNode;
variant?: 'primary' | 'secondary' | 'tertiary';
isLoading?: boolean;
import { publicProvider, StarknetConfig, voyager } from '@starknet-react/core';
import { mainnet, sepolia } from "@starknet-react/chains"
import { ReactNode } from 'react';
interface ProviderProps {
children: ReactNode;
}
export default function Provider({ children }: ProviderProps) {
// Pass the wallet's provider and account to Provider
@shramee
shramee / StarknetWalletGate.tsx
Created October 14, 2025 20:38
Starknetkit based wallet gate
import { useStarknetkitConnectModal } from "starknetkit";
import { useConnect, useDisconnect, useAccount, } from '@starknet-react/core';
import { useState } from 'react';
import { Button } from "./UI";
interface StarknetWalletGateProps {
children: React.ReactNode;
label?: string | React.ReactNode;
connectedClass?: string;
@shramee
shramee / MIST: Seek and Hide.md
Last active October 18, 2025 13:06
Amount correlation and forced exits

MIST.cash: Introducing Seek and Hide Cat hiding in the cupboard

Cat hiding in the cupboard

Traditional mixers expose transactions; MIST’s Seek and Hide preserves privacy with flexible withdrawals and private forwarding.

Traditional Privacy Mixers

Traditional privacy mixers allow senders to deposit and hide assets in a contract and recipients to seek and withdraw them using zero-knowledge proofs. Traditional mixers often require fixed denominations (e.g., 1 ETH or 10 ETH), which limit flexibility for users and fragment anonymity pools, weakening privacy. There's only one answer to these issues, flexible amounts.

However, following issues arise when traditional mixers allow flexible amounts.

@shramee
shramee / ipa.md
Last active August 19, 2025 05:34

IPA (Inner Product Argument) Commitment Scheme

Overview

This implementation provides an optimized Inner Product Argument (IPA) commitment scheme that only multiplies half of the elements in each vector during each prover round, improving efficiency over naive implementations.

Mathematical Foundation

The IPA scheme operates with the following components:

@shramee
shramee / simple-pretty-merkle-proof.circom
Created August 3, 2025 12:12
Basic Simple Merkle Membership Proof
pragma circom 2.0.0;
include "circomlib/circuits/poseidon.circom";
include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/mux1.circom";
template BinarySelectorHasher() {
signal input i; // Must be 0 or 1
signal input a; // Input
signal input b; // Sibling

Bulletproofs++ Protocol Documentation

As describe in section 5 Arithmetic Circuits of Bulletproofs++ paper.

1. Arithmetic Circuit Protocol

Implemented in mod.rs

From section 5.3 Full Protocol Description (of 5 Arithmetic circuits),

Protocol: Arithmetic Circuit Protocol $\langle\mathcal{P}_{ac}, \mathcal{V}_{ac}\rangle$

OnlyDust shields

Shield:

<a href="https://app.onlydust.xyz/projects/6196eca8-5467-4587-b9f7-8ebebab0f841">
<img src="https://img.shields.io/badge/An%20OnlyDust%20project-%23000?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAATCAYAAACQjC21AAAAAXNSR0IArs4c6QAABNNJREFUOE9tlGtQ1FUchp/z/+8usLCArOAuICyggwpI4mVEQzNJVMQZb6WpqTikXSxDDC2bMUv9YAw2loWUOo06lo02XsoUL2NqogmmgmCgcleQ24Jclt09zeLo2OV8O7/3Pc+cOXPeV/A/S57B96Zm/Gu7m1MLsqYvOv+sZVNeXvwrg/rGhgcF7hEioP3fx8WzA7keDRGk1hst2cOiDl+rDR061qWf8S/y8lOMMvaB6ZFrv25SbWHGHhHm4+++Anz3CiGcTzhPgTJluJ6Yqzk9g3ULdmw+S3P38Bkflbv9JFv29nFszjyIqkg185fZwieqKZKSlcuSPLLfO2YEteNLaF0lxMBuF7QXKJGKLe7Vb3RT9y+5rsaT+vE+3BEJUTkN+VWJynf1FbY5slFHDH77FxeFLg7OPrvYy6Ms1//sBNTIfkB9NoSvEkLIXmABDfMiLNn7vBdtpuC3XBpPzyPY/c5XQ7pi3nTpppyu5G67Q2l+y/NI7wU+VU+idSQ6x29EjMxAKJXguJ8iNAlHxRykOg9b9XjjLpPfrDU0HNuEX+xO1OjCDtJGmMXAfOs/3lleNvHwSCXSqXV2GVCCl4NoAsftMtRLkWIy1hlz0B+covsZU8o6RNx18AfiIiAmy4Fu2twDB9RDHICJi1ihH0KW1mxXhEbB3gw6/xbACvZb0JyXLOKo+3Yp/VInKwUExXyO27pDMCwJwtfj7Img9bQHTefbnT11IOu9
@shramee
shramee / loops.cairo
Created October 25, 2022 07:50
Loops with jmp in Cairo (Starknet).
// Dynamic allocation in Cairo is done using the `alloc` function,
// which itself is implemented in Cairo using the
// [segments](https://www.cairo-lang.org/docs/how_cairo_works/segments.html) mechanism.
// Thanks to this mechanism, `alloc` allocates an array of an arbitrary size,
// which does not need to be specified in the call.
//
// The function `sqr_array` should compute and return an array
// of the square values of a given array.
// Write the body of `sqr_array` using the given helper function
// `_inner_sqr_array` and check that the program output