LogoLogo
zkBob AppLinks & Resources
  • 🦹zkBob Overview
    • zkBob
    • Basic Concepts
      • Getting Started
      • Open-Source and Decentralized
      • Multichain Deployment
      • Usage Statistics
      • Use Cases
        • Employee Salary
        • Vendor Purchasing
      • Development Timeline
      • zk Privacy Solution Comparison
    • zkBob Pools
      • USDC Pool on Polygon (sunsets January 31, 2025)
      • USDC Pool on Optimism
      • ETH Pool on Optimism
      • USDT Pool on Tron (sunsets Oct 29, 2024)
    • Fees
      • Unspent note handling
    • Deposit & Withdrawal Limits
    • Compliance & Security
      • TRM Labs Integration
    • Conferences, Workshops, Videos
      • International Videos
    • Governance
    • BOB Stablecoin
    • zkBob FAQ
  • πŸ¦Έβ€β™‚οΈzkBob Application
    • UI Overview
    • Account Creation
      • Login to an existing account
      • Lost Password
      • Metamask / Web3 Wallet Warning
    • Deposits
    • Transfers
      • Multitransfers
    • Withdrawals
      • Native Token Conversion
    • Generate a Receiving Address
    • Optional KYC
    • zkBob Direct Deposits
    • Support ID
    • Payment Links
    • Integrated Services
    • Multilingual support
      • PortuguΓͺs
      • Русский
      • δΈ­ζ–‡
  • πŸ‘©β€βš•οΈTechnical Implementation
    • zkBob Application Overview
    • Deployed Contracts
    • Smart Contracts
      • zkBob Pool Contract
        • Transaction Calldata
      • Bob Token Contract
      • Verifier contracts
      • Operator Manager Contract
        • Mutable Operator Manager
      • Voucher (XP) Token Contract
    • Accounts and Notes
      • Accounts
      • Notes
    • Relayer Node
      • Relayer Operations
      • Optimistic State
      • REST API
    • zkBob Keys
      • Address derivation
      • Ephemeral keys
    • zkSNARKs & Circuits
      • Transfer verifier circuit overview
    • zkBob Merkle Tree
      • The Poseidon Hash
    • Elliptic Curve Cryptography
    • Transaction Overview
      • Common Structure
      • Memo Block
        • Memo Block Encryption
      • Transaction Types
      • Nullifiers
      • Signing a Transaction
      • The Transaction Lifecycle
    • Client Library SDK
      • Configuration
        • Initializing the client
          • Client Configuration
        • Attaching a User Account
          • Account Configuration
        • Switching Between Pools
      • Account-less Mode Operations
        • Converting Token Amounts
        • Transaction Fees
        • Transaction Constraints
        • Using the Delegated Prover
        • Getting the State
        • Gift Cards
        • Client Library Status
        • Helpers
        • Versioning
      • Full Mode Operations
        • Balances and History
        • Shielded Addresses
        • Account State
        • Fee Estimations
        • Transaction Configuration
        • Sending Transactions
        • Transaction Maintenance
        • Direct Deposits
        • Gift Cards Maintenance
        • Ephemeral Deposits
        • Forced Exit
        • Other Routines
      • Common Types
      • Full Functions List
      • Utilities
  • πŸ‘©β€πŸ«Deployment
    • Trusted Setup Ceremony
    • Contract Deployment
    • Relayer Subsystem
  • πŸ‘·β€β™‚οΈRoadmap
    • On the Roadmap
    • Exploratory Features
      • XP (Experience Points)
        • XP-based Auctions
      • Multi-chain Custom Rollup Deployment
      • Round-robin Operator Manager
      • Compounding
  • πŸ§‘β€πŸ’»Jobs
    • Zero-Knowledge Researcher & Protocol Developer
  • 🧩Resources
    • Visual Assets
    • Hackathons
      • zkBob Cloud
    • Release Notes
      • October 11, 2023
      • July 13, 2023
      • June 13, 2023
      • March 28, 2023
      • January 30, 2023
      • January 16, 2023
      • January 2, 2023
      • Releases 2022
    • Security Audit
    • Github
    • Link tree
Powered by GitBook
On this page

Was this helpful?

  1. Technical Implementation
  2. Smart Contracts
  3. zkBob Pool Contract

Transaction Calldata

Reference tables with calldata structure for different transaction types

All transaction data are transferred to the Pool contract through the calldata. The following reference table is useful for transaction analysis.

