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


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

  • Is a message structure same as a transaction structure? Jun 11 '16 at 7:13
  • 2
    The message structure is the only thing that is formally specified. The "data structure" representing a transaction is a construct of the application in which it exists (and therefore to some extent the programming language.) For instance, it is very unlikely that geth, eth and pyethapp use - or even could use - the exact same internal data structure to represent a transaction.
    – jimkberry
    Jun 13 '16 at 19:44
  • but what is 'data' field? what sort of interesting stuff goes there? Could you provide any example for the data part? Feb 10 '17 at 22:13
  • @AbhishekDeb "interesting" here means arguments to a smart contract. If you're calling a smart contract function, or creating a smart contract, all of that code gets lumped into the data field.
    – ohsully
    Mar 6 '19 at 16:24

you can check a transsaction by its hash, for instance in eth :

> web3.eth.getTransaction('0xc5eee3ae9cf10fbee05325e3a25c3b19489783612e36cb55b054c2cb4f82fc28')
  blockHash: '0xdb85c62ef50103f08e9220b59d6c08cbfb52e61d84926dedb3fe9b6940e6bbea',
  blockNumber: 290081,
  from: '0x1dcb8d1f0fcc8cbc8c2d76528e877f915e299fbe',
  gas: 90000,
  gasPrice: 50000000000',
  hash: '0xc5eee3ae9cf10fbee05325e3a25c3b19489783612e36cb55b054c2cb4f82fc28',
  input: '0x',
  nonce: 34344,
  to: '0x702bd0d370bbf0b97b66fe95578c62697c583393',
  transactionIndex: 0,
  value: 5000111390000000000'

which you can see in a blockchain scanner here

  • 1
    Does raw transaction data have signature in it? Mar 12 '16 at 2:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.