Skip to content

How to build an alphanet node quickly

Fred Yankowski edited this page May 19, 2018 · 8 revisions

Here is a procedure for building a Tezos alphanet node from scratch. It runs using docker and syncs quickly by starting with checkpoint of the chain data

Create new Linode 2048 instance at Fremont CA.

Linode is not essential, it's just what I know. We use a "2048" instance (2G RAM) because 1G is not enough; OOM errors. Select the Fremont location because they have block storage available (not needed here; future-proofing).

Configure with Debian 9 image. Set root password. Boot.

Ssh in, upgrade, and configure tezos user as usual. Reboot.

$ ssh root@173.255.xxx.xxx
$ apt-get update
$ apt-get upgrade -y

$ adduser tezos
$ adduser tezos sudo
$ /sbin/reboot

ssh in as tezos user.

Install docker-ce

See https://docs.docker.com/install/linux/docker-ce/debian/

$ sudo apt-get install \
 apt-transport-https \
 ca-certificates \
 curl \
 gnupg2 \
 software-properties-common

$ curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -

$ sudo apt-key fingerprint 0EBFCD88

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
   $(lsb_release -cs) \
   stable"

$sudo apt-get update

$sudo apt-get install docker-ce docker-compose

$sudo docker run hello-world

Allow tezos user to run docker

sudo groupadd docker

sudo usermod -aG docker tezos

Log out and ssh back in to get the docker group membership.

Test run docker as tezos user, and set up docker service to autostart.

docker run hello-world

sudo systemctl enable docker

Install alphanet script and run briefly

See http://doc.tzalpha.net/introduction/alphanet.html

wget https://raw.githubusercontent.com/tezos/tezos/alphanet/scripts/alphanet.sh
chmod a+x alphanet.sh

./alphanet.sh start

Wait for message saying "Waiting for the node to synchronize with the network...".

Hit ^C. Stop the node.

./alphanet.sh node stop

Note that we stopped just the node service above, leaving the container running so that we can copy in the data.

Download and install checkpoint copy of blockchain data

Get the blockchain data:

wget https://www.dropbox.com/s/crfx4guj3hsifji/alphanet-20180211T2048.zip

It's about 3.4GB. Expand it. (Note that you could also copy the context and store data directly from another node if you have such access.)

[Update, 2018-03-15: A newer copy of the alphanet data is available at https://www.dropbox.com/s/o0s620clu60tbt6/alphanet-20180315.zip. It is about 6GB.]

sudo apt-get install unzip
unzip alphanet-20180211T2048.zip

Remove stub chain data:

./alphanet.sh shell
cd /var/run/tezos/node
sudo rm -r context store
exit

Copy in the downloaded chain data:

docker cp store tezos-alphanet:/var/run/tezos/node
docker cp context tezos-alphanet:/var/run/tezos/node

Fix file ownership:

./alphanet.sh shell
cd /var/run/tezos/node
sudo chown -R tezos context store
exit

Try again with bootstrapped chain data:

./alphanet.sh restart

You should soon see messages like "Current head: BL7j9RXQwAa99J (2018-02-11T20:46:00Z)". The node will continue syncing to the current date from that point.

After copying the node data into the container you will probably want to remove it from the server.

rm -r alphanet-20180211T2048.zip context store