2

When a full node receives a freshly mined new block, it seems straightfoward how we could validate all the transactions contained in the block. As we already the current world state, we could just apply all the Txs in the new block and check the resulting stateRoot against the state root from the new block. If it's identical, then we are sure the new block is valid(assume the pow part is okay)

Understanding that it is also trivial to check the inclusion/exclusion of a particular transaction, how can we check if a transaction included in a old block is valid?

I'm asking because it seems for validating old transactions, we don't have access to old world state then(only stateRoot, unless we took additonal snapshot, but that's not really the Ethereum default behavior?)

EDIT: Understanding that Ethereum is always making sure that the current state & coming transactions are valid(which is doable as mentioned above), what I am asking is more relevant to Ethereum-based sidechains (or more specifically, Generalized Plasma Sidechains).

So we may need to validate a relatively old transactions in future, when the world state has already been mutated. I want to understand if it is necessary to keep a lot of world state full snapshots in order to achieve this. Or would stateRoot suffice?

2
  • Why would you do this? If you're validating the chain, do it in order (so you check each transaction when it's in the newest block you've seen). Also, I think at least geth does keep old states around. (That's how eth_call and eth_getStorageAt can give answers for old blocks.)
    – user19510
    Commented Dec 11, 2018 at 15:07
  • Hi @smarx , thanks for your comment! I am trying to understand how generalised plasma could work and how we could validate a previous txs without syncing the full node. Something like github.com/ethereum/EIPs/issues/726. My intuition is this requires snapshots of old world state to make it work. But from what I read, it seems implying old stateRoot would suffice. But I don't get how could that work ...
    – noooooooob
    Commented Dec 12, 2018 at 3:01

1 Answer 1

2

The ethereum client validates the blocks as it syncs them. If it's a fully synced node, it usually validates every block it receives. Otherwise, it does more or less checks, depending on the syncmode it's started in (full, fast, light). This answer offers some more details regarding syncmodes.

Once it's fully synchronized, the client knows that all the previous blocks are valid, so it doesn't need to check their validity again.

An ethereum client can check that a transaction is in a specific block using very few informations using Merkle Trees. This thread describes how ethereum uses these merkle trees

PS: a tx 10 blocks ago is not very old, it's merely about 2.5 minutes ago

2
  • Thanks for your input. Understanding that if a Ethereum node is synced, all blocks are valid, I am more interested to know if a particular transaction changed the state the way it was intended without syncing the entire blockchain all over again.
    – noooooooob
    Commented Dec 12, 2018 at 2:55
  • An ethereum client can check that a transaction is in a specific block understanding that this "inclusion" check is trivial with Merkle Tree. How could we verify the transaction is actually valid(mutating the state as it was intended) ?
    – noooooooob
    Commented Dec 12, 2018 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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