ethstatedb
Command to check Ethereum state database
Last updated 20 days ago by shenghu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ethstatedb 
SYNC missed versions from official npm registry.

ethstatedb

Command to check Ethereum state database

Version Downloads/week License CircleCI Coverage Status semantic-release

This cli is created when I was studying Ethereum. I was curious about when and how an accout is created and maintained by Ethereum state database. From Diving into Ethereum's world state, it explains that accounts are not created in state database until there is a transaction for it. So I create this small tool to verify it.

Usage

$ npm install -g ethstatedb

$ ethstatedb account -d .db/chaindata/ -r 0xecc60e00b3fe5ce9f6e1a10e5469764daf51f1fe93c22ec3f9a7583a80357217 0x095e7baea6a6c7c4c2dfeb977efac326af552

Address   0x095e7baea6a6c7c4c2dfeb977efac326af552 
Balance   0                                       
Nonce     0                                       
StateRoot                                         
CodeHash 

Commands

ethstatedb account [ADDRESS]

Retrieve account information from Ethereum state database

USAGE
  $ ethstatedb account ADDRESS

ARGUMENTS
  ADDRESS  public key of an account, e.g. 
           0x7C476EA4e20D6d49820Ee810C0C474ED11b3f527

OPTIONS
  -d, --dbdir=dbdir    (required) path of Ethereum state database, e.g. 
                       ethereum/geth/chaindata

  -h, --help           show CLI help

  -r, --root=root      (required) value of stateRoot

  --skip-copy          skip copying database to .ethstatedb. By default, 
                       database is copied to avoid messing the original 
                       database.

  --work-dir=work-dir  directory to pull down database

EXAMPLE
  $ ethstatedb account --dbdir /home/data/ethereum-node1/geth/chaindata --root 
  0x595e3a0db7f38600770a267b12b67a8da1c202fef4b6c21e60fdb92477d89753 
  0x7C476EA4e20D6d49820Ee810C0C474ED11b3f527

ethstatedb help

Display help for ethstatedb

Command to check Ethereum state database

VERSION
  ethstatedb/1.0.5 darwin-x64 node-v10.15.3

USAGE
  $ ethstatedb [COMMAND]

COMMANDS
  account  load information of an account
  help     display help for ethstatedb

More information

  1. When playing with data generated by geth, make sure to stop geth so that it flushes all data to database. This command by default copies the data to a temp location, i.e. .ethstatedb, to avoid messing up the original database. However, you can use --skip-copy to use original database.
  2. To get stateRoot, use geth attach ipc://path/to/geth.ipc to connect to a node. Then use eth.getBlock(eth.blockNumber).stateRoot to get stateRoot for the latest block. You can change eth.blockNumber to be number of the specific block that you are interested in.

References

  1. ethereum_database_research_and_testing
  2. ethereumjs-vm
  3. Diving into Ethereum's world state

Current Tags

  • 1.0.7                                ...           latest (20 days ago)

10 Versions

  • 1.0.7                                ...           20 days ago
  • 1.0.6                                ...           23 days ago
  • 1.0.5                                ...           24 days ago
  • 1.0.4                                ...           24 days ago
  • 1.0.3                                ...           24 days ago
  • 1.0.2                                ...           24 days ago
  • 1.0.0                                ...           24 days ago
  • 0.0.3                                ...           25 days ago
  • 0.0.2                                ...           25 days ago
  • 0.0.1                                ...           25 days ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1,123
Dependencies (19)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |