Skip to main content

Master Account

architecture

The Master Account serves as the single source of truth for:

  • Asset custody: Holds all deposited funds in the shielded pool
  • Commitment tree: Maintains the Merkle tree of all note commitments
  • Proof verification: Validates zk-SNARK proofs for operations
  • Operation execution: Processes user actions via App Accounts

Core Functions

1. Deposit Assets

Entry point: depositAssets(Deposit[] calldata deposits)

Who calls this: The Deposit Manager (after screening is complete)

What happens:

  1. Validates each deposit
  2. Transfers assets from Deposit Manager to Master Account
  3. Computes note commitments:
Posiedon(asset,amount,owner,nonce)\text{Posiedon}(\text{asset}, \text{amount}, \text{owner}, \text{nonce})
  1. Inserts commitments into the Merkle tree

2. Transact (Bundle Processing)

Entry point: transact(Operation[] calldata ops)

Who calls this: Bundlers (permissionless actors submitting batches)

What happens:

Phase 1: Validation

For each operation in the bundle:

  1. Check that nullifiers haven't been spent
  2. Ensure stealth addresses or tokens aren't blacklisted

Phase 2: Proof Extraction and Verification

  1. Extract zk-SNARK proofs and public inputs from all operations
  2. Verify proofs through Verifier contract
  • If verification fails: Entire bundle reverts (no partial execution).

Phase 3: Execution

For each operation:

  • Process JoinSplits
    • Consume input notes
    • Create output notes
    • Transfer assets to app accounts (if net difference ≠ 0)
  • Send funds to Executor
    • Execute user-defined actions via the delegated AppAccount