Skip to Content
Welcome to RitoSwap's documentation!
Local BlockchainOverview

Local Blockchain

Version: 0.2.0

Overview

The Local Blockchain workspace provides a complete Ethereum Proof of Authority (PoA) blockchain environment for local development. This includes:

  • Geth Archive Node: A single validator PoA Ethereum node (v1.12.2)
  • Blockscout Explorer: Full-featured blockchain explorer for inspecting transactions, blocks, and contracts
  • Automated Setup: Scripts to initialize, manage, and clean your local blockchain

This workspace is designed for testing smart contracts and dApps in a controlled environment with fast block times and predictable behavior.

Note: If you see references to “ritonet” in the codebase, that’s just a branded / internal name for this local blockchain setup.

Prerequisites

  • Docker and Docker Compose installed
  • Node.js and pnpm
  • Available ports: 8545 (RPC), 8546 (WebSocket), 4000 (Blockscout)

Installation and Setup

  1. Install dependencies: bash pnpm install

  2. Run the setup script:

    pnpm setup-all

    This will:

    • Create necessary directories
    • Generate a validator keystore (if not exists)
    • Create genesis.json with your validator
    • Initialize the genesis block
    • Clone Blockscout (if needed)
  3. Start the network:

    pnpm start

Configuration

The network is configured via .env file with these key settings:

VariableDefaultDescription
LOCAL_CHAIN_ID90999999Chain ID for your network
BLOCK_TIME27Seconds between blocks
RPC_PORT8545HTTP-RPC port
RPC_WS_PORT8546WebSocket port
BLOCKSCOUT_PORT4000Explorer web interface
KEYSTORE_PASSWORDtesttesttestValidator key password
TEST_ACCOUNT0xee15…Pre-funded test account

Password Configuration

The default password is testtesttest. To use a custom password:

  1. Update KEYSTORE_PASSWORD in .env before running setup.
  2. Or manually edit config/password.txt before running setup.

Pre-funded Accounts

By default, two accounts receive ETH in the genesis block:

  • Validator Address: Auto-generated during setup, receives 10,000 ETH
  • Test Account: Configure via TEST_ACCOUNT in .env, receives 10,000 ETH

You can add your own address to .env as TEST_ACCOUNT before running setup.

Geth Version

We use Geth v1.12.2 specifically. While newer versions exist, Proof of Authority is deprecated and v1.12.2 provides excellent stability and all features needed for local development.

Manual Genesis Generation

If you need to generate the genesis block without redoing the complete setup:

pnpm run generate:genesis

This reads your .env configuration and creates a new config/genesis.json.

Docker Container Conflicts

If you have existing containers with the same names, clean them up:

docker-compose down -v # or pnpm run clean