npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ethstatedb

v1.0.8

Published

Command to check Ethereum state database

Downloads

21

Readme

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