EDIT: Now that Nano’s (previously RaiBlocks) transaction volume has increased, a t2.micro instance will likely drift out of sync over time. See this response.
RaiBlocks is a cryptocurrency that has exploded in popularity over the past month and a half. If you’ve invested in it and/or want to help improve the decentralization and redundancy of the network, I’d highly recommend running your own representative node.
Representative nodes are always online servers that store a copy of the transactions ledger and can serve this data to other nodes. They also improve the security of the network by voting in cases where a malicious user attempts to double spend their funds. A representative node’s voting power is based on the amount of RaiBlocks they represent (more XRB = more votes). Every RaiBlocks wallet must have a representative node and by default a wallet points to one of the official RaiBlocks nodes. Running your own node reduces the voting power of the official RaiBlocks nodes and helps decentralize the network.
Since running a representative node requires being online 24/7, you probably don’t want to run one on your PC. Fortunately, we can use Amazon Web Services’ free tier to provision a free server for the next 12 months. Here’s how:
Create an EC2 Instance
- Sign up for an Amazon Web Services account.
- Navigate to the console homepage and go to Services > EC2 > Launch Instance.
- Select Ubuntu Server 16.04 LTS (HVM), SSD Volume Type and make sure the t2.micro instance type is selected. Then click “Configure Security Group” in the top bar.
- Set up the Security Group to match the screenshot below:
- Click “Review and Launch” then “Launch” to start your instance.
- You’ll be prompted to create a new key pair. Call it “aws” and download the file to your home folder. Keep it safe; you’ll need it to connect to your RaiBlocks node!
- Navigate to Services > EC2 > Running Instances. Then click on Actions > Connect.
- Copy down your EC2 instance’s Public DNS address. It should look something like: ec2–11–222–33–44.us-east-2.compute.amazonaws.com
[Optional] Bootstrap Your Node’s Database
Bootstrapping your node’s database with a snapshot will allow you to skip most of the syncing. This part of guide is Mac/Linux only.
- Download the latest database snapshot named RaiBlocks_64_YYYY_MM_DD_HH.7z here. Move it to your home directory.
- Run the following in Terminal to upload the snapshot to your server. Replace the arguments in square brackets with the necessary info. Also, note the colon after your EC2 Public DNS address:
chmod 400 aws.pem
mv [database file name] rai_db.7z
scp -i aws.pem rai_db.7z ubuntu@[your ec2 address]:
Set Up Your RaiBlocks Node
- If you’re on Mac/Linux, open up Terminal and run the following commands to connect to your EC2 instance (replace with your own EC2 address):
chmod 400 aws.pem
ssh -i aws.pem ubuntu@[your ec2 address]
- If you’re on Windows, download Putty to SSH into your EC2 instance.
- Once you’re connected to your EC2 instance, run the following commands (credits to Ben Green for the original script):
mv iGGSJk install_rai_node.sh
chmod +x install_rai_node.sh
- Finally, run this to create and print out your representative’s address:
./rai_node --account_create --wallet=$(./rai_node --wallet_create)
Done and done! You now have a RaiBlocks node running for free for the next 12 months. To test that it’s working you can run
./rai_node --debug_block_count. It should increase on subsequent runs as your node downloads more blocks. Also, the RaiBlocks service will automatically restart if you restart your EC2 instance.