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
Field | Size (bytes) | Offset (bytes) | Description |
---|---|---|---|
selector | 4 | 0 | Contract method selector (0xaf989083) |
nullifier | 32 | 4 | The unique transaction nullifier |
out_commit | 32 | 36 | Transaction commitment (transaction subtree root in the Merkle tree) |
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 | A single encrypted note takes 108 bytes: |
ECDSA signature (r, s) | 64 | 682 + 172 * memo.ItemsNum | Used to recover deposit spender in the corresponding transactions |
Withdrawal
Field | Size (bytes) | Offset (bytes) | Description |
---|---|---|---|
selector | 4 | 0 | Contract method selector (0xaf989083) |
nullifier | 32 | 4 | The unique transaction nullifier |
out_commit | 32 | 36 | Transaction commitment (transaction subtree root in the Merkle tree) |
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 | A single encrypted note takes 108 bytes: |
ECDSA signature (r, s) | 64 | 710 + 172 * memo.ItemsNum | Used to recover deposit spender in the corresponding transactions |