Skip to main content

Published Data Format

The "Effects" of a transaction are the collection of state changes and metadata that resulted from executing a transaction. These include:

FieldTypeDescription
revertCodeRevertCodeIndicates the reason for reverting in public application logic. 0 indicates success.
note_hashesTuple<Fr, typeof MAX_NOTE_HASHES_PER_TX>The note hashes to be inserted into the note hash tree.
nullifiersTuple<Fr, typeof MAX_NULLIFIERS_PER_TX>The nullifiers to be inserted into the nullifier tree.
l2_to_l2_msgsTuple<Fr, typeof MAX_L2_TO_L1_MSGS_PER_TX>The L2 to L1 messages to be inserted into the messagebox on L1.
public_data_writesTuple<PublicDataWrite, typeof MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX>Public data writes to be inserted into the public data tree
encrypted_logsTxL2LogsBuffers containing the emitted encrypted logs.
unencrypted_logsTxL2LogsBuffers containing the emitted unencrypted logs.

Each can have several transactions. Thus, an block is presently encoded as:

byte startnum bytesname
0x00x4len(newL1ToL2Msgs) (denoted a)
0x4a * 0x20newL1ToL2Msgs
0x4 + a * 0x20 = tx0Start0x4len(numTxs) (denoted t)
TxEffect 0
tx0Start0x20revertCode
tx0Start + 0x200x1len(noteHashes) (denoted b)
tx0Start + 0x20 + 0x1b * 0x20noteHashes
tx0Start + 0x20 + 0x1 + b * 0x200x1len(nullifiers) (denoted c)
tx0Start + 0x20 + 0x1 + b * 0x20 + 0x1c * 0x20nullifiers
tx0Start + 0x20 + 0x1 + b * 0x20 + 0x1 + c * 0x200x1len(l2ToL1Msgs) (denoted d)
tx0Start + 0x20 + 0x1 + b * 0x20 + 0x1 + c * 0x20 + 0x1d * 0x20l2ToL1Msgs
tx0Start + 0x20 + 0x1 + b * 0x20 + 0x1 + c * 0x20 + 0x1 + d * 0x200x1len(newPublicDataWrites) (denoted e)
tx0Start + 0x20 + 0x1 + b * 0x20 + 0x1 + c * 0x20 + 0x1 + d * 0x20 + 0x01e * 0x40newPublicDataWrites
tx0Start + 0x20 + 0x1 + b * 0x20 + 0x1 + c * 0x20 + 0x1 + d * 0x20 + 0x01 + e * 0x400x04byteLen(newEncryptedLogs) (denoted f)
tx0Start + 0x20 + 0x1 + b * 0x20 + 0x1 + c * 0x20 + 0x1 + d * 0x20 + 0x01 + e * 0x40 + 0x4fnewEncryptedLogs
tx0Start + 0x20 + 0x1 + b * 0x20 + 0x1 + c * 0x20 + 0x1 + d * 0x20 + 0x01 + e * 0x40 + 0x4 + f0x04byteLen(newUnencryptedLogs) (denoted g)
tx0Start + 0x20 + 0x1 + b * 0x20 + 0x1 + c * 0x20 + 0x1 + d * 0x20 + 0x01 + e * 0x40 + 0x4 + f + 0x4gnewUnencryptedLogs
},
TxEffect 1
...
},
...
TxEffect (t - 1)
...
},