Ethereum Transaction Data Structure – Detailed Explanation

calldataraw-transactiontransactions

I'd like to know the detail of the Ethereum transaction data structure.
What data is stored in transaction?

Best Answer

An Ethereum transaction - as in, what you pass to sendRawTransaction() - consists of the following fields, in order and RLP-encoded (note that the field names are not part of the encoded data):

  • nonce - transaction sequence number fr the sending account
  • gasprice - price you are offering to pay
  • startgas - maximum amount of gas allowed for the transaction
  • to - destination address (account or contract address)
  • value - eth to transfer to the destination, if any
  • data - all of the interesting stuff goes here
  • v - along with r and s makes up the ECDSA signature
  • r
  • s

Any payload, whether raw data or a contract function signature and parameters, is encoded into the data field.

Some references:

Transaction (python)

LegacyTx (go)

rlp.Serializable (python)

ECDSA parameters