Register
Submit a solution
The challenge is finished.

Challenge Overview

Mythril has an exploration feature for searching and analyzing smart contracts on the Ethereum blockchain:
https://github.com/ConsenSys/mythril#blockchain-exploration

To enable this feature, Mythril builds its own smart contract database. The contract data is received from an Ethereum node over IPC or RPC (--sync-db command). This is however slow and inefficient. A much better way would be to directly access the LevelDB database of a locally installed go-ethereum node.

In this challenge, your task is to add a local geth leveldb interface to Mythril. This should be accomplished by writing a Python class capable of doing the following:
  • Obtain the runtime bytecode and balance of a contract account by address;
  • Access the storage of any account by address;
  • Iterate through all existing contract accounts;
  • Iterate through a subset of contract accounts, such as those with non-zero balance.
Use of the leveldb interface should be optional. By passing the --leveldb flag to Mythril, users should be able to execute the following existing functions without the need to first sync over RPC:
$ myth -d/-x/-g -a [address] # disassemble / analyze / create CFG of contract at address
[address]
$ myth —search # search all smart contracts for opcode and function patterns
$ myth --storage 0,1 # read account storage contents

Notes:

States in the leveldb are represented as a Merkle patricia tree (the “trie"). The goethereum implementation can be found here:
https://github.com/ethereum/goethereum/blob/55599ee95d4151a2502465e0afc7c47bd1acba77/core/state/database.g
o


Article about the Trie:
https://easythereentropy.wordpress.com/2014/06/04/understanding-the-ethereum-trie/

Related issue on the Mytrhil Github repo:
https://github.com/ConsenSys/mythril/issues/15

A few stack overflow posts (unfortunately not very helpful):
https://ethereum.stackexchange.com/questions/1635/how-to-parse-blocks-withpython
https://ethereum.stackexchange.com/questions/5999/format-of-leveldb-files-in-nodesdirectory-trouble-pulling-contents-with-python

Final Submission Guidelines

Submit Git patch for Mythril (against the latest commit in master branch, which is a603772956bca7059635627f87966fa8879e900b at the moment of writing), along with verification instructions and a brief demo video.

ELIGIBLE EVENTS:

2018 Topcoder(R) Open

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30063861