Skip to main content
Docker provides an easy way to deploy and manage Viction nodes without dealing with complex dependency management. This guide covers both building and running Viction nodes in Docker containers.

Quick Start

The fastest way to get started is using the official pre-built Docker image:

Building the Docker Image

To build the Viction node Docker image from source:
1

Clone the repository

2

Build the image

This builds a multi-stage Docker image that:
  1. Compiles the tomo binary using Go 1.18
  2. Creates a minimal Alpine-based runtime image
  3. Includes the entrypoint script and genesis files
3

Verify the build

You should see your newly built image listed.

Environment Variables

The Docker container is configured using environment variables. Here’s the complete reference:

Network Configuration

string
default:"88"
Network identifier:
  • 88: Viction Mainnet
  • 89: Viction Testnet
string
default:"unnamed_xxxxxx"
Your node’s name. If not set, a random name is generated.
string
Path to a custom genesis JSON file. If not set, uses the default genesis for the network ID.
string
Comma-separated list of enode URLs for bootstrap. Uses default bootnodes if not set.
string
Your external IP address. Only use if you have trouble connecting to peers.
string
default:"30303"
P2P port for peer connections. Must map host port to the same value.
string
default:"25"
Maximum number of peers. Set to 0 to disable P2P.

Sync and Performance

string
default:"full"
Blockchain sync mode:
  • fast: Fast synchronization
  • full: Full synchronization
  • light: Light client mode
string
default:"3072"
Maximum number of executable transaction slots for all accounts.
string
default:"768"
Maximum number of non-executable transaction slots for all accounts.

Account Management

string
Private key in plain text to import into keystore. Use this OR provide keystore files, not both.
Passing private keys via environment variables is convenient but less secure. For production, use mounted keystore files.
string
Password for encrypting/decrypting account. Can also mount password file to /tomochain/password.

Network Stats

string
default:"netstats-server"
Hostname of ethstats service.
string
default:"3000"
Port of ethstats service.
string
Secret for ethstats service. If not set, node won’t report to netstats.

Advanced Options

string
Enable archive mode and debug APIs. Set to any non-empty value to enable.
Enables:
  • --gcmode archive
  • --rpcapi db,eth,net,web3,debug,posv
string
Enable reward snapshots for each epoch. Requires DEBUG_MODE or archive mode.
string
Always commit transactions. Set to any non-empty value to enable.
number
default:"3"
Logging verbosity (1-5).
number
Timeout for RPC HTTP handlers in seconds.

Volume Mounts

The Docker container expects several mounted volumes:

Data Directory

Mount point: /tomochain/dataStores blockchain data and state.

Keystore

Mount point: /tomochain/keystoreStores encrypted account keys.

Password File

Mount point: /tomochain/passwordContains account password.

Exposed Ports

The Docker image exposes three ports:
port
HTTP-RPC endpoint for JSON-RPC API calls
port
WebSocket-RPC endpoint for WebSocket connections
port
P2P port for peer-to-peer communication (TCP and UDP)

Deployment Examples

Docker Compose

For easier management, use Docker Compose:
docker-compose.yml
Start the node:
View logs:
Stop the node:

Entrypoint Script Details

The Docker image uses an entrypoint script (docker/tomochain/entrypoint.sh) that:
1

Processes environment variables

Converts environment variables to command-line flags and handles file-based configuration.
2

Initializes blockchain

If no blockchain data exists, initializes with the appropriate genesis block (mainnet or testnet).
3

Manages accounts

  • Imports private key if PRIVATE_KEY is set
  • Creates password file if needed
  • Unlocks the first available account
4

Configures networking

Sets up bootnodes, NAT, and ethstats based on environment variables.
5

Starts the node

Launches tomo with all configured parameters:
  • RPC enabled on 0.0.0.0:8545
  • WebSocket enabled on 0.0.0.0:8546
  • P2P on configured port
  • CORS and virtual hosts set to ”*” for development

Container Management

View Logs

Access Container Shell

Check Sync Status

Stop Container

Remove Container

Update to Latest Version

Production Best Practices

Data Persistence

  • Always use named volumes or bind mounts
  • Regularly backup keystore and data directories
  • Use volume drivers for cloud storage
  • Monitor disk space usage

Resource Limits

Set resource constraints:

Security

  • Don’t expose RPC publicly without authentication
  • Use firewall rules to restrict access
  • Rotate credentials regularly
  • Use Docker secrets for sensitive data

Monitoring

  • Use --restart unless-stopped for auto-restart
  • Configure log rotation
  • Monitor container health
  • Set up alerts for downtime

Troubleshooting

Check logs:
Common issues:
  • Invalid password file
  • Missing keystore files
  • Insufficient disk space
  • Port already in use
Verify:
  • Container is running: docker ps
  • Ports are mapped: docker port viction-node
  • Firewall allows connections
  • RPC endpoint is accessible from host
Optimize:
  • Increase container memory limit
  • Use SSD storage
  • Check network bandwidth
  • Consider using fast sync mode
Solutions:
  • Use --gcmode full instead of archive
  • Disable --store-reward if not needed
  • Set up log rotation
  • Prune Docker system: docker system prune

Multi-Node Setup

For advanced users running multiple nodes:
docker-compose.multi.yml

Next Steps

Configuration Reference

Learn about all available configuration options

Running a Full Node

Detailed guide on operating a full node