Verto Trading Post

Verto is a decentralized token exchange protocol built on Arweave powered by a network of trading posts. The following documentation contains the information necessary to start up a trading post of your own.

Prerequisites

Before initializing your trading post, ensure that you have VRT staked in your wallet. Without staked VRT, users will be unable to discover your trading post on the exchange.

Configuration

Before deploying a trading post, you'll want to properly configure the system. You'll also need to drag & drop your keyfile to the root of your trading post and make sure the name of the file is arweave.json.

verto.config.json

The verto.config.json file is where the majority of your configuration will lie. You'll need to create this file before you can run a trading post. As seen in the config.example.json file, it must contain the following information:

{
  "genesis": {
    "blockedTokens": [],
    "chain": { "ETH": "0x70dd63799560097E7807Ea94BA0CE5A85C1feAD8" },
    "tradeFee": 0.01,
    "publicURL": "your-trading-post-domain.com",
    "version": "0.2.0"
  },
  "database": "./path/to/a/verto.db",
  "api": {
    "port": 8080,
    "host": "localhost"
  }
}
  • blockedTokens: This is the place for you to add all of the tokens you don't want your trading post to accept and exchange. By default, any PST is supported for trading.
  • chain: The object that contains the wallet addresses for accepting other currencies. Right now, Verto supports and requires trading with Ethereum, so your Ethereum address should go here.
  • tradeFee: This is the fee that your trading post will take when an exchange is made. You get to choose your own fee, but know that others may try to compete with lower fees!
  • publicURL: You'll need to add the publically available domain/IP that the trading post API will be accessible from in this variable. To ensure the uptime of a trading post, each trading post hosts its own API for the frontend to ping whenever a trade is initiated.
  • version: The current trading post version.
  • database: This field is where your database will be created.
  • api: If you want to modify the host and port of the API, you can do it in these variables.

You can easily change this configuration by updating verto.config.json and restarting your trading post!

Install pre-built binaries

The trading post is distributed as standalone binaries for your operating system. Install these binaries via our installers -

Linux

curl -fsSL https://verto.exchange/i/linux | sh

MacOS

curl -fsSL https://verto.exchange/i/mac | sh

Windows

iwr https://verto.exchange/i/windows | iex

It will download releases and unzip artifacts. You can add the binary to your PATH env variable by following the instructions after installation.

Configuration

Before deploying a trading post, you'll want to properly configure the system. You'll also need to drag & drop your keyfile to the root of your trading post and make sure the name of the file is arweave.json.

verto.config.json

The verto.config.json file is where the majority of your configuration will lie. You'll need to create this file before you can run a trading post. As seen in the config.example.json file, it must contain the following information:

{
  "genesis": {
    "blockedTokens": [],
    "chain": { "ETH": "0x70dd63799560097E7807Ea94BA0CE5A85C1feAD8" },
    "tradeFee": 0.01,
    "publicURL": "your-trading-post-domain.com",
    "version": "0.2.0"
  },
  "database": "./path/to/a/verto.db",
  "api": {
    "port": 8080,
    "host": "localhost"
  }
}
  • blockedTokens: This is the place for you to add all of the tokens you don't want your trading post to accept and exchange. By default, any PST is supported for trading.
  • chain: The object that contains the wallet addresses for accepting other currencies. Right now, Verto supports and requires trading with Ethereum, so your Ethereum address should go here.
  • tradeFee: This is the fee that your trading post will take when an exchange is made. You get to choose your own fee, but know that others may try to compete with lower fees!
  • publicURL: You'll need to add the publically available domain/IP that the trading post API will be accessible from in this variable. To ensure the uptime of a trading post, each trading post hosts its own API for the frontend to ping whenever a trade is initiated.
  • version: The current trading post version.
  • database: This field is where your database will be created.
  • api: If you want to modify the host and port of the API, you can do it in these variables.

You can easily change this configuration by updating verto.config.json and restarting your trading post!

Start a trading post

Starting your trading post is as simple as:

verto

If you want to start without having copying your keyfile to the project root, you can run with:

verto -k keyfile.json

Congratulations! You've successfully started a verto trading post! 🦔

You can also set up a reverse proxy with nginx for hosting your API.

Build from source

It is recommended to use pre-built production binaries when running a trading post.

In order to build a trading post from source, make sure you have git and node installed on your machine.

