Node Deployment & Compilation
Compile and Run​
Download​
Download source code via git:
git clone https://github.com/clayer/testnet-clayer-blockchain
Install Golang​
Reference: Go Download and install
Compile​
cd /path/to/clayer-blockchain
make geth
If you want to use cross compile, like compiling on Mac for Linux, use make geth-linux, make geth-linux-amd64, etc.
After compilation completed, the generated binary is in the folder build/bin.
Run​
By running ./build/bin/geth --help, we can get all option info. Specific usage can refer to Command-line Options.
Deployment​
SSD is required
Network​
Program will connect into mainnet after started. If want to connect the public testnet, you can add option --testnet to command when starting.
Hardware​
Minimum​
- 8 cores
- 16GB RAM
- SSD IOPS > 5k
Recommended​
- 16 cores
- 32GB RAM
- SSD IOPS > 5k
Network & Port​
- External IP Address
- Port TCP/UDP: 32668
Chain Node Configuration​
config.toml​
[Eth]
SyncMode = "fast"
DiscoveryURLs = []
TrieCleanCacheRejournal = 300000000000
[Eth.Miner]
GasFloor = 8000000
GasCeil = 8000000
GasPrice = 0
Recommit = 3000000000
Noverify = false
[Eth.Ethash]
CacheDir = "ethash"
CachesInMem = 2
CachesOnDisk = 3
CachesLockMmap = false
DatasetDir = "/data/clayer/data/.ethash"
DatasetsInMem = 1
DatasetsOnDisk = 2
DatasetsLockMmap = false
PowMode = 0
[Eth.TxPool]
Locals = []
NoLocals = false
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1
PriceBump = 10
AccountSlots = 16
GlobalSlots = 4096
AccountQueue = 64
GlobalQueue = 1024
Lifetime = 10800000000000
[Node]
DataDir = "/data/clayer/data"
InsecureUnlockAllowed = true
NoUSB = true
IPCPath = "geth.ipc"
HTTPHost = "0.0.0.0"
HTTPPort = 8545
HTTPCors = ["*"]
HTTPVirtualHosts = ["*"]
HTTPModules = ['eth', 'net', 'web3']
WSHost = "0.0.0.0"
WSPort = 8546
WSModules = ['eth', 'net', 'web3']
GraphQLVirtualHosts = ["localhost"]
[Node.P2P]
MaxPeers = 50
NoDiscovery = false
ListenAddr = "32668"
EnableMsgEvents = false
[Node.HTTPTimeouts]
ReadTimeout = 30000000000
WriteTimeout = 30000000000
IdleTimeout = 120000000000
Sync Mode Configuration​
Use fast sync in the config, if full needed, change this line:
SyncMode = "fast"
to:
SyncMode = "full"
Start Scripts​
To show full detail help info of all flags, type geth help or geth -h.
run.sh​
#!/usr/bin/env bash
/data/clayer/geth-linux-amd64 \
--config /data/clayer/config.toml \
--logpath /data/clayer/logs \
--verbosity 3 >> /data/clayer/logs/systemd_chain_console.out 2>&1
Archive Node​
If you need to use it as archive node, add:
--syncmode full \
--gcmode archive \
So:
#!/usr/bin/env bash
/data/clayer/geth-linux-amd64 \
--config /data/clayer/config.toml \
--logpath /data/clayer/logs \
--syncmode full \
--gcmode archive \
--verbosity 3 >> /data/clayer/logs/systemd_chain_console.out 2>&1
Network Selection​
If no any network flags were provided, the node will connect the clayer Blockchain-mainnet by default. If you want to connect to clayer Blockchain-testnet, add:
--testnet
Systemd Configuration​
[Unit]
Description=clayer Blockchain service
[Service]
Type=simple
ExecStart=/bin/sh /data/clayer/run.sh
Restart=on-failure
RestartSec=5s
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
Directory Structure​
Recommended directory structure for CLayer node deployment:
/data/clayer/
├── geth-linux-amd64 # Compiled binary
├── config.toml # Main configuration
├── run.sh # Startup script
├── data/ # Blockchain data
│ ├── geth/ # Node data
│ └── .ethash/ # Ethash cache
└── logs/ # Log files
├── geth.log
└── systemd_chain_console.out
Security Considerations​
File Permissions​
Set appropriate permissions for security:
# Create dedicated user
sudo useradd -r -s /bin/false clayer
# Set ownership
sudo chown -R clayer:clayer /data/clayer
# Set permissions
sudo chmod 755 /data/clayer
sudo chmod 600 /data/clayer/config.toml
sudo chmod 755 /data/clayer/run.sh
Firewall Configuration​
Configure firewall to allow only necessary ports:
# Allow SSH (if needed)
sudo ufw allow 22/tcp
# Allow CLayer P2P port
sudo ufw allow 32668
# Allow RPC (only if needed externally)
sudo ufw allow 8545/tcp
# Enable firewall
sudo ufw enable
Monitoring & Maintenance​
Log Monitoring​
Monitor node logs for issues:
# Real-time log monitoring
tail -f /data/clayer/logs/systemd_chain_console.out
# Search for errors
grep -i error /data/clayer/logs/systemd_chain_console.out
# Check sync status
grep -i "block" /data/clayer/logs/systemd_chain_console.out | tail -20
Health Checks​
Regular health check commands:
# Check if process is running
ps aux | grep geth
# Check network connectivity
netstat -tlnp | grep 32668
# Check disk space
df -h /data/clayer
# Check memory usage
free -h
Backup Strategy​
Important files to backup:
# Backup keystore and configuration
tar -czf clayer-backup-$(date +%Y%m%d).tar.gz \
/data/clayer/config.toml \
/data/clayer/data/keystore/ \
/etc/systemd/system/clayer.service
Troubleshooting​
Common Issues​
Sync Problems​
# Check peer connections
curl -H "Content-Type: application/json" \
-X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' \
http://localhost:8545
Performance Issues​
# Check system resources
top -p $(pgrep geth)
iostat -x 1
Connection Issues​
# Test port connectivity
telnet <your-ip> 32668
Getting Help​
For additional support:
- Join the community forums
- Review GitHub issues
After deploying your node, consider:
- Setting up monitoring
- Implementing security best practices
- Becoming a validator