Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pnicorelli/evm-test-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EVM Test Node with Explorer

A complete Docker-based setup for running a private EVM test network with block explorer using Geth and Epirus.

Quick Start

Prerequisites

  • Docker
  • Docker Compose

Setup Commands

  1. Create Docker network and volume:
# Create the network
docker network create virtual_office

# Create the persistent volume for blockchain data
docker volume create evm-node-data
  1. Start the services:
# Build and start all services
docker-compose up -d

# Check logs
docker-compose logs -f emv_node
  1. Stop the services:
docker-compose down

Services Overview

EVM Node Service (emv_node)

Main Ethereum node running Geth with Clique PoA consensus.

Ports:

  • 8545: HTTP RPC endpoint
  • 8546: WebSocket endpoint

Environment Variables:

  • CHAIN_ID: Network chain ID (default: 7979)
  • BLOCK_PERIOD: Block time in seconds (default: 12)
  • ACCOUNTS: Pre-funded accounts in format address:balance,address:balance
    • Format: 0xAddress:amountInWei
    • Example: 0xeED002fc450B60A7E8a4289A6CEeAF471c461aB0:1000000000000000000000

Block Explorer Services

  • evm_web: Web interface (Port 8100)
  • evm_api: API backend (Port 8101)
  • evm_ingestion: Data indexing service
  • evm_mongodb: Database for explorer data
  • evm_redis: Cache service

Network Access

MetaMask Configuration

Add custom network with these settings:

  • Network Name: EVM Test Network
  • RPC URL: http://localhost:8545
  • Chain ID: 7979
  • Currency Symbol: ETH
  • Block Explorer URL: http://localhost:8100

Direct RPC Access

HTTP RPC: http://localhost:8545 WebSocket: ws://localhost:8546

Block Explorer

Web Interface: http://localhost:8100

Pre-funded Test Accounts

The network comes with pre-funded accounts (configured via ACCOUNTS environment variable):

Default accounts:

  • 0xeED002fc450B60A7E8a4289A6CEeAF471c461aB0: 1000 ETH
  • 0x1d9463bD28934EDf65D731F1881d047614c1c10e: 1 ETH

Usage Examples

Using curl to interact with the node:

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

# Get account balance
curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xeED002fc450B60A7E8a4289A6CEeAF471c461aB0","latest"],"id":1}' \
  http://localhost:8545

Using MetaMask:

  1. Add the custom network (see configuration above)
  2. Import account using private keys or create new accounts
  3. Request test ETH from the pre-funded accounts

Network Specifications

  • Consensus: Clique Proof of Authority (PoA)
  • Block Time: 12 seconds
  • Gas Limit: 8,000,000
  • Chain ID: 7979
  • Network ID: 7979

File Structure

.
├── docker-compose.yaml    # Main orchestration file
├── Dockerfile            # EVM node container definition
├── entrypoint.sh         # Node startup script
└── README.md            # This file

Troubleshooting

Common Issues

Service won't start:

  • Ensure the virtual_office network exists: docker network create virtual_office
  • Ensure the volume exists: docker volume create evm-node-data

Can't connect from MetaMask:

  • Verify the node is running: docker-compose logs emv_node
  • Check if port 8545 is accessible: curl http://localhost:8545

Explorer not loading:

  • Wait a few minutes for all services to fully start
  • Check all services are running: docker-compose ps
  • View logs: docker-compose logs evm_web

Node data persistence:

  • Blockchain data persists in the evm-node-data Docker volume
  • To reset the blockchain: docker volume rm evm-node-data then recreate it

Customization

Adding More Pre-funded Accounts

Modify the ACCOUNTS environment variable in docker-compose.yaml:

environment:
  - ACCOUNTS=0xAddress1:1000000000000000000000,0xAddress2:2000000000000000000000,0xAddress3:500000000000000000000

Changing Block Time

Modify the BLOCK_PERIOD environment variable:

environment:
  - BLOCK_PERIOD=5  # 5 second blocks

Using Different Chain ID

Update the CHAIN_ID environment variable:

environment:
  - CHAIN_ID=1337

Security Note

This setup is for development and testing only. It uses:

  • Insecure account unlocking
  • Simple passwords
  • Open CORS policies
  • No authentication

Do not use in production environments.

About

Docker-based setup for EVM test node with block explorer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published