0

A receipt from rpc returns a root which I believe is the "post-transaction state" from the yellow paper. The internet seems to say this is the same thing as the full stateRoot at the exact moment after the transaction.

However. I tested these assumptions by picking a transaction which threw an error, and looking at the receipt roots immediately before and after. When a transaction throws an error the state should not be updated, so I expected the roots to be equal. They are not.

What in the state would change after an error transaction?

Am I misunderstanding which value is which?

3

The state trie contains the balance of each account. Even transactions that throw an exception result in a reduction in the sender's balance through gas costs, which means that the resulting state is different from the initial state.

An interesting question would be to see if a transaction with a gas price of 0 can be excluded from a block without changing the resulting state root. I believe this would be the case.

EDIT: On second thought, the state trie also contains account nonces, so even if a transaction used zero ETH for gas fees, the nonce would still cause the state root to change.

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.