Sign inSign up

lord1egypt/ethsmith

By lord1egypt

•Updated 4 months ago

Ganache-compatible Ethereum dev node — Anvil engine, LevelDB persistence, full Cancun support

Image
API management
Internet of things
Developer tools
0

676

lord1egypt/ethsmith repository overview

⁠ethsmith

The unified Ethereum development toolkit — Ganache-compatible API, powered by Foundry's Forge + Cast + Anvil + Chisel, with LevelDB persistence.

npm GitHub License: MIT


⁠Why ethsmith?

ProblemSolution
Ganache is archivedDrop-in replacement — same CLI flags, same RPC API
Anvil is fast but different CLIAll ganache-cli flags work unchanged
Anvil state files are 100 MB+ JSONLevelDB — compact, indexed, < 10 MB
Four separate Foundry toolsOne CLI: compile, test, call, deploy, repl
Ganache's JS EVM was slowAnvil's Rust EVM is 100x faster

⁠Quick Start

# Ephemeral — fresh chain every restart
docker run -p 8545:8545 lord1egypt/ethsmith:latest

# Persistent — state survives restarts
docker run -p 8545:8545 -v ethsmith-data:/root/.ethsmith/db lord1egypt/ethsmith:latest

# Detached (background)
docker run -d -p 8545:8545 --name ethsmith lord1egypt/ethsmith:latest

Mount to /root/.ethsmith/db not /root/.ethsmith — binaries live in /root/.ethsmith/bin inside the image.


⁠All docker run Options

⁠Accounts
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --deterministic
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --accounts 20
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --balance 5000
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --mnemonic "word1 word2 word3 ..."
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --unlock 0xYourAddress
⁠Network & Chain
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --chain-id 31337
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --gas-limit 60000000
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --gas-price 1000000000
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --hardfork cancun
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --hardfork shanghai
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --optimism
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --order fifo
⁠Block Time (Mining)
# Instamine — every tx mines a block immediately (default)
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --deterministic

# Mine every N seconds
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --deterministic --block-time 1
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --deterministic --block-time 5
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --deterministic --block-time 12

# Disable auto-mining (mine manually via anvil_mine RPC)
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --no-mining
⁠Fork Mode
# Fork by network name (built-in RPC endpoints)
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --fork.network mainnet
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --fork.network sepolia
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --fork.network arbitrum
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --fork.network optimism
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --fork.network base
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --fork.network polygon

# Fork from custom URL
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --fork https://eth.llamarpc.com

# Fork at specific block (reproducible)
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --fork https://eth.llamarpc.com@20000000

# Fork with your own API key (env var keeps it out of shell history)
docker run -p 8545:8545 \
  -e ETHSMITH_FORK_MAINNET_URL=https://mainnet.infura.io/v3/YOUR_KEY \
  lord1egypt/ethsmith:latest node --fork.network mainnet

# Fork + persistence
docker run -p 8545:8545 \
  -v ethsmith-fork:/root/.ethsmith/db \
  lord1egypt/ethsmith:latest node --fork.network mainnet
⁠Logging
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --log-level debug
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --log-level warn
docker run -p 8545:8545 lord1egypt/ethsmith:latest node --log-level error

# Write logs to a mounted file
docker run -p 8545:8545 -v ./logs:/logs lord1egypt/ethsmith:latest \
  node --log-file /logs/ethsmith.log

# Via environment variable
docker run -p 8545:8545 -e ETHSMITH_LOG_LEVEL=debug lord1egypt/ethsmith:latest
⁠Full Example
docker run -d \
  --name ethsmith-dev \
  -p 8545:8545 \
  -v ethsmith-data:/root/.ethsmith/db \
  -e ETHSMITH_FORK_MAINNET_URL=https://eth.llamarpc.com \
  lord1egypt/ethsmith:latest \
  node \
    --deterministic \
    --accounts 20 \
    --balance 10000 \
    --chain-id 1337 \
    --block-time 1 \
    --fork.network mainnet \
    --gas-limit 60000000 \
    --state-interval 10 \
    --log-level debug

⁠docker-compose

