Set up a node on testnet
Description: Instructions for setting up and running an aelf testnet node using Docker or binaries, including database setup and configuration.
Purpose: To provide detailed guidance on configuring, deploying, and maintaining an aelf testnet node, facilitating testing and development of decentralized applications.
You can run an aelf node using Docker (recommended) or GitHub binaries. Before starting, install the necessary tools and frameworks. Detailed instructions are in the environment setup section.
Steps to Set Up a Node:
- Download and load the database snapshot.
- Download template settings and Docker run script.
- Modify appsettings as needed.
- Run and check the node.
Minimum Configuration:
- c5.large or N2 instance: 2 vCPU, 4GiB RAM, 800GiB storage, 5 Mbps internet bandwidth
Recommended Configuration:
- c5.xlarge or N2 instance: 4 vCPU, 8GiB RAM, 800GiB storage, 100 Mbps internet bandwidth
Note: For testing or dApp deployment, run a dAppChain node only. Use the same configuration for multiple nodes on both MainChain and dAppChain.
Time Syncing: Ensure your server is time-synced via NTP to avoid syncing issues.
Setup the Database
We support Redis and SSDB. For testnet, we use SSDB snapshots. Configure two SSDB instances: one for chain database and one for state database.
Import the Snapshot Data
-
Download Snapshot:
mkdir snapshot
cd snapshot
curl -O -s https://aelf-node.s3-ap-southeast-1.amazonaws.com/snapshot/testnet/download-mainchain-db.sh
sh download-mainchain-db.sh -
Restore Chain Database:
tar xvzf aelf-testnet-mainchain-chaindb-*.tar.gz
stop your chain database instance (ssdb server)
cp -r aelf-testnet-mainchain-chaindb-*/* /path/to/install/chaindb/ssdb/var/
start your chain database instance
ssdb-cli info -
Restore State Database:
tar xvzf aelf-testnet-mainchain-statedb-*.tar.gz
stop your state database instance (ssdb server)
cp -r aelf-testnet-mainchain-statedb-*/* /path/to/install/statedb/ssdb/var/
start your state database instance
ssdb-cli info
Node Configuration
Generate Node Account
-
Install aelf-command:
npm i -g aelf-command
-
Create Account:
aelf-command create
Follow the prompts and save the account info.
Prepare Node Configuration
-
Download Settings Template and Docker Script:
cd /tmp/
wget https://github.com/aelfProject/aelf/releases/download/v1.0.0-rc1/aelf-testnet-mainchain.zip
unzip aelf-testnet-mainchain.zip
mv aelf-testnet-mainchain /opt/aelf-node -
Update appsettings.json:
{
"Account": {
"NodeAccount": "your-node-account",
"NodeAccountPassword": "your-password"
},
"ConnectionStrings": {
"BlockchainDb": "redis://chain-db-server:port",
"StateDb": "redis://state-db-server:port"
},
"Network": {
"BootNodes": [
"node-ip:6800"
],
"ListeningPort": 6800
},
"CrossChain": {
"Grpc": {
"LocalServerPort": 5000
}
}
}
Running a Full Node
With Docker
-
Run Node:
docker pull aelf/node:testnet-v1.6.0
cd /opt/aelf-node
sh aelf-node.sh start aelf/node:testnet-v1.6.0 -
Stop Node:
sh aelf-node.sh stop
With Binary Release
-
Install .NET Core SDK 6.0.
-
Download and Run Node:
cd /tmp/
wget https://github.com/aelfProject/aelf/releases/download/v1.0.0-rc1/aelf.zip
unzip aelf.zip
mv aelf /opt/aelf-node/
cd /opt/aelf-node
dotnet aelf/aelf.Launcher.dll
Check the Node
To check the node, query its current block height:
aelf-command get-blk-height -e http://your-node-ip:port
Running Side-Chains
-
Download and Restore Snapshot Data.
-
Run Side-Chain Node:
cd /tmp/
wget https://github.com/aelfProject/aelf/releases/download/v1.0.0-rc1/aelf-testnet-sidechain1.zip
unzip aelf-testnet-sidechain1.zip
mv aelf-testnet-sidechain1 /opt/aelf-node -
Update appsettings.SideChain.TestNet.json with your node information:
{
"CrossChain": {
"Grpc": {
"ParentChainServerPort": 5000,
"ParentChainServerIp": "mainchain-ip",
"ListeningPort": 5001
},
"ParentChainId": "aelf"
},
"Network": {
"BootNodes": [
"sidechain-bootnode-ip:6800"
],
"ListeningPort": 6800
}
}
Note
Each side chain has its own P2P network, add the mainnet dAppChain nodes as peer:
```sh
bootnode → ["xxx.xxxx.xxx.xxx:6800", "..."]
```
```json
{
"Network": {
"BootNodes": [
"Add the right boot node according to sidechain"
],
"ListeningPort": 6800
}
}
```