Skip to main content

Transaction Calldata

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.

Deposit and Transfer

FieldSize (bytes)Offset (bytes)Description
selector40Contract method selector (0xaf989083)
nullifier324The unique transaction nullifier
out_commit3236Transaction commitment (transaction subtree root in the Merkle tree)
tx_index668Transaction's first leaf index within Merkle tree (0-based counter)
energy_amount1474Account XP delta (signed integer, Gwei)
token_amount888Account token delta (signed integer, Gwei)
tx_proof25696zkSNARK proof
root_after32352Merkle tree root after adding the transaction
tree_proof256384zkSNARK proof
tx_type2640

0 - deposit

1 - transfer

2 - withdraw

memo_size2642The following memo block size in bytes
memo.fee8644The tokens amount to be transferred to the operator (the Pool contract will multiply the fee by denominator)
memo.ItemsNum4652Number of encrypted items in the memo block
memo.Hash_acc32656Output account hash (with updated balance)
memo.Hash_notes32 * (memo.ItemsNum - 1)688Output note hash
memo.Ap_x32656 + 32 * memo.ItemsNumEphemeral public key (using to decrypt memo.keys_enc by transaction sender)
memo.keys_enc32 * memo.ItemsNum + 16688 + 32 * memo.ItemsNumAccount and notes encryption keys
memo.acc_enc86704 + 64 * memo.ItemsNumEncrypted account with an updated balance
memo.notes_enc108 * (memo.ItemsNum - 1)790 + 64 * memo.ItemsNum

A single encrypted note (Ai,Noteienc)(A_i, Note_i^{enc}) takes 108 bytes:

sizeof(Ai)=32sizeof(A_i) = 32
sizeof(Noteienc)=76sizeof(Note_i^{enc}) = 76

ECDSA signature (r, s)64682 + 172 * memo.ItemsNumUsed to recover deposit spender in the corresponding transactions

Withdrawal

FieldSize (bytes)Offset (bytes)Description
selector40Contract method selector (0xaf989083)
nullifier324The unique transaction nullifier
out_commit3236Transaction commitment (transaction subtree root in the Merkle tree)
tx_index668Transaction's first leaf index within Merkle tree (0-based counter)
energy_amount1474Account energy delta (signed integer, Gwei)
token_amount888Account token delta (signed integer, Gwei)
tx_proof25696zkSNARK proof
root_after32352Merkle tree root after adding the transaction
tree_proof256384zkSNARK proof
tx_type2640

0 - deposit

1 - transfer

2 - withdraw

memo_size2642The following memo block size in bytes
memo.fee8644The tokens amount to be transferred to the operator (the Pool contract will multiply the fee by denominator)
memo.nativeamount8652Count of the native coin to withdraw
memo.receiver20660Destination native address for withdrawal
memo.ItemsNum4680Number of encrypted items in the memo block
memo.Hash_acc32684Output account hash (with updated balance)
memo.Hash_notes32 * (memo.ItemsNum - 1)716Output note hash
memo.Ap_x32684 + 32 * memo.ItemsNumEphemeral public key (using to decrypt memo.keys_enc by transaction sender)
memo.keys_enc32 * memo.ItemsNum + 16716 + 32 * memo.ItemsNumAccount and notes encryption keys
memo.acc_enc86732 + 64 * memo.ItemsNumEncrypted account with an updated balance
memo.notes_enc108 * (memo.ItemsNum - 1)818 + 64 * memo.ItemsNum

A single encrypted note (Ai,Noteienc)(A_i, Note_i^{enc}) takes 108 bytes:

sizeof(Ai)=32sizeof(A_i) = 32
sizeof(Noteienc)=76sizeof(Note_i^{enc}) = 76

ECDSA signature (r, s)64710 + 172 * memo.ItemsNumUsed to recover deposit spender in the corresponding transactions