Coder Social home page Coder Social logo

tineye's Introduction

Installation Guide

Tineye is a python utility that enables downloading code from the blockchain. Tineye depends on several python packages. We recommend the following package versions:

web3 3.16.4

Python 2.7

tineye requires python-2.7. Install the following packages with pip:

pip install web3 matplotlib colormap easydev

Downloading from the Blockchain

First, execute the geth server and allow it to start.

geth --rpc --rpcapi "eth,net,web3,debug" --cache=1024 --syncmode full

tineye requires the programmer specify the starting block and the number of blocks to download. By default, tineye stores the downloaded data in the .db/ethereum.db. For example, the following command downloads contracts from blocks 620,000 to 620,099.

python tineye.py download --start 620000 --n 100

Inspecting contracts on the blockchain

The smart contracts are organized by the contract id, which is the hash of the source code. To retrieve the list of contracts, and the number transactions involving each contract, use the following command:

python tineye.py stats --metric usage

To retrieve the list of contracts and their size, use the following command:

python tineye.py stats --metric size

To retrieve the list of contracts, and how many times the contract has been copied, use the following command:

python tineye.py stats --metric dups

Each of these commands will return a tab-delimited list of the form:

007d5a5af7225b77a49c4ccb214edb50862480d5	9928
aaa47b2a0275e2d22d8cad58594264d41e6a59c8	2434
f625028de562d2de7316af6c042d9bbb20511bd3	1530
d8f963ca3bdada6f1c1ffa36da8037bbeba83e12	11348
89d9b8ee82b61a531a35081bb17c6c9618d5fbf1	100
87d5899da0de5a6590c0b065a8ef0374dadddb07	3648

Where the first number is the hash of the code, and the second number is the metric specified (size/usage/dups).

Inspecting the contract code

tineye supports retrieving the code of smart contracts. To do so, find the program id (the hash of the code) of the contract of interest, and execute the following command:

python tineye.py analyze --prog d8f963ca3bdada6f1c1ffa36da8037bbeba83e12

The resulting bytecode and traces is stored in:

.prog/ID

The code.byte and code.byte.pretty are hex and human-readable versions of the bytecode. The traces folder constrains the execution traces of all the transactions that use the program.

tineye supports decompiling and reconstructing the decompiled program using the --decompile and --reconstruct flags. These features are experimental. tineye also supports dumping the traces using the --trace flag.

tineye's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.