web3.eth.getTransactionReceipt returns an object with a root property and is currently undocumented in the wiki.

Result: {
      "root": "7583254379574ee8eb2943c3ee41582a0041156215e2c7d82e363098c89fe21b",
      "to": "0x91067b439e1be22196a5f64ee61e803670ba5be9",
      "transactionHash": "0xad62c939b2e865f13c61eebcb221d2c9737955e506b69fb624210d3fd4e0035b",
      "transactionIndex": 0
  1. What is this root? It is not the same as the receiptRoot from web3.eth.getBlock.

  2. What is the relationship between these roots?


It's the hash of the root of the state trie, whereas receiptRoot is the hash of the array of receipts for a given block.


In GetTransactionReceipt() in api.go there's set of mappings, one of which is:

"root":              common.Bytes2Hex(receipt.PostState),

Looking at receipt.go, PostState is a byte array:

// Receipt represents the results of a transaction.
type Receipt struct {
    // Consensus fields
    PostState         []byte
    CumulativeGasUsed *big.Int
    Bloom             Bloom
    Logs              vm.Logs

This is set in NewReceipt() to a value passed in from state_processor.go:

receipt := types.NewReceipt(statedb.IntermediateRoot().Bytes(), usedGas)

...and IntermediateRoot() is defined in statedb.go as:

// IntermediateRoot computes the current root hash of the state trie.
// It is called in between transactions to get the root hash that
// goes into transaction receipts.


In block.go:

// The values of TxHash, UncleHash, ReceiptHash and Bloom in header
// are ignored and set to values derived from the given txs, uncles
// and receipts.

With the pertinent code in that function being:

b.header.ReceiptHash = DeriveSha(Receipts(receipts))

And in api.go:

"receiptRoot":      b.ReceiptHash(),
  • 1
    Thanks! It's the hash of the root of the intermediate state trie after the particular transaction has been applied. – eth Jun 26 '16 at 0:05

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.