Withdrawal transactions contain addition fields memo.nativeamount and memo.receiver . Due to this, the calldata table for withdrawal transactions is presented separately.

Field
Size (bytes)
Offset (bytes)
Description

selector

4

0

Contract method selector (0xaf989083)

nullifier

32

4

out_commit

32

36

tx_index

6

68

Transaction's first leaf index within Merkle tree (0-based counter)

energy_amount

14

74

Account XP delta (signed integer, Gwei)

token_amount

8

88

Account token delta (signed integer, Gwei)

tx_proof

256

96

zkSNARK proof

root_after

32

352

Merkle tree root after adding the transaction

tree_proof

256

384

zkSNARK proof

tx_type

2

640

0 - deposit

1 - transfer

2 - withdraw

memo_size

2

642

The following memo block size in bytes

memo.fee

8

644

The tokens amount to be transferred to the operator (the Pool contract will multiply the fee by denominator)

memo.ItemsNum

4

652

Number of encrypted items in the memo block

memo.Hash_acc

32

656

Output account hash (with updated balance)

memo.Hash_notes

32 * (memo.ItemsNum - 1)

688

Output note hash

memo.Ap_x

32

656 + 32 βˆ— memo.ItemsNum

Ephemeral public key (using to decrypt memo.keys_enc by transaction sender)

memo.keys_enc

32 * memo.ItemsNum + 16

688+ 32 βˆ— memo.ItemsNum

Account and notes encryption keys

memo.acc_enc

86

704 + 64 * memo.ItemsNum

Encrypted account with an updated balance

memo.notes_enc

108*(memo.ItemsNum - 1)

790+ 64 * memo.ItemsNum

ECDSA signature (r, s)

64

682 + 172 * memo.ItemsNum

Used to recover deposit spender in the corresponding transactions

Field
Size (bytes)
Offset (bytes)
Description

selector

4

0

Contract method selector (0xaf989083)

nullifier

32

4

out_commit

32

36

tx_index

6

68

Transaction's first leaf index within Merkle tree (0-based counter)

energy_amount

14

74

Account energy delta (signed integer, Gwei)

token_amount

8

88

Account token delta (signed integer, Gwei)

tx_proof

256

96

zkSNARK proof

root_after

32

352

Merkle tree root after adding the transaction

tree_proof

256

384

zkSNARK proof

tx_type

2

640

0 - deposit

1 - transfer

2 - withdraw

memo_size

2

642

The following memo block size in bytes

memo.fee

8

644

The tokens amount to be transferred to the operator (the Pool contract will multiply the fee by denominator)

memo.nativeamount

8

652

Count of the native coin to withdraw

memo.receiver

20

660

Destination native address for withdrawal

memo.ItemsNum

4

680

Number of encrypted items in the memo block

memo.Hash_acc

32

684

Output account hash (with updated balance)

memo.Hash_notes

32 * (memo.ItemsNum - 1)

716

Output note hash

memo.Ap_x

32

684 + 32 βˆ— memo.ItemsNum

Ephemeral public key (using to decrypt memo.keys_enc by transaction sender)

memo.keys_enc

32 * memo.ItemsNum + 16

716 + 32 βˆ— memo.ItemsNum

Account and notes encryption keys

memo.acc_enc

86

732 + 64 * memo.ItemsNum

Encrypted account with an updated balance

memo.notes_enc

108*(memo.ItemsNum - 1)

818 + 64 * memo.ItemsNum

ECDSA signature (r, s)

64

710 + 172 * memo.ItemsNum

Used to recover deposit spender in the corresponding transactions

PreviouszkBob Pool ContractNextBob Token Contract

Last updated 2 years ago

Was this helpful?

The unique

Transaction commitment (transaction subtree root in the )

A single encrypted note takes 108 bytes:

= 32 = 76

The unique

Transaction commitment (transaction subtree root in the )

A single encrypted note takes 108 bytes:

= 32 = 76

πŸ‘©β€βš•οΈ
(Ai,Noteienc)(A_i, Note_i^{enc})(Ai​,Noteienc​)
sizeof(Ai)sizeof(A_i)sizeof(Ai​)
sizeof(Noteienc)sizeof(Note_i^{enc})sizeof(Noteienc​)
(Ai,Noteienc)(A_i, Note_i^{enc})(Ai​,Noteienc​)
sizeof(Ai)sizeof(A_i)sizeof(Ai​)
sizeof(Noteienc)sizeof(Note_i^{enc})sizeof(Noteienc​)
transaction nullifier
Merkle tree
transaction nullifier
Merkle tree