Skip to content

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.

Starknet Mainnet:

0x06f8dcc500131b6be6b33f4534ec6d33df33e61083ec2b051555d52e75654444

Deposits tokens into the Chamber and adds a commitment to the Merkle tree.

// The commitment hash
const hash = txHash(claimingKey, ownerAddress, tokenAddress, amount);
// The asset to deposit
const asset = { addr: tokenAddress, amount: depositAmount };
await chamber.deposit(hash, asset);

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.

Transfers tokens within the privacy pool without full ZK. Allows re-hiding tokens under a new commitment.

Returns all transaction commitment leaves in the Merkle tree.

const leaves = await chamber.tx_array();
// Returns: bigint[]

Returns the current Merkle root of the transaction tree.

const root = await chamber.merkle_root();
// Returns: bigint

Returns the Merkle proof path for a leaf at the given index.

const proof = await chamber.merkle_proof(leafIndex);
// Returns: bigint[]

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 }

Checks whether a set of nullifiers have been spent (used in withdrawals).

const spent = await chamber.nullifiers_spent([nullifier1, nullifier2]);
// Returns: boolean[]

Checks whether a set of transaction hashes exist in the tree.

const exists = await chamber.transactions_exist([hash1, hash2]);
// Returns: boolean[]