This article is part 2 of a two part series covering storage decoding of Solidty based contracts on Ethereum. This article covers the Ethereum storage decoder tool.This tool allows you to look at the state of any contract stored on any Ethereum based block chain as long as you have the source and address of the contract. For map types the keys must be known in order to view the data. Currently only solidity based contracts are supported. Part1 of this article covers the concepts used by this tool to decode storage.
The source and binaries of this tool are locate at : https://github.com/inukaeth/ethstoragedecode
The Etheirum Storage Decode tool
I used my findings described in part 1 of this article to write a simple decode tool to decode storage values of a smart contract. The tool was written in .net core. ANTRL was used to parse the solidity contract code. I used the ANTLR grammer by Fredrico Bond( Github link). This grammer was used to generate a c# ANTRL wrapper class which was overridden so that the variables could be parsed and the values decoded. The nethereum framework was used to interface with Ethereum.
Currently the tool supports decoding of a single contract. The tool also supports a single solidity source file with multiple contract definitions. In this case the primary contract name must be provided for the decode to work. I have made the tool and source available as a development release given the limited amount of testing that has been performed
Note the tool takes in a json file named settings.json as input. Since decoding maps requires knowing the key values, the known keys or dimensions(for multi-dimensional maps) must be provided. Multi-dimensional map key are comma separated
Sample Json File :
The tool source and binaries can be downloaded from:
Note that eitherscan currently supports data decoding of contracts that are deployed.