Skip to content

Provides EVM State access through a stand-alone C++ executable.

License

Notifications You must be signed in to change notification settings

FraktalLabs/evm-state-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EVM State DB

readme style standard

Ethereum VM state database

Stand-alone C++20 executable used to run EVM state database. Basically acts as a command wrapper around evm-cpp-utils state.

Table of Contents

Install

make all

NOTE: Dependencies must be compiled & linked into compilation aswell.

Usage

evm-state-db comes with various commandline functions, including :

Get - get a value at (contract address, key) pair in state

./bin/evm-state-db get --snapshotFile ./path/to/snapshot.json --contractAddress 4200000000000000000000000000000000000000 --key 42

Set - set a value at (contract address, key) pair in state ( and saves changes )

./bin/evm-state-db set --snapshotFile ./path/to/snapshot.json --contractAddress 4200000000000000000000000000000000000000 --key 42 --value 512

Run - runs an RPC server giving access to EVM state db ( for gets and sets ) ( TODO: not yet implemented )

./bin/evm-state-db run --snapshotFile ./path/to/snapshot.json --rpcPort 8999
# Get request
curl -X POST -H "Content-Type: application/json" --data '--contractAddress 4200000000000000000000000000000000000000 --key 42' http://localhost:8999
# Set request
curl -X POST -H "Content-Type: application/json" --data '--contractAddress 4200000000000000000000000000000000000000 --key 42 --value 512' http://localhost:8999

Note : Use -h flag on each sub-command to see more options

Dependencies

  • intx : 256-bit (32-byte) unsigned integers
  • ethash : Ethereum hash functions
  • evm-cpp-utils : EVM state types + utils

Testing

This repo contains various tests under ./test/ to make sure things are working. To run use :

make get-test
make set-test

# RPC test
make run-rpc-local
# In a seperate terminal
make get-rpc-test
make set-rpc-test
make get-rpc-test
# Ctrl-C to stop RPC & snapshot state

Check the diff in ./test/snapshot.json to see if things processed properly.

Maintainer

Brandon Roberts @b-j-roberts

License

MIT

About

Provides EVM State access through a stand-alone C++ executable.

Resources

License

Stars

Watchers

Forks

Packages

No packages published