1

I'd like to build an algorithm that analyzes value creation, transfer and destruction on a blockchain (such as new ETH minted, ETH gas burned, ERC-20 tokens transferred, etc.).

Assuming I have a database of all Solidity function signatures and event signatures (such as https://4byte.directory), is it possible to identify any action on a blockchain that modifies value?

A simple use case is event signature 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef (which is an ERC-20 token transfer). I could write code that analyzes that log event and see who sent however many of which tokens to whomever else.

But that's a simple use case since I know ahead of time that signature 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef causes the movement of value between 2 addresses. For the hundreds of thousands of function and event signatures on a blockchain, I need to determine whether they modify value...and how.

While trying to uncover more actions which modify value, I'm curious...

  1. Are all value-modifying events required to emit log events, or is that up to the Solidity contract developers? If not, can this be discovered in the contract's functions?
  2. Are there a set of opcodes and/or data types which can reliably be used to see value being created, destroyed or transferred?
  3. Is there a simpler way (without digging into the opcodes and such) where the outcome of any blockchain transaction shows ALL deltas of what coin and token values were changed as a result of executing the contract function (i.e. before state and after state)?

I figure I can get some of this information (like ETH minted, gas used, ETH native coin transferred, etc.) from the eth_getBlockByNumber RPC method (with full transaction details). But I know that doesn't cover token activity (which I hope to get from events/logs) and possibly other value-modifying actions from custom contracts (other than ERC-20, ERC-721, etc).

I appreciate any guidance you can offer.

0

Your Answer

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

Browse other questions tagged or ask your own question.