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.
transactionFeeFrThe transaction fee, denominated in FPA.
noteHashesTuple<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.
l2ToL1MsgsTuple<Fr, typeof MAX_L2_TO_L1_MSGS_PER_TX>The L2 to L1 messages to be inserted into the messagebox on L1.
publicDataWritesTuple<PublicDataWrite, typeof MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX>Public data writes to be inserted into the public data tree
noteEncryptedLogsTxL2LogsBuffers containing the emitted note logs.
encryptedLogsTxL2LogsBuffers containing the emitted encrypted logs.
unencryptedLogsTxL2LogsBuffers containing the emitted unencrypted logs.

To publish the above data, we must convert it into arrays of BLS12 fields for EVM defined blobs. The encoding is defined as:

field startnum fieldsnamecontents
01Tx StartTX_START_PREFIX, total len, REVERT_CODE_PREFIX, revertCode
11Tx FeeTX_FEE_PREFIX, transactionFee
21Notes Start(If notes exist) NOTES_PREFIX, noteHashes.len()
3nNotes(If notes exist) noteHashes
3 + n1Nullifiers Start(If nullifiers exist) NULLIFIERS_PREFIX, nullifiers.len()
3 + n + 1mNullifiers(If nullifiers exist) nullifiers
3 + n + 1 + m1L2toL1Messages Start(If msgs exist) L2_L1_MSGS_PREFIX, l2ToL1Msgs.len()
3 + n + 1 + m + 1lL2toL1Messages(If msgs exist) l2ToL1Msgs
3 + n + 1 + m + 1 + l1PublicDataWrites Start(If writes exist) PUBLIC_DATA_UPDATE_REQUESTS_PREFIX, publicDataWrites.len()
3 + n + 1 + m + 1 + l + 1pPublicDataWrites(If writes exist) publicDataWrites
3 + n + 1 + m + 1 + l + 1 + p1Note Logs Start(If note logs exist) NOTE_ENCRYPTED_LOGS_PREFIX, noteEncryptedLogs.len()
3 + n + 1 + m + 1 + l + 1 + p + 1nlNote Logs(If note logs exist) noteEncryptedLogs
3 + n + 1 + m + 1 + l + 1 + p + 1 + nl1Encrypted Logs Start(If encrypted logs exist) ENCRYPTED_LOGS_PREFIX, encryptedLogs.len()
3 + n + 1 + m + 1 + l + 1 + p + 1 + nl + 1elEncrypted Logs(If encrypted logs exist) encryptedLogs
3 + n + 1 + m + 1 + l + 1 + p + 1 + nl + 1 + el1Unencrypted Logs Start(If unencrypted logs exist) UNENCRYPTED_LOGS_PREFIX, unencryptedLogs.len()
3 + n + 1 + m + 1 + l + 1 + p + 1 + nl + 1 + el + 1ulUnencrypted Logs(If unencrypted logs exist) unencryptedLogs