Install

The Rust implementation of the Aion kernel. You can interact with this kernel directly through the JSON RPC layer. Further documentation regarding the kernel can be found on the Aion Rust Kernel GitHub repository at https://github.com/aionnetwork/aionr

You can install the kernel by using:

Native Ubuntu Install

Follow these steps to install an Aion Rust node as a native Ubuntu application.

Prerequisites

Your node must have the following specifications.

Follow these steps to install all the necessary prerequisites.

  1. Update your system and install the build dependencies:
sudo apt-get update
sudo apt install g++ gcc libjsoncpp-dev python-dev libudev-dev llvm-4.0-dev cmake wget curl git pkg-config lsb-release -y
  1. Install Rust v1.28.0:
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.28.0 --default-host x86_64-unknown-linux-gnu

Select option 1 when prompted.

  1. Initialize the Rust install and check that it is working:
source $HOME/.cargo/env
cargo --version

> cargo 1.28.0 (96a2c7d16 2018-07-13)
  1. Install Boost v1.65.1
# Ubuntu 16.04:
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2
tar xvf boost_1_65_1.tar.bz2
cd boost_1_65_1
./bootstrap.sh --libdir=/usr/lib/x86_64-linux-gnu/
./b2
./b2 install

# OR

# Ubuntu 18.04
sudo apt-get install libboost-all-dev -y
  1. Install Java JDK 11:
sudo apt install openjdk-11-jdk
  1. Install Apache Ant:
sudo apt install ant -y
  1. Set Environment Variables:
export JAVA_HOME=<jdk_directory_location>
export ANT_HOME=<apache_ant_directory>
export LIBRARY_PATH=$JAVA_HOME/lib/server
export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin
export LD_LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib

Get the Rust Build

  1. Download the latest Aion Rust kernel package to your computer if you haven't already. You can also use wget if you'd prefer:
wget https://github.com/aionnetwork/aionr/releases/download/v1.0/oanr-v1.0.0.706f7dc-2019-11-05.tar.gz

📘

Build from Source

If you want to build the Rust kernel from source, make sure you follow the steps here.

  1. If you are going to be connecting to your node over SSH, you need to copy this package to the node using SCP:
scp ~/Downloads/PACKAGE_NAME USER@NODE_IP_ADDRESS:~/

For example:

scp ~/Downloads/oanr-v1.0.0.706f7dc-2019-11-05 [email protected]:~/
  1. Unzip the package:
cd ~/
tar xvf PACKAGE_NAME

Start the Rust Node

  1. Navigate to where you just unzipped the package.
cd UNZIPPED_FOLDER_NAME

  1. Launch the Rust kernel with a specific network:

a. Mainnet

./mainnet.sh

b. Amity Testnet

 ./amity.sh
3. Make sure your network is fully synced! Your kernel will stop syncing once you are fully synced and your block number should be the same one as your peers' block number.

### Configuration

#### RPC

Check if the RPC connection is open to enable getting the transactions later!

```bash
cat amity/amity.toml

...

> [http]
> disable = false
> port = 8545

...

Docker Image

This section covers how to configure and run the Aion Rust kernel Docker container.

Quickstart

Follow these steps to get started quickly for Mainnet networktwit, or skip this section if you want to learn how to run the container in more detail.

# Pull the kernel image.
docker pull aionnetwork/aionr:latest


# Create some local storage for the container:
$ docker volume create aionr-mainnet

# Run the container:
$ docker run -it -p 8545:8545 -p 8546:8546 -p 30303:30303 --mount source=aionr-mainnet,destination=/aionr/mainnet aionnetwork/aionr ./mainnet.sh

Rust Prerequisites

To use this Docker image your system must meet the following requirements:

  • 8GB RAM (16GB recommended)
  • 2 CPU cores
  • 1GB HDD space
  • Docker v18.0.0

The HDD space required only takes the Docker image into account. You will need a significant amount of space for storing the blockchain itself. The database is currently around 22GB in size.

Installation

  1. Pull down the latest Docker image.
docker pull aionnetwork/aionr:latest

> latest: Pulling from aionnetwork/aionr
> f476d66f5408: Pull complete
> ...
> Status: Downloaded newer image for aionnetwork/aionr:latest
  1. Create local storage for Aion image.
docker volume create aionr-mainnet

> aionr-mainnet
  1. Run the image.
docker run -it -p 8545:8545 -p 8546:8546 -p 30303:30303 --mount source=aionr-mainnet,destination=/aionr/mainnet aionnetwork/aionr:latest

>             _____    ____    _   _
>     /\     |_   _|  / __ \  | \ | |
>    /  \      | |   | |  | | |  \| |
>   / /\ \     | |   | |  | | | . ` |
>  / ____ \   _| |_  | |__| | | |\  |
> /_/    \_\ |_____|  \____/  |_| \_|
>
>
>2019-07-12 17:14:11 Starting Aion(R)/v0.2.5.a60ae38/x86_64-linux-gnu/rustc-1.28.0
  1. Press CTRL + c to shut down and exit the container.

Arguments and Configuration

There are several arguments that you can supply with the docker run command.

Configure the Rust Kernel

Once the kernel Docker image is pulled you can configure it by running the docker exec command in a separate terminal window:

docker exec -it <CONTAINER_NAME or CONTAINER_ID> /bin/bash

A list of CONTAINER_IDs and CONTAINER_NAMEs can be found by using the command: $ docker container list

This starts a standard terminal session within the container. You will need to install a text editor before you can edit any files, as the container doesn’t come with one pre-installed:

apt install nano

OR

apt install vim

The configuration file locations will be printed upon starting the node:

2019-07-12 17:41:08 Config path /aionr/mainnet/mainnet.toml
2019-07-12 17:41:08 Genesis spec path /aionr/mainnet/mainnet.json
2019-07-12 17:41:08 Keys path /root/.aion/keys/mainnet
2019-07-12 17:41:08 DB path /root/.aion/chains/mainnet/db/a98e36807c1b0211

Then you can edit the .toml file associated with the network you are running. For example, if you are running the Rust kernel on Mainnet, then you should edit the mainnet/mainnet.toml file. If you are running the Rust kernel on the Testnet (amity), then you should edit the amity/amity.toml file.

nano mainnet/mainnet.toml

Rust Networks

By default, running the image will start a node on the mainnet. To specify a network; for instance, the amity testnet, use:

docker run -it aionnetwork/aionr:latest /aionr/amity.sh

Rust Ports

The Aion Docker image is configured to run the Rust WebSocket and RPC servers, as well as allow connections from other Aion nodes. When running the Docker container, it is necessary to publish those ports if you use to wish these functionalities.

PortConnection Type
30303P2P
8545JSON-RPC
8546WebSocket

Rust Storage

In most cases, storage should be attached so that configuration and blockchain sync state can be persisted between each time the kernel is launched. You will need a separate Docker volume for each Aion Network, so it is recommended to include the network name in the volume name. To create a volume:

docker volume create <VOLUME_NAME>

To start the Docker image with the volume, where <VOLUME-NAME> is the volume name and <NETWORK> is the Aion network name (mainnet, amity, custom, etc.):

docker run -it --mount source=<VOLUME-NAME>,destination=/aionr/<NETWORK> aionnetwork/aionr:latest ./<Network>.sh

That’s it, you’re done! See the aionr repository and Kernel wiki pages on GitHub for more on installation and configuration.