Skip to content

User Manual

Yuanjun edited this page Nov 1, 2019 · 10 revisions

AionR KERNEL

System Requirements:

  • Ubuntu 16.04 or 18.04

Dependent Libraries:

  • JDK 11 or higher 🆕
    • jdk-11.0.1.tar.zip Running environment JRE version must be equal to or higher than the building environment JDK. Building and Running with JDK 11 is recommended
  • g++, gcc
  • libboost-all-dev: version 1.65.0
  • libzmq3-dev
  • libjsoncpp-dev
  • python-dev
  • libudev-dev
  • llvm-4.0-dev

For Ubuntu 18.04

Install dependencies:

sudo apt update
sudo apt install g++ gcc libzmq3-dev libjsoncpp-dev python-dev libudev-dev libboost-all-dev llvm-4.0-dev 

For Ubuntu 16.04

Install dependencies:

sudo apt update
sudo apt install g++ gcc libzmq3-dev libjsoncpp-dev python-dev libudev-dev llvm-4.0-dev

# Ubuntu 16.04 repository only have libboost-1.58 while AionR Kernel requires libboost-1.65
# To build the correct version libboost in the system, run the following command:
sudo apt install wget lbzip2 cmake

# Get the source code libboost 1.65.1
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2
tar xf boost_1_65_1.tar.bz2
cd boost_1_65_1

# Configure the library destination folder and install libboost 1.65.1
./bootstrap.sh --libdir=/usr/lib/x86_64-linux-gnu/
./b2
sudo ./b2 install

Environment Variables Setup:new:

AionR kernel requires JAVA_HOME, LIBRARY_PATH, LD_LIBRARY_PATH environment paths.

export JAVA_HOME=<JAVA_DIRECTORY>
export LIBRARY_PATH=$JAVA_HOME/lib/server
export LD_LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
export PATH=$PATH:$JAVA_HOME/bin

Kernel

Or

  • To build the Kernel from source code, please checkout Build Rust Kernel for details.

Configures

Data Location

The release packages come with the configure toml files and genesis files for Mainnet, Mastery, Amity and other custom networks. If Rust Kernel first starts without any option, it will generate a hidden BASE directory $HOME/.aion and the default configuration file config.toml connecting to Mainnet. The .aion BASE contains with

  • cache - the cache data of Rust Kernel
  • chains - the database of each chain
  • keys - the accounts of each chain

To relocate the base directory, edit config.toml:

  [aion]
  base_path = "new/location/path"

Peer Connection

The default config will auto assign a peer ID on the first boot and will continue to use that ID afterward. If you want to generate a custom ID, you can manually enter a valid peer ID into the config file. Peer ID can be changed at any point.

Edit config.toml to meet your needs:

  [network]
# if local_node = "p2p://00000000-0000-0000-0000-000000000000@0.0.0.0:30303"
# kernel will generate a random peer ID. If you can change it to a valid peer ID at any time.
# - IP: the public IP address
# - PORT: the port where other nodes listen on
  local_node = "p2p://PeerID@IP:PORT"

# boot_nodes are the peer node list. 
# Each node will be present in a string "p2p://NodeID@IP:PORT"
  boot_nodes = []

Notes: If you just want to start a single node without connecting any other node, leave boot_nodes field to an empty array.

JSON RPC Configuration

AionR supports JSON RPC via HTTP, WebSocket, and IPC.

  [http]           # HTTP JSON RPC configures
  disable = false # Disable HTTP JSON RPC option
  port = 8545     # default port
  apis = ["all"]  # possible values: all, safe, web3, eth, stratum, net, personal, rpc

  [websockets]    # websocket JSON RPC configures
  disable = false # Disable websocket option
  port = 8546     # default port
  apis = ["all"]  # possible values: all, safe, web3, eth, stratum, net, personal, rpc, pubsub

  [ipc]           # ipc JSON RPC configures
  disable =false  # Disable IPC option
  path = "$BASE/jsonrpc.ipc" # default ipc file 
  apis = ["all"]  # possible values: all, safe, web3, eth, stratum, net, personal, rpc, pubsub