version: '3.8'
services:
  node-dev:
    image: lord1egypt/ethsmith:latest
    ports: ['8545:8545']
    volumes: ['./data/dev:/root/.ethsmith/db']
    command: node --deterministic --chain-id 1337
    restart: unless-stopped

  node-mainnet-fork:
    image: lord1egypt/ethsmith:latest
    ports: ['8546:8545']
    volumes: ['./data/fork-mainnet:/root/.ethsmith/db']
    environment:
      - ETHSMITH_FORK_MAINNET_URL=https://eth.llamarpc.com
    command: node --fork.network mainnet --block-time 12
    restart: unless-stopped

  node-sepolia-fork:
    image: lord1egypt/ethsmith:latest
    ports: ['8547:8545']
    volumes: ['./data/fork-sepolia:/root/.ethsmith/db']
    command: node --fork.network sepolia --deterministic
    restart: unless-stopped

  node-ci:
    image: lord1egypt/ethsmith:latest
    ports: ['8548:8545']
    command: node --deterministic --no-mining --log-level error

volumes:
  ethsmith-data:

⁠Flags Reference

FlagDefaultDescription
--deterministicfalseSame 10 accounts every run
--accounts <n>10Number of accounts
--balance <eth>1000Starting ETH per account
--mnemonic <phrase>randomBIP39 mnemonic
--chain-id <id>1337Chain ID
--block-time <s>0 (instamine)Seconds between blocks
--no-miningfalseDisable auto-mining
--fork <url>—Fork from RPC URL
--fork.network <name>—Fork by name
--hardfork <name>cancunEVM hardfork
--gas-limit <n>30000000Block gas limit
--gas-price <wei>1000000000Minimum gas price
--unlock <addr>—Impersonate on startup
--state-interval <s>30LevelDB checkpoint seconds
--keep-historyfalseKeep full block history
--order <type>feesTX ordering: fees or fifo
--optimismfalseOptimism L2 mode
--log-level <level>infodebug/info/warn/error
--log-file <path>~/.ethsmith/logsLog file path

Environment variables:

VariableDescription
ETHSMITH_LOG_LEVELLog level
ETHSMITH_LOG_FILELog file path
ETHSMITH_FORK_MAINNET_URLOverride mainnet RPC
ETHSMITH_FORK_SEPOLIA_URLOverride sepolia RPC
ETHSMITH_FORK_ARBITRUM_URLOverride arbitrum RPC
ETHSMITH_FORK_OPTIMISM_URLOverride optimism RPC
ETHSMITH_FORK_BASE_URLOverride base RPC
ETHSMITH_FORK_POLYGON_URLOverride polygon RPC

⁠Key RPC Methods (curl)

# Block number
curl -s -X POST http://localhost:8545 -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'

# Mine 100 blocks instantly  (0x64 = 100)
curl -s -X POST http://localhost:8545 -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"anvil_mine","params":["0x64"]}'

# Mine 1000 blocks instantly  (0x3E8 = 1000)
curl -s -X POST http://localhost:8545 -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"anvil_mine","params":["0x3E8"]}'

# Set balance to 10,000 ETH
curl -s -X POST http://localhost:8545 -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"anvil_setBalance","params":["0xYourAddress","0x21E19E0C9BAB2400000"]}'

# Send ETH (accounts pre-unlocked with --deterministic)
curl -s -X POST http://localhost:8545 -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_sendTransaction","params":[{"from":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","to":"0x70997970C51812dc3A010C7d01b50e0d17dc79C8","value":"0xDE0B6B3A7640000"}]}'

# Snapshot
curl -s -X POST http://localhost:8545 -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"evm_snapshot","params":[]}'

# Revert to snapshot 0x1
curl -s -X POST http://localhost:8545 -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"evm_revert","params":["0x1"]}'

Full RPC examples: https://github.com/Lord1Egypt/ethsmith/blob/main/RPC_EXAMPLES.md⁠


⁠Deterministic Accounts

[0] 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266  key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
[1] 0x70997970C51812dc3A010C7d01b50e0d17dc79C8  key: 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
[2] 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC  key: 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
[3] 0x90F79bf6EB2c4f870365E785982E1f101E93b906  key: 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6
[4] 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65  key: 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
[5] 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc  key: 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba
[6] 0x976EA74026E726554dB657fA54763abd0C3a0aa9  key: 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e
[7] 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955  key: 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356
[8] 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f  key: 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
[9] 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720  key: 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6

Mnemonic: test test test test test test test test test test test junk


Tag summary

Content type

Image

Digest

sha256:83be78ccb…

Size

287.8 MB

Last updated

4 months ago

docker pull lord1egypt/ethsmith