7

Often it is argued that one big advantage of blockchains is that anyone can come along and inspect the state. However I have not found any practical guide for doing this. Block explorers allow us to inspect transactions, but not state variables (as far as I know). So then how can I inspect state variables for any given smart contract already deployed?

4 Answers 4

4

EDIT: The blockchain explorer below is unfortunately dead. So far no blockchain explorer has shown contract state as clearly.


The ether.camp blockchain explorer allows some of this. Go to https://live.ether.camp and then click on "Smart Contracts."

Developers have to upload their source code to ether.camp, because raw code on the blockchain are just EVM bytecode / assembly. As time goes on, we would expect such tools to improve and be more prevalent.

For example: https://live.ether.camp/account/49f053b866c33185fa1151e71fc80d5fe6b08a92

enter image description here

ether.camp already shows the state for any given smart contract, but attaching the source code to the contract significantly improves the user experience.

3
  • Ok well is it even possible to do this for smart contract whose source code we do not have? Furthermore, does there exist tools today where we can do this?
    – zunior
    Apr 4, 2016 at 22:41
  • I added screenshot (when there's source code) and commented that when there's no source code "ether.camp already shows the state for any given smart contract". I could edit answer to answer "who's code I do not have" first, but that functionality has been around longer and I thought it would be more familiar to people already.
    – eth
    Apr 4, 2016 at 22:48
  • Website not more reachable.
    – kitsune
    Feb 15, 2019 at 18:02
1

Etherscan.io offers some of these features. Look up your contract by its address and view the Contract Tab.

There is a chance the developers published the source code and thereby verified the contract.

If this is not the case you must do with trying the decompiled bytecode or the opcode view.

4
  • State variables? I have not seen this. Functions, yes. Transactions, yes. Not current state. Can you link me to an example of this that you've seen on Etherscan?
    – Ryan Shea
    Nov 12, 2021 at 17:56
  • @RyanShea They are accessible only through respective getter functions which granted there are any, can be easily run on etherscan. All the constant state vars can obviously be viewed right away.
    – cqx
    Nov 13, 2021 at 7:40
  • Yes I am aware of what you’re referring to but this is not contract state. The tokenURI getter function for ERC721 is an example of what you’re talking about. What I’m looking for is the ability to see into global state variables of the contract. For example, if you add addresses one at a time to a list, it’d be nice to see the up-to-date fully constructed list.
    – Ryan Shea
    Nov 14, 2021 at 4:46
  • The answer from 2016 has a link to the old EtherCamp explorer which has essentially what I’d want but it is no longer functional.
    – Ryan Shea
    Nov 14, 2021 at 4:48
0

Etherscan has this service for sure, You can even debug the smart-contract and run different transactions.

0

The OP is asking exactly the right question. Every participant should be able to inspect all of the data all of the time. But, the two suggested sites mentioned above are a compromise on the real solution. A very important aspect of these cryptocurrencies that is being increasingly lost is the idea full decentralization. The true solution here is not web-based tools that centralize the data. The true solution would allow quick, easy access to all the data all the time directly from a locally running node. Not really an answer, just an important point this seems to rise above the level of a comment.

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.