Clone the repo and make it your working directory

git clone https://github.com/useverto/trading-post
cd trading-post

Using your favourite package manager, download the required dependencies

yarn

Now, it's time to build the trading post! It is as simple as:

yarn prod

Awesome! You've successfully built the trading post! It is now avaliable at ./dist/verto.js

Make sure to create a verto.config.json for your trading post. See Configuration for more information.

and finally start the trading post! 🙂

node ./dist/verto.js --key-file /path/to/your/keyfile.json

Now, you can sit back and relax while the trading post greets you with some colourful logs.

Build from source

It is recommended to use pre-built production binaries when running a trading post.

In order to build a trading post from source, make sure you have git and node installed on your machine.

Clone the repo and make it your working directory

git clone https://github.com/useverto/trading-post
cd trading-post

Using your favourite package manager, download the required dependencies

yarn

Now, it's time to build the trading post! It is as simple as:

yarn prod

Awesome! You've successfully built the trading post! It is now avaliable at ./dist/verto.js

Make sure to create a verto.config.json for your trading post. See Configuration for more information.

and finally start the trading post! 🙂

node ./dist/verto.js --key-file /path/to/your/keyfile.json

Now, you can sit back and relax while the trading post greets you with some colourful logs.

While hosting a trading post, you might need to set up a reverse proxy.

Nginx

You can find the official docs for setting up a reverse proxy at https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

Install nginx on a Ubuntu server

sudo apt-get update
sudo apt-get install nginx

You can confirm your nginx installation using nginx -v

Adding your domain

First, create a Nginx virtual host configuration using the follwing command:

sudo touch /etc/nginx/sites-available/YOUR-DOMAIN

Be sure to replace YOUR-DOMAIN with the domain you plan to associate with the trading post.

Create nginx configuration

Next, we setup our nginx configuration by editing the file that we just created.

sudo nano /etc/nginx/sites-available/YOUR-DOMAIN

You can either use vim or nano as your text editor

You can now paste the following configuration:

server {
  listen 80;
  listen [::]:80;
  server_name YOUR-DOMAIN;

  location ^~ /.well-known/acme-challenge {
    default_type text/plain;
    root /path/to/letsencrypt/challenge;
  }

  location / {
    return 301 https://$host$request_uri;
  }
}
server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name YOUR-DOMAIN;

  ssl_certificate /path/to/cert.pem;
  ssl_certificate_key /path/to/key.pem;
  ssl_trusted_certificate /path/to/ca.pem;
  ssl_dhparam /path/to/dhparams.pem;

  ssl_protocols TLSv1.2 TLSv1.3;
  ssl_ciphers 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
  ssl_ecdh_curve prime256v1:secp384r1;
  ssl_prefer_server_ciphers on;

  add_header Strict-Transport-Security "max-age=63072000; preload;" always;

  ssl_stapling on;
  ssl_stapling_verify on;

  resolver 1.1.1.1;

  ssl_session_timeout 24h;
  ssl_session_cache shared:SSL:50m;
  ssl_session_tickets off;

  access_log /var/log/nginx/access.log;

  location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_pass http://localhost:8080;
    # change this to the port where the trading post is running
    proxy_read_timeout 90;
  }
}

SSL is compulsory otherwise CORS for the trading post API will be blocked. You can easily generate SSL certificates using Let's Encrypt and specify the certificate file and key in the above configuration

Be sure to replace YOUR-DOMAIN with your actual domain and make sure your trading post is running at port 8080.

Save the file and proceed to the final step.

Start nginx

Before starting nginx, we will need to link the file in the sites-available folder to a location within the sites-enabled folder.

Again, change YOUR-DOMAIN here with the actual name of the file you created earlier.

ln -s /etc/nginx/sites-avaialable/YOUR-DOMAIN /etc/nginx/sites-enabled/YOUR-DOMAIN.conf

Let’s now test the configuration file.

sudo nginx -t

If the test is successful, you’ll see this output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Now that we know it’s going to work as expected, issue the command to restart the Nginx service

sudo systemctl restart nginx

# OR #

sudo service nginx restart

Both commands perform the same task, simply preference decides your method here.

Congratulations! You should now be able to launch your trading post (if it wasn’t running already) and visit YOUR-DOMAIN in a browser, assuming the DNS is correct. :smile: