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.

FieldSize (bytes)Offset (bytes)Description

selector

4

0

Contract method selector (0xaf989083)

nullifier

32

4

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 (Ai,Noteienc)(A_i, Note_i^{enc}) takes 108 bytes:

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

ECDSA signature (r, s)

64

682 + 172 * memo.ItemsNum

Used to recover deposit spender in the corresponding transactions

Last updated