This repository contains the Docker setup for running a ThaiChain blockchain node. The node runs both the execution layer (Geth) and consensus layer (Lighthouse) clients to participate in the ThaiChain network.
ThaiChain is a blockchain network with the following specifications:
- Chain ID: 7
- Network: Thaichain
- Execution Layer: Geth (Ethereum Go Client)
- Consensus Layer: Lighthouse
- Docker and Docker Compose installed on your system
- A server with a public IP address
- Sufficient disk space for blockchain data
- Network ports 30303, 9000, 8551, 5052 open for inbound/outbound traffic
git clone <repository-url>
cd tch-nodeBefore starting the node, you must run the update_ip.sh script to automatically detect and set your public IP address in the .env file:
chmod +x update_ip.sh
./update_ip.shThis script will:
- Automatically detect your public IP address
- Update the
NODE_PUBLIC_IPvariable in the.envfile - Create a backup of your original
.envfile
Note: The NODE_PUBLIC_IP variable is crucial for proper node discovery and networking. Without running this script, your node may not be able to connect to the network properly.
Edit the .env file to customize your node settings:
nano .envKey environment variables:
NODE_PUBLIC_IP: Your public IP address (automatically set by update_ip.sh)FEE_RECIPIENT: Ethereum address to receive transaction feesCHAIN_ID: Network chain ID (default: 7)ELNODES: Execution layer boot nodesCLNODES: Consensus layer boot nodes
Use Docker Compose to start both the execution and consensus layer clients:
docker-compose up -dThis will start:
- Geth: The execution layer client on port 8545 (HTTP), 8546 (WS), and 30303 (P2P)
- Lighthouse: The consensus layer client on port 5052 (HTTP) and 9000 (P2P)
- Image:
ethereum/client-go - Data Directory:
./data/geth - Sync Mode: Full sync with archive state
- HTTP API: Available on
http://localhost:8545 - WebSocket API: Available on
ws://localhost:8546 - Auth RPC: Available on port 8551
- Image:
sigp/lighthouse:v8.0.0 - Data Directory:
./data/lighthouse - HTTP API: Available on
http://localhost:5052 - P2P Port: 9000 (UDP/TCP)
- Checkpoint Sync: Uses
https://cl.thaichain.org
Main consensus layer configuration including:
- Genesis settings
- Fork schedule
- Network parameters
- Validator settings
Execution layer genesis block configuration.
JWT secret for communication between execution and consensus layers.
Initialization script for Geth that sets up the genesis block.
To view logs for both services:
docker-compose logs -fTo view logs for a specific service:
docker-compose logs -f geth
docker-compose logs -f beaconCheck if your node is syncing properly by accessing:
- Execution layer:
http://localhost:8545 - Consensus layer:
http://localhost:5052
Make sure the following ports are open on your firewall:
- 30303: Execution layer P2P (TCP/UDP)
- 9000: Consensus layer P2P (TCP/UDP)
- 8551: Auth RPC for execution layer
- 5052: Consensus layer HTTP API
The node is pre-configured with official ThaiChain boot nodes for both execution and consensus layers.
-
Node not connecting to peers
- Ensure you ran
./update_ip.shbefore starting - Check that your public IP is correctly set in
.env - Verify ports 30303 and 9000 are open
- Ensure you ran
-
Low disk space
- Monitor disk usage in
./data/directories - Consider using snapshot sync instead of full sync if needed
- Monitor disk usage in
-
Sync stuck
- Check logs for any error messages
- Verify network connectivity
- Restart services:
docker-compose restart
To completely reset your node data:
docker-compose down
sudo rm -rf data/
docker-compose up -dWarning: This will delete all blockchain data and require resyncing from scratch.
- Keep your Docker and system packages updated
- Use a firewall to restrict access to RPC ports
- Monitor node logs for suspicious activity
- Backup your
.envfile and configuration
For additional support:
- Check the official ThaiChain documentation
- Join the ThaiChain community channels
- Review log files for error messages
This repository is licensed under the terms specified in the LICENSE file.