Getting Started
Installation
Section titled “Installation”pnpm add @mistcash/sdk @mistcash/confignpm install @mistcash/sdk @mistcash/configyarn add @mistcash/sdk @mistcash/configFor React applications, also install the React package:
pnpm add @mistcash/reactnpm install @mistcash/reactyarn add @mistcash/reactInitialization
Section titled “Initialization”The SDK uses a Go-compiled WASM module for cryptographic operations. You must initialize it before calling any hash or proof functions.
import { initCore } from "@mistcash/sdk";
// Initialize WASM + Garaga modulesawait initCore();You can also initialize modules independently:
import { initWasm, initGaraga } from "@mistcash/sdk";
// Initialize only what you needawait initWasm(); // Required for hashing and proof generationawait initGaraga(); // Required for proof calldata formattingQuick Example: Hash a Secret
Section titled “Quick Example: Hash a Secret”-
Initialize the SDK
import { initCore, hash2, generateClaimingKey } from "@mistcash/sdk";await initCore(); -
Generate a claiming key
const claimingKey = generateClaimingKey();console.log("Claiming key:", claimingKey); -
Hash the key with a recipient address
const recipientAddress = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7";const commitment = await hash2(claimingKey, recipientAddress);console.log("Commitment:", commitment);
Quick Example: React Integration
Section titled “Quick Example: React Integration”import { useMist } from "@mistcash/react";
function PrivacyWallet({ provider, sendTransaction }) { const mist = useMist(provider, sendTransaction);
return ( <div> <p>Chamber: {mist.chamberAddress}</p> <p>Status: {mist.loadingMessage}</p>
<input placeholder="Claiming Key" value={mist.valKey} onChange={(e) => mist.setKey(e.target.value)} /> <input placeholder="Recipient Address" value={mist.valTo} onChange={(e) => mist.setTo(e.target.value)} />
<button onClick={() => mist.fetchAsset()}> Find Transaction </button>
{mist.asset && ( <button onClick={() => mist.handleWithdraw(mist.asset!)}> Withdraw </button> )} </div> );}Supported Tokens
Section titled “Supported Tokens”The SDK supports the following tokens on Starknet mainnet:
| Token | Symbol | Address |
|---|---|---|
| Ether | ETH | 0x049d36...04dc7 |
| Stark | STRK | 0x04718f...0ecb4 |
| USD Coin | USDC | 0x053c91...0b2c2 |
| Tether | USDT | 0x068f5c...36d11 |
| Survivor | SURVIVOR | 0x5dc92...51f86 |
See tokensData in @mistcash/config for full addresses and metadata.
Next Steps
Section titled “Next Steps”- Learn about the Core SDK for low-level cryptographic operations
- Set up the React hook for building UIs
- Follow the Deposit guide for a complete deposit flow
- Follow the Withdraw guide for a complete withdrawal flow