How to run a Ripple Validator @ DigitalOcean

So you want to contribute to the Ripple XRP Ledger & decentralization. You want to run a validator. If you have your own Docker host somewhere, just pull the image.

If you don’t have a server and you want to spin up one at DigitalOcean for $20 a month, just follow the next steps. You’ll be validating in 10 minutes!

1. Create an account at DigitalOcean

DigitalOcean is a cloud (server) provider with datacenters all over the world. They made deploying high performance servers easy and cheap. If you want to register and help me out, use this referral link to register. If you don’t want to help me out (I’m not in it for the money), just visit digitalocean.com and click “Sign Up”.

2. Create a new server (“Droplet”)

You are going to spin up a new server. To run the validator we are going to use a preconfigured Docker container with `rippled`, the server software from Ripple, and some scripts that will generate the initial configuration for you.

So. We’re going to create a “Droplet”.

DigitalOcean calls virtual servers “Droplets”, like drops in the digital ocean ;)

Select the tab “One-click apps” and click the “Docker XX.YY~ on …” app.

DigitalOcean offers servers with pre-installed packages and configuration. They call this “One-click apps”. These “apps” are pre-installed servers “droplets”. We use the Docker app, because Docker is the software we need to run the Docker container I prepared for you. By using a Docker container, you don’t have to type several commands to get your validator up and running: I did this for you and “packed” it all in a container.

Size and datacenter

For the validator to run the server should have at least 8GB memory. You can pick a “Standard Droplet” with 8GB memory.

Select a datacenter nearby. Now go all the way down, leave all the other options unchecked (except if you know what you are doing). The default hostname DigitalOcean created for you is just fine, but if you own a domain name and you might want to publish your validator in the Ripple Validator Registry one day, enter your hostname;

Now click the big green Create button :)

3. Login

Your server will be ready in about 20 seconds. You will receive a random password in your mailbox. We are going to login using SSH and send some commands. If you are on Linux or OSX, just open the terminal. If you are using Windows you can download Putty, a program to login using SSH.

You can connect using the IP address of your newly created server.

The IP address is displayed on the server (droplet) details page.

SSH will be running on the default port: 22. Your username is root and your password is in your mailbox. On Linux or OSX, enter this command in your terminal to connect:

ssh root@165.227.146.184 -p 22

If you are logging in for the first time, you will be asked to type yes and press enter to continue logging in.

Windows users can enter the IP in the Host Name (or IP address) field in Putty. Select Connection TypeSSH” and enter Port 22 (default). Now click “Open”.

Closed your connection? Lost your internet connection? You can use the command above to connect to your server any time.

3.1 Add Swap Space

You spinned up a server with 4GB of memory. This may be enough, but what if your validator gets busy and it (temporarily) isn’t? This is why we are going to add ‘swap’ to the server. We are allocating a piece of the harddrive as an overflow for memory.

First, we are going to create a 4GB swapfile, 4GB of the harddrive will be reserved as swap space. The second command (after ; will set the file permissions).

fallocate -l 4G /swapfile ; chmod 600 /swapfile

We tell the server to use the swapfile if necessary, and turn swap on:

mkswap /swapfile ; swapon /swapfile

To make your swap file permanent (after a reboot) we are going to issue our last swap-related command:

echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab

4. Create the container

So. You are now logged in to your new server. Maybe even your first server 🎉. Using SSH you can now execute commands on your remote server.

We are now actually going to create your validator! Enter this in the terminal:

docker run -dit --name rippledvalidator -p 51235:51235 -v /keystore/:/keystore/ xrptipbot/rippledvalidator

We are:

  • executing docker (the software to run containers)
  • telling docker to run a new container
  • telling docker to run -detached (keep the container running in the background) and it (after -d) ensures we can login to the container if we want to debug something in the future.
  • naming the container rippledvalidator— we will need this name if we want to stop the container in the future, if we want to check the logs, etc.
  • opening port 51235 and publishing the port to the internet (also at 51235). Port 51235 is the port used by other rippled servers
  • creating and attaching a folder on the server /keystore/ — and mounting the folder in the container, also in /keystore/. Files in this folder will be shared between your server and the docker container.
  • creating the container based on a prebuilt image: xrptipbot/rippledvalidator. This is the package I created so you can spin up a validator in a few seconds.

Docker will download the container image and start your validator 🍻

You don’t have to enter this command again, your container wil persist if you logout and login again to your server.

5. Show me the candy

Ok. You have a validator running. You are validating transactions on the XRP ledger. That’s awesome! Can you feel it!?

Well. Probably not. Not yet. You can’t see what’s happening. Or can you? Enter this command on the terminal:

docker logs -f rippledvalidator

Now you can see what your validator is doing. Live. Awesome, right? Your validator is starting, connecting to other validators, receiving transactions, validating them, etc.

Press Control C to cancel.

During the first startup, your validator generated his own “identity”. A public and private key to identify itself and sign messages. You can check the public identity of your own server:

cat /keystore/validator-keys.json

The contents of the validator-keys.json file will be printed in the terminal. There’s a line with your "public_key" (never share your secret_key!). The key starts with a lowercase n. You can copy this key, and go to the Ripple Validator Registry: ~15 minutes after your validator launched, your key will be visible. Congratulations, you are now a contributor to the XRP ecosystem!

6. And now…

Lots of options! Like:

  • Improve security and performance (firewall, clustering, etc.)
  • Team up with other validators, adding each other to your lists with trusted validators
  • Get yourself a domain name and verify your domain (so it will show in the Validator Registry)

… But we will save this for another day.

Thanks for reading!