Contract ABI
The Chamber contract is the on-chain component of MIST.cash. It manages a Merkle tree of transaction commitments and verifies zero-knowledge proofs for private withdrawals.
Contract Address
Section titled “Contract Address”Starknet Mainnet:
0x06f8dcc500131b6be6b33f4534ec6d33df33e61083ec2b051555d52e75654444Core Methods
Section titled “Core Methods”deposit(hash, asset)
Section titled “deposit(hash, asset)”Deposits tokens into the Chamber and adds a commitment to the Merkle tree.
// The commitment hashconst hash = txHash(claimingKey, ownerAddress, tokenAddress, amount);
// The asset to depositconst asset = { addr: tokenAddress, amount: depositAmount };
await chamber.deposit(hash, asset);handle_zkp(proof)
Section titled “handle_zkp(proof)”Processes a zero-knowledge proof to execute a private withdrawal. The proof demonstrates knowledge of a valid commitment in the Merkle tree without revealing which one.
const calldata = await full_prove(witness);await chamber.handle_zkp(calldata);withdraw_no_zk(claiming_key, owner, asset, proof)
Section titled “withdraw_no_zk(claiming_key, owner, asset, proof)”Withdraws tokens without a zero-knowledge proof. Requires revealing the claiming key.
seek_and_hide_no_zk(...)
Section titled “seek_and_hide_no_zk(...)”Transfers tokens within the privacy pool without full ZK. Allows re-hiding tokens under a new commitment.
Read Methods
Section titled “Read Methods”tx_array()
Section titled “tx_array()”Returns all transaction commitment leaves in the Merkle tree.
const leaves = await chamber.tx_array();// Returns: bigint[]merkle_root()
Section titled “merkle_root()”Returns the current Merkle root of the transaction tree.
const root = await chamber.merkle_root();// Returns: bigintmerkle_proof(index)
Section titled “merkle_proof(index)”Returns the Merkle proof path for a leaf at the given index.
const proof = await chamber.merkle_proof(leafIndex);// Returns: bigint[]assets_from_secret(tx_secret)
Section titled “assets_from_secret(tx_secret)”Looks up the asset associated with a transaction secret.
const secret = txSecret(claimingKey, recipientAddress);const asset = await chamber.assets_from_secret(secret);// Returns: { addr: string, amount: bigint }nullifiers_spent(nullifiers)
Section titled “nullifiers_spent(nullifiers)”Checks whether a set of nullifiers have been spent (used in withdrawals).
const spent = await chamber.nullifiers_spent([nullifier1, nullifier2]);// Returns: boolean[]transactions_exist(transactions)
Section titled “transactions_exist(transactions)”Checks whether a set of transaction hashes exist in the tree.
const exists = await chamber.transactions_exist([hash1, hash2]);// Returns: boolean[]