To find the complete configuration options, see AionR Configuration.

Accounts:

AionR Kernel allows users to do simple accounts managements through CLI. Go the Kernel binary directory. If you build the Kernel from the source code, please direct to aionr/package/<User_Defined_Package_Name>.

To manage a specific network or a specific chain, use --config or --chain options in commands; otherwise, the Kernel will perform the operations on Mainnet by default. To launch AionR in a specific network easily, we provide quick run script mainnet.sh, mastery.sh, amity.sh and custom.sh. You can use them instead of aion to manage your accounts for each network. If you want to directly interact with the binary aion, make sure to add local libraries into environment variables first. 🆕

export AIONR_HOME=.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AIONR_HOME/libs

Otherwise, the quick run scripts will automatically setup the environment variables.

  1. create an account from CLI
# In aionr package folder, if you want to start with the binary, set up local libraries
export AIONR_HOME=.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AIONR_HOME/libs
# run the binary.
./aion [options] account new


# Or using quick run script example to create a new account in Mastery network
./mastery.sh account new
  1. import accounts from existing aion keystore files
# In aionr package folder, enter
export AIONR_HOME=.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AIONR_HOME/libs
./aion [options] account import <path/to/keystore/files>

# quick run script example to import account in Mainnet network
./mainnet.sh account new
  1. import account from private keys
# In aionr package folder, enter
export AIONR_HOME=.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AIONR_HOME/libs
./aion [options] account import-by-key <private key>

# quick run script example to import account from a private key into the custom network
./custom.sh account import-by-key <private key>

For more accounts importing examples, check Importing Accounts wiki page.

Launch AionR Kernel

The binary package contains:

<package directory>/
  ├── aion                      # the executable binary

  ├── custom                    # custom(solo) network setting directory
  │   ├── custom.json           # custom(solo) network genesis block file
  │   └── custom.toml           # custom(solo) network configuration
  ├── custom.sh                 # custom(solo) network quick launch script

  ├── mainnet                   # mainnet network setting directory
  │   ├── mainnet.json          # mainnet network genesis block file
  │   └── mainnet.toml          # mainnet network configuration
  ├── mainnet.sh                # mainnet network quick launch script

  ├── mastery                   # mastery network setting directory
  │   ├── mastery.json          # mastery network genesis block file
  │   └── mastery.toml          # mastery network configuration
  ├── mastery.sh                # mastery network quick launch script

  ├── amity                     # amity network setting directory
  │   ├── amity.json            # amity network genesis block file
  │   └── amity.toml            # amity network configuration
  ├── amity.sh                  # amity network quick launch script
  
  └── libs                      # dependencies

If you want to directly launch the kernel with the binary aion, make sure to add local libraries into environment variables first. 🆕

export AIONR_HOME=.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AIONR_HOME/libs

In package directory, to run:

./aion [options]

Launch AionR Kernel with a Specific Network

The configuration file defines a network id, its boot node, and its chain(genesis block file):

[aion]
chain = "path/to/genesis.json"  # If "chain" is undefined, Kernel uses the default (mainnet) genesis file instead.

[network]
net_id = 32
boot_nodes = [] # list of node_id

Switching a configuration file changes the connecting network.

  • To launch AionR Kernel for Mainnet:

    • ./aion launches with default settings and will create config.toml in $BASE($HOME/.aion) directory if no config.toml exists.
    • OR use the quick run script: ./mainnet.sh (The quick-run script has added local libraries into environment variables)
    • OR use --config option and the configuration file in the package: ./aion --config=mainnet/mainnet.toml
  • To launch AionR Kernel for Mastery:

    • Use the quick run script: ./mastery.sh (The quick-run script has added local libraries into environment variables)
    • OR use --config option and the configuration file in the package: ./aion --config=mastery/mastery.toml
  • To launch AionR Kernel for Amity:

    • Use the quick run script: ./amity.sh (The quick-run script has added local libraries into environment variables)
    • OR use --config option and the configuration file in the package: ./aion --config=amity/amity.toml
  • To launch AionR Kernel for a customed network:

    • Use the quick run script: ./custom.sh (The quick-run script has added local libraries into environment variables)
    • OR use --config option and the configuration file in the package: ./aion --config=custom/custom.toml

