Table of Contents
Avalon install procedure for debian 10
1. Make sure debian is up-to-date and download git and a few other packages from the debian repos.
sudo apt-get -y update && sudo apt-get -y upgrade && \
sudo apt-get install git wget tmux htop jq unzip curl -y && \
git clone https://github.com/dtube/avalon.git && \
cd avalon
2. Install NodeJS + NPM
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt-get -y install nodejs npm
node -v
3. Check node version with node -v. Avalon runs with node v14 and v16 only. If needed, install NVM and install and use other node versions:
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.profile
nvm install v16
nvm use v16
4. Now install MongoDB:
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
5. Enable and start MongoDB deamon:
sudo systemctl enable mongod
sudo systemctl start mongod
6. And install NPM modules that Avalon uses.
npm install
Sync your Avalon node
First, we need to download the genesis block (block #0) and save it as ./genesis/genesis.zip:
mkdir genesis
cd genesis
wget https://backup.d.tube/genesis.zip
cd ..
You will need to add some default peers to use to connect to the network. Near the bottom of the scripts/start.sh script:
export PEERS=ws://34.65.228.228:6001,ws://dseed.techcoderx.com:6001
export MAX_PEERS=50
You would also need to specify the path to the folder containing blocks.bson file in BLOCKS_DIR, which is a read and append only file that stores all blocks.
export BLOCKS_DIR=/var/blocks
You can wipe the mongodb database (assuming you are using the default avalon db name).
mongo avalon --eval "db.dropDatabase()"
Replay the blocks and transactions
This is the fastest method that reverifies locally all the past blocks and transactions, and therefore the current blockchain state. You will need to download the blocks.bson file into the folder specified in BLOCKS_DIR env var.
wget -P /var/blocks -c https://backup.d.tube/blocks.bson
REBUILD_STATE=1 ./scripts/start.sh
A file named blocks.index will be constructed (if not already exists) which stores the pointers to each block in blocks.bson. This may take a few minutes.
Start the node
./scripts/start.sh
Enabling your node for block production
If you want to start producing blocks on avalon, your account will need to define a leader key. Generate one into a file with
node src/cli key > leader-key.json
Secondly, you will need to enter your username, public leader key, and private leader key at the bottom of the scripts/start.sh file, and restart your node.
Finally, you will need to associate your public leader key with your account by using the on-chain transaction.
node src/cli enable-node YOUR_LEADER_PUB_KEY -M YOUR_USERNAME -K YOUR_KEY
root@avalon:/home/avalon# node src/cli enable-node 279ebwnDEDbRMSTBHnFZtCvz3HbKnyN7UWBNLJBWWEU4K -M freemskeys84 -K ********
19012394