GithubHelp home page GithubHelp logo

developer-devo / theta-tool-ethereum-erc20-snapshot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thetatoken/theta-tool-ethereum-erc20-snapshot

0.0 0.0 0.0 30 KB

A tool to extract all the holders of an ERC20 token at a given height

Python 100.00%

theta-tool-ethereum-erc20-snapshot's Introduction

A tool to export the snapshot of an ERC20 token at the target height.

Setup

install the curl command line tool

install python 2.7

pip install requests

Usage

Use the following command to extract the balance of all the ERC20 token holders. config_file_path points to the config file (see examples below). target_height is the height to export the snapshot. The result will be written into the file specified by balance_file_path.

python run.py <config_file_path> <target_height> <balance_file_path>

Examples

Here is an example of the config file config.json. The fields are self-explanatory. For example, genesis_height is the height (i.e. block number) of the block that contains the genesis transaction of the ERC20 smart contract.

{
  "ethereum_rpc_url" : "http://localhost:8545",
  "smart_contract_address" : "0x3883f5e181fccaf8410fa61e12b59bad963fb645",
  "genesis_height" : 4728491,
  "expected_total_supply" : 1000000000000000000000000000
}

On a machine with a fully-synced Geth node, run the following command to extract the balance of all the ERC20 token holders at block height 6958428, and save the result to ./balance.json

python run.py config.json 6958428 balance.json

Note 1: On an Ethereum node that does not keep the entire history trie, we need to supply with the latest block height (can get from etherscan.io). Otherwise the script might error out.

Note 2: Before running the script, it is better to restart the Ethereum node to reclaim some memory. Otherwise the script might stuck as the Ethereum node could consume all of the available memory during the sanpshot export.

theta-tool-ethereum-erc20-snapshot's People

Contributors

jieyilong 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.