1

I'm currently using the ethereumjs libraries (https://github.com/ethereumjs) to iterate over the blockchain, replay transactions and read the state trie of a contract from the geth leveldb.

Currently I'm iterating over the blockchain sequentially to find state changes of the contract.

Is there any way to only find blocks where state changes occurred? Maybe through the state trie references depicted here (How Ethereum state tree is formed?)?

I know there could be a way using bloom filters if the contract produces logs but what if not? (correct me if I am wrong with this statement)

0

Well, it actually depends on the client and how it stores blockchain data.

You should separate two concepts: what the protocol dictates to verify blocks, transactions, receipts, and so on (that is the topic of the link you posted about Ethereum state tree) and how clients store blockchain data by their own while syncing.

The only way to obtain what you are searching for, without scanning all the blockchain, it is if the client already did this for you while syncing with other peers. As fas as I know, no client currently does this kind of indexing for you.

If you use geth, even if you scan directly the state tree inside leveldb, you should check every block to see if the current state is different from the previous one, so the scanning process is actually the same and there are no real advantages doing this way.

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.