I would like to know if it is possible to read blockchain transactions from a smart contract. How web3 has the possibility to scroll, read and decrypt the input data of the transactions, does solidity have similar possibilities? What kind of operations does this allow me to do on the blockchain?

Only these? Thanks!


2 Answers 2


Smart contract has quite limited abilities to observe blockchain content. Basically, Solidity allows reading the following information:

  1. Hashes of 256 most recent blocks
  2. Current block's miner address
  3. Current block difficulty
  4. Current block gas limit
  5. Current block number
  6. Current block timestamp
  7. Current transaction gas price
  8. Current transaction origin (i.e. from address)
  9. Current contract's storage slots allocated for state variables
  10. Current balance of arbitrary address

EVM allows reading a bit more (available in Solidity via inline assembly):

  1. Arbitrary slots of current contract's storage
  2. Byte code of arbitrary contract
  3. Hash of byte code of arbitrary contract

And that's basically it.


A compiled Solidity contract does it automatically for you.

  • Transaction is send to an account with code payload

  • Code execution starts from the first EVM byte

  • The main function will match the 32-bit function identified (keccak hash) and then jump to this function with function arguments pushed to stack <--- This is effectively decoding which you are probably asking for

Please note that the contract cannot read other contracts, only incoming contracts to itsself.

Hope this helps.

  • Please note that the contract cannot read other contracts, only incoming contracts to itsself. What do you mean? I can have interaction between contract like this: ethereum.stackexchange.com/questions/1599/…
    – Chaos
    Commented Apr 15, 2019 at 14:54
  • Technically the interaction happens in the same transaction. Commented Apr 16, 2019 at 10:49

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