Launch AionR Kernel with a Specific Chain

A chain file defines the genesis block of each chain. It also defines the data directory name:

"dataDir": "yourDirName"

After you launch Kernel with the chain file, Kernel will create new data directories with the given name under the $BASE/chains and $BASE/keys:

.aion
├── cache
│   └── yourDirName
├── chains
│   └── yourDirName
└── keys
    └── yourDirName

To switch a chain on Kernel Launching:

./aion [--config=path/to/a/config.toml] --chain=path/to/new/chain.json

--chain option overwrites the chain field in config.toml. Notes: --config, --chain and chain field in the configuration file take the absolute path and the relative path from the directory you launching the Kernel.

To check all options of Rust Kernel, run ./aion -h, or visit AionR Command Line Interface. The quick run scripts of each network also support CLIs.

Notes:Command line options will overwrite the fields in the configuration.

More Examples:Kernel Deployment Examples

Mining

Unlike Java Kernel, AionR Kernel do not have an internal miner. In order to allow miners/mining pool connections, AionR Kernel requests an author by launching Kernel with --author=<an aion account where the rewards go>, Or add author under cofiguration mining section:

[mining]
author = "an aion account where the rewards go"

AionR Kernel only reseals the local transactions by default. To seal the transactions from other nodes, edit configuration:

[mining]
reseal_on_txs = "all"   #reseal all the transactions from both the local node and the external nodes
# OR
reseal_on_txs = "ext"   #reseal only the transactions from the external nodes

check all reseal_on_txs options in CMD-&-Config.

Miner for AionR Kernel

External Miner for AionR Kernel can be downloaded on Release page. This miner is recommended for testing purpose.

Rust compatible Miner launch options:

# AionR Reference Miner
Options:
  -h [ --help ]                   Print help messages
  -l [ --location ] arg           Stratum server:port
  -u [ --username ] arg           Username (Aion Addess)
  -a [ --apiPort ] arg            Local port (default 0 = do not bind)
  -d [ --level ] arg              Debug print level (0 = print all, 5 = fatal 
                                  only, default: 2)
  -b [ --benchmark ] [=arg(=200)] Run in benchmark mode (default: 200 
                                  iterations)
  -t [ --threads ] arg            Number of CPU threads
  -e [ --ext ] arg                Force CPU ext (0 = SSE2, 1 = AVX, 2 = AVX2)
  --ci                            Show CUDA info
  --cv arg                        CUDA solver (0 = djeZo, 1 = tromp, default=1)
  --cd arg                        Enable mining on spec. devices
  --cb arg                        Number of blocks (per device)
  --ct arg                        Number of threads per block (per device)
# example of aionminer connecting to local Kernel using 1 thread:
./aionminer -l 127.0.0.1:8008 -t 1

Mining Pool

Launching Kernel with stratum module enabled can allow mining pool to connect to the Kernel. Open config.toml file and make sure stratum or all is included in rpc apis, like this:

[rpc]
apis = ["stratum"]  
# Or apis = ["all"]

Checkout our Aion doc pages to see the mining pools we supports.

Use AionR

JSON RPC APIs

AionR Kernel supports eth_, web3_, net_,and personal_ APIs in Aion Kernel(Java). Besides these, Rust Kernel also supports pub_sub methods through websocket and ipc.

Web3

AionR is compatible with Aion Web3.

External Sources

Clone this wiki locally