BIOS Boot Sequence

📘

Note

The steps here can be readily expanded for the networked case. Some assumptions are made here regarding how the parties involved will coordinate with each other. However, there are many ways that the community can choose to coordinate. The technical aspects of the process are objective; assumptions of how the coordination might occur are speculative. Several approaches have already been suggested by the community. You are encouraged to review the various approaches and get involved in the discussions as appropriate.

The BIOS Boot sequence undergoes two significant workflows:

1.Creating, configuring, and starting the genesis node
2.Transitioning from single genesis producer to multiple producers

1. Create, Configure and Start the Genesis Node

The information in this section walk you through the preparatory steps for the following:

  • Setting up your rsn environment
  • Starting your genesis arisen node
  • Setting up additional, interconnected arisen nodes with connectivity to the genesis node
    After performing these steps, you will have a fully functional rsn blockchain runn

Python Script

Alternatively, if you would like to automate these steps, you can use the bios-boot-tutorial.py python script that implements the preparatory steps. However, the script uses different and additional data values. See the file accounts.json for the producer names and the user account names that the script uses. If your goal is to build a fully functional ARISEN blockchain on your local machine by automation, you can run the bios-boot-tutorial.py script directly by following the README.md instructions.

If your goal is to go beyond and understand what the script is doing, you can follow this tutorial which will get you through the same steps explaining also along the way each step needed to go through.

1.1. Install the binaries

Pre-compiled ARISEN Binaries

For instructions to install the aos binaries, see the Install ARISEN pre-compiled binaries tutorial but do not start aos at this stage.

ARISEN.CDT Binaries

For instructions to install the ARISEN.CDT binaries, see the Install ARISEN.CDT binaries tutorial.

1.2. Create a development wallet

Create and configure your default wallet, followed by creating a public and private development keys. After the key-pair is created, import the public and private key in your wallet. For reference purposes, we will refer the public key as RSN_PUB_DEV_KEY and the private key as RSN_PRIV_DEV_KEY.

For instructions on creating a wallet and importing the keys, see the Create development wallet tutorial.

1.3. Create ~/biosboot/genesis directory

Create a new directory ~/biosboot/genesis to start the genesis node by executing aos with specific parameters that will create the blockchain database, the log file, and the configuration file inside the directory.

cd ~
mkdir biosboot
cd biosboot
mkdir genesis
cd genesis

1.4. Create a JSON file in ~/biosboot/ directory

1.1 Create an empty genesis.json file in the ~/biosboot/ directory and open it in your preferred text editor (demonstrated with nano editor here):

cd ~/biosboot
touch genesis.json
nano genesis.json

2.Copy the following JSON content to clipboard:

{
  "initial_timestamp": "2018-12-05T08:55:11.000",
  "initial_key": "RSN_PUB_DEV_KEY",
  "initial_configuration": {
    "max_block_net_usage": 1048576,
    "target_block_net_usage_pct": 1000,
    "max_transaction_net_usage": 524288,
    "base_per_transaction_net_usage": 12,
    "net_usage_leeway": 500,
    "context_free_discount_net_usage_num": 20,
    "context_free_discount_net_usage_den": 100,
    "max_block_cpu_usage": 100000,
    "target_block_cpu_usage_pct": 500,
    "max_transaction_cpu_usage": 50000,
    "min_transaction_cpu_usage": 100,
    "max_transaction_lifetime": 3600,
    "deferred_trx_expiration_window": 600,
    "max_transaction_delay": 3888000,
    "max_inline_action_size": 4096,
    "max_inline_action_depth": 4,
    "max_authority_depth": 6
  },
  "initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000"
}

3.Paste the JSON content into the genesis.json file. Replace the RSN_PUB_DEV_KEY with the public key you created in 1.2 Create Development Wallet.

4.Save and exit the text editor:

[CTRL]+X
y
[ENTER]

1.5. Start the genesis node

1.Create a genesis_start.sh shell script file in the ~/biosnode/genesis/ directory and open the file with your preferred editor (demonstrated with nano editor here):

cd ~/biosboot/genesis
touch genesis_start.sh
nano genesis_start.sh

2.Copy the following shell script content and paste it to the genesis_start.sh shell script file.

#!/bin/bash
DATADIR="./blockchain"

if [ ! -d $DATADIR ]; then
  mkdir -p $DATADIR;
fi

aos \
--genesis-json $DATADIR"/../../genesis.json" \
--signature-provider RSN_PUB_DEV_KEY=KEY:RSN_PRIV_DEV_KEY \
--plugin arisen::producer_plugin \
--plugin arisen::producer_api_plugin \
--plugin arisen::chain_plugin \
--plugin arisen::chain_api_plugin \
--plugin arisen::http_plugin \
--plugin arisen::history_api_plugin \
--plugin arisen::history_plugin \
--data-dir $DATADIR"/data" \
--blocks-dir $DATADIR"/blocks" \
--config-dir $DATADIR"/config" \
--producer-name arsien \
--http-server-address 127.0.0.1:8888 \
--p2p-listen-endpoint 127.0.0.1:9010 \
--access-control-allow-origin=* \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors \
--enable-stale-production \
--p2p-peer-address localhost:9011 \
--p2p-peer-address localhost:9012 \
--p2p-peer-address localhost:9013 \
>> $DATADIR"/aos.log" 2>&1 & \
echo $! > $DATADIR"/rsnd.pid"

NOTE: Replace the RSN_PUB_DEV_KEY and RSN_PRIV_DEV_KEY with the public and private key values you generated in step 1.2 Create a development wallet.

3.Save and exit the text editor:

[CTRL]+X
y
[ENTER]

4.Assign execution privileges to the genesis_start.sh shell script file and then execute the genesis_start.sh script to start genesis aos:

cd ~/biosboot/genesis/
chmod 755 genesis_start.sh
./genesis_start.sh

📘

The Genesis node:

1.5.2 Restarting aos

  • Bears the name arisen
  • Produces blocks
  • Listens for HTTP request on 127.0.0.1:8888
  • Listens for peer connections requests on 127.0.0.1:9010
  • Initiates periodic peer connections to localhost:9011, localhost:9012, and localhost:9013; these aos are not running yet so ignore if you see any failed connection attempts
  • Has the parameter --contracts-console which prints contracts output to the console; in our case, this information is good for troubleshooting problems

1.5.1 Stopping the Genesis node

To stop aos:

1.Create a stop.sh shell script file in the ~/biosnode/genesis/ directory and copy the following stop.sh script to it.

#!/bin/bash
DATADIR="./blockchain/"

if [ -f $DATADIR"/rsnd.pid" ]; then
pid=`cat $DATADIR"/rsnd.pid"`
echo $pid
kill $pid
rm -r $DATADIR"/rsnd.pid"
echo -ne "Stoping Node"
while true; do
[ ! -d "/proc/$pid/fd" ] && break
echo -ne "."
sleep 1
done
echo -ne "\rNode Stopped. \n"
fi

2.Execute the stop.sh shell script from the same ~/biosboot/genesis/ directory:

cd ~/biosboot/genesis/
chmod 755 stop.sh
./stop.sh

After stopping the aos process, you will not be able to restart it using the .genesis_start.sh script created in 1.5 Start the genesis node as once a node runs and produces blocks, the blockchain database initializes and gets populated. Thus, aos is not able to start with the --genesis-json parameter. Therefore, it is recommended to create a new script, start.sh by following the same steps outlined in 1.5 Start a genesis node and copy the below content to the script. Also, assign execution privileges to the script and use this file for any future aos restarts after you stopped the process.

#!/bin/bash
DATADIR="./blockchain"

if [ ! -d $DATADIR ]; then
  mkdir -p $DATADIR;
fi

aos \
--signature-provider RSN_PUB_DEV_KEY=KEY:RSN_PRIV_DEV_KEY \
--plugin arisen::producer_plugin \
--plugin arisen::producer_api_plugin \
--plugin arisen::chain_plugin \
--plugin arisen::chain_api_plugin \
--plugin arisen::http_plugin \
--plugin arisen::history_api_plugin \
--plugin arisen::history_plugin \
--data-dir $DATADIR"/data" \
--blocks-dir $DATADIR"/blocks" \
--config-dir $DATADIR"/config" \
--producer-name arisen \
--http-server-address 127.0.0.1:8888 \
--p2p-listen-endpoint 127.0.0.1:9010 \
--access-control-allow-origin=* \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors \
--enable-stale-production \
--p2p-peer-address localhost:9011 \
--p2p-peer-address localhost:9012 \
--p2p-peer-address localhost:9013 \
>> $DATADIR"/aos.log" 2>&1 & \
echo $! > $DATADIR"/rsnd.pid"

Troubleshooting aos Restart Errors

"perhaps we need to replay": This error can occur when you restart aos due to a missing --hard-replay parameter which replays all the transactions from the genesis node. To overcome this error, add the parameter --hard-replay in the hard_replay.sh shell script.

Some other parameters that you can use to restart aos are:

  • --truncate-at-block
  • --delete-all-blocks
  • --replay-blockchain
  • --hard-replay-blockchain

The following is the hard_replay.sh shell script which is using the --hard-replay-blockchain parameter:

#!/bin/bash
DATADIR="./blockchain"

if [ ! -d $DATADIR ]; then
  mkdir -p $DATADIR;
fi

aos \
--signature-provider RSN_PUB_DEV_KEY=KEY:RSN_PRIV_DEV_KEY \
--plugin arsien::producer_plugin \
--plugin arsien::producer_api_plugin \
--plugin arsien::chain_plugin \
--plugin arsien::chain_api_plugin \
--plugin arsien::http_plugin \
--plugin arsien::history_api_plugin \
--plugin arsien::history_plugin \
--data-dir $DATADIR"/data" \
--blocks-dir $DATADIR"/blocks" \
--config-dir $DATADIR"/config" \
--producer-name arisen \
--http-server-address 127.0.0.1:8888 \
--p2p-listen-endpoint 127.0.0.1:9010 \
--access-control-allow-origin=* \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors \
--enable-stale-production \
--p2p-peer-address localhost:9011 \
--p2p-peer-address localhost:9012 \
--p2p-peer-address localhost:9013 \
--hard-replay-blockchain \
>> $DATADIR"/arsien.log" 2>&1 & \
echo $! > $DATADIR"/rsnd.pid"

Restarting aos from scratch

Copy the below content and create a shell script clean.sh and give execution permission to it:

#!/bin/bash
rm -fr blockchain
ls -al

If you want to erase the current configuration, the blockchain data, configuration, and logs, first run the stop.sh script and after that run the clean.sh script which you'll have to create from below content:

cd ~/biosboot/genesis/
./stop.sh
./clean.sh
./genesis_start.sh

1.6. Inspect the aos.log file

Inspect the aos.log file with the following command, and use CTRL+C to exit the listing mode.

cd ~/biosboot/genesis/
tail -f ./blockchain/aos.log

1.7. Create important system accounts

There are several system accounts that are needed, namely the following:

arisen.bpay
  arisen.msig
  arisen.names
  arisen.ram
  arisen.ramfee
  arisen.saving
  arisen.stake
  arisen.token
  arisen.vpay
  arisen.rex

Repeat the following steps to create an account for each of the system accounts. In this tutorial, we will use the same key pair for both the account owner and active keys, so we only need to provide the key value once on the command line. For most general accounts, it is a good practice to use separate keys for owner and active. The script uses the same key for all of the arsien.* accounts. You can use different keys for each.

arisecli create key --to-console
Private key: 5KAVVPzPZnbAx8dHz6UWVPFDVFtU1P5ncUzwHGQFuTxnEbdHJL4
Public key: RSN84BLRbGbFahNJEpnnJHYCoW9QPbQEk2iHsHGGS6qcVUq9HhutG
arsiecli wallet import --private-key
5KAVVPzPZnbAx8dHz6UWVPFDVFtU1P5ncUzwHGQFuTxnEbdHJL4
imported private key for: RSN84BLRbGbFahNJEpnnJHYCoW9QPbQEk2iHsHGGS6qcVUq9HhutG
arsiecli create account arisen arisen.bpay RSN84BLRbGbFahNJEpnnJHYCoW9QPbQEk2iHsHGGS6qcVUq9HhutG
executed transaction: ca68bb3e931898cdd3c72d6efe373ce26e6845fc486b42bc5d185643ea7a90b1  200 bytes  280 us
#         arsien <= arsien::newaccount            {"creator":"arsien","name":"arsien.bpay","owner":{"threshold":1,"keys":[{"key":"RSN84BLRbGbFahNJEpnnJH...

1.8. Build arsien.contracts

In order to build arsien.contracts, create a dedicated directory for arsien.contracts, clone the arsien.contracts sources and build them. Print the current directory in the terminal and make a note of it. The current directory will be referred to as ARSIEN_CONTRACTS_DIRECTORY.

cd ~
git clone https://github.com/ARISENIO/arisen.contracts.git
cd ./arisen.contracts/
./build.sh
cd ./build/contracts/
pwd

You will also need an older version of arisen.contracts, specifically v1.8.0. Follow the instructions below to build it and remember the path where it is built:

1.To install arsien.cdt version 1.6.3 binaries, see the Install arsien.cdt binaries tutorial.

2.After the arsien.cdt 1.6.3 version is installed, you can compile the older version of arsien.contracts:

cd ~
git clone https://github.com/ARISEN/arsien.contracts.gi
cd ./arisen.contracts-1.8.x/
git checkout release/1.8.x
./build.sh
cd ./build/contracts/
pwd

Make note of the printed local path, we will reference to this directory as ARISEN_OLD_CONTRACTS_DIRECTORY from here onward when needed.

Restore the arisen.cdt version installed at the beginning of the tutorial.

1.9. Install the arisen.token contract

Now we have to set the arisen.token contract. This contract enables you to create, issue, transfer, and get information about tokens. To set the arisen.token contract:

arisecli set contract arisen.token ARISEN_CONTRACTS_DIRECTORY/arisen.token/
Reading WAST/WASM from /users/documents/rsn/contracts/arisen.token/arisen.token.wasm...
Using already assembled WASM...
Publishing contract...
executed transaction: 17fa4e06ed0b2f52cadae2cd61dee8fb3d89d3e46d5b133333816a04d23ba991  8024 bytes  974 us
#         arisen <= arisen::setcode               {"account":"arisen.token","vmtype":0,"vmversion":0,"code":"0061736d01000000017f1560037f7e7f0060057f7e...
#         arisen <= arisen::setabi                {"account":"arisen.token","abi":{"types":[],"structs":[{"name":"transfer","base":"","fields":[{"name"...

1.10. Set the arisen.msig contract

The arisen.msig contract enables and simplifies defining and managing permission levels and performing multi-signature actions. To set the arisen.msig contract:

arisecli set contract arisen.msig ARISEN_CONTRACTS_DIRECTORY/arisen.msig/

1.11. Create and allocate the RIX currency

Create the RIX currency with a maximum value of 10 billion tokens. Then, issue one billion tokens. Replace RIX with your specific currency designation.

In the first step, the create action from the arisen.token contract, authorized by the arisen.token account, creates 1B RIX tokens in the arisen account. This effectively creates the maximum supply of tokens, but does not put any tokens into circulation. Tokens not in circulation can be considered to be held in reserve.

arsiecli push action arsien.token create '[ "arisen", "10000000000.0000 RIX" ]' -p [email protected]
executed transaction: 0440461e0d8816b4a8fd9d47c1a6a53536d3c7af54abf53eace884f008429697  120 bytes  326 us
#  arisen.token <= arisen.token::create          {"issuer":"arisen","maximum_supply":"10000000000.0000 RIX"}

In the second step, the arisen.token contract's issue action takes 1B RIX tokens out of reserve and puts them into circulation. At the time of issue, the tokens are held within the arisen account. Since the arisen account owns the reserve of uncirculated tokens, its authority is required to do the action.

arisecli push action arisen.token issue '[ "arsien", "1000000000.0000 RIX", "memo" ]' -p [email protected]
executed transaction: a53961a566c1faa95531efb422cd952611b17d728edac833c9a55582425f98ed  128 bytes  432 us
#   arisen.token <= arisen.token::issue           {"to":"arisen","quantity":"1000000000.0000    RIX","memo":"memo"}

📘

Note

As a point of interest, from an economic point of view, moving token from reserve into circulation, such as by issuing tokens, is an inflationary action. Issuing tokens is just one way that inflation can occur

1.12. Set the arisen.system contract

Activate the PREACTIVATE_FEATURE protocol

All of the protocol upgrade features introduced in v1.8 and v2.0 first require a special protocol feature (codenamed PREACTIVATE_FEATURE) to be activated and for an updated version of the system contract that makes use of the functionality introduced by that feature to be deployed.

To activate the special protocol PREACTIVATE_FEATURE:

curl --request POST \
    --url http://127.0.0.1:8888/v1/producer/schedule_protocol_feature_activations \
    -d '{"protocol_features_to_activate": ["0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd"]}'

Set the arisen.system contract

A system contract provides the actions for all token-based operational behavior. Prior to installing the system contract, actions are done independently of accounting. Once the system contract is enabled, actions now have an economic element to them. System Resources (CPU, network, memory) must be paid for and likewise, new accounts must be paid for. The system contract enables tokens to be staked and unstaked, resources to be purchased, potential producers to be registered and subsequently voted on, producer rewards to be claimed, privileges and limits to be set, and more.

In the first phase, we will install the older version of the arisen.system contract.

arisen set contract arisen ARISEN_OLD_CONTRACTS_DIRECTORY/arisen.system/
Reading WAST/WASM from /users/documents/rsn/build/contracts/arisen.system/arisen.system.wasm...
Using already assembled WASM...
Publishing contract...
executed transaction: 2150ed87e4564cd3fe98ccdea841dc9ff67351f9315b6384084e8572a35887cc  39968 bytes  4395 us
#         arisen<= arisen::setcode               {"account":"arisen","vmtype":0,"vmversion":0,"code":"0061736d0100000001be023060027f7e0060067f7e7e7f7f...
#         arisen <= arisen::setabi                {"account":"arisen","abi":{"types":[],"structs":[{"name":"buyrambytes","base":"","fields":[{"name":"p...

Enable Features

After you set the arisen.system contract, run the following commands to enable the rest of the features which are highly recommended to be enabled for an ARISEN-based blockchain.

📘

NOTE:

Enabling these features are optional. You can choose to enable or continue without these features.

# GET_SENDER
arisecli push action arisen activate '["f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d"]' -p arisen

# FORWARD_SETCODE
arisecli push action arisen activate '["2652f5f96006294109b3dd0bbde63693f55324af452b799ee137a81a905eed25"]' -p arisen

# ONLY_BILL_FIRST_AUTHORIZER
arisecli push action arisen activate '["8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405"]' -p arisen

# RESTRICT_ACTION_TO_SELF
arisecli push action arisen activate '["ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43"]' -p arisen

# DISALLOW_EMPTY_PRODUCER_SCHEDULE
arisecli push action arisen activate '["68dcaa34c0517d19666e6b33add67351d8c5f69e999ca1e37931bc410a297428"]' -p arisen

 # FIX_LINKAUTH_RESTRICTION
arisecli push action arisen activate '["e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526"]' -p arisen

 # REPLACE_DEFERRED
arisecli push action arisen activate '["ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99"]' -p arisen

# NO_DUPLICATE_DEFERRED_ID
arisecli push action arisen activate '["4a90c00d55454dc5b059055ca213579c6ea856967712a56017487886a4d4cc0f"]' -p arisen

# ONLY_LINK_TO_EXISTING_PERMISSION
arisecli push action arisen activate '["1a99a59d87e06e09ec5b028a9cbb7749b4a5ad8819004365d02dc4379a8b7241"]' -p arisen

# RAM_RESTRICTIONS
arisecli push action arisen activate '["4e7bf348da00a945489b2a681749eb56f5de00b900014e137ddae39f48f69d67"]' -p arisen

# WEBAUTHN_KEY
arisecli push action arisen activate '["4fca8bd82bbd181e714e283f83e1b45d95ca5af40fb89ad3977b653c448f78c2"]' -p arisen

# WTMSIG_BLOCK_SIGNATURES
arisecli push action arisen activate '["299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"]' -p arisen

Deploy

arisecli set contract arisen ARISEN_CONTRACTS_DIRECTORY/arisen.system/

2. Transition from single genesis producer to multiple producers

In the next set of steps, we will transition from a single block producer (the genesis node) to multiple producers. Up to this point, only the built-in arisen account is privileged and can sign blocks. The target is to manage the blockchain by a collection of elected producers, operating under a rule of 2/3 + 1 producers agreeing before a block is final.

Producers are chosen by election. The list of producers can change. Rather than giving privileged authority directly to any producer, the governing rules are associated with a special built-in account named arisen.prods. This account represents the group of elected producers. The arisen.prods account (effectively the producer group) operates using permissions defined by the arisen.msig contract.

As soon as possible after installing the arisen.system contract, we want to designate arisen.msig as a privileged account so that it can authorize on behalf of the arisen account. As soon as possible, arisen will resign its authority and arisen.prods will take over.

2.1. Designate arisen.msig as privileged account

To designate arisen.msig as a privileged account:

arisecli push action arisen setpriv '["arisen.msig", 1]' -p [email protected]

2.2. Initialize system account

To initialize the system account with code zero (needed at initialization time) and RIX token with precision 4; precision can range from [0 .. 18]:

arisecli push action arisen init '["0", "4,RIX"]' -p [email protected]

2.3. Stake tokens and expand the network

If you've followed the tutorial steps above to this point, you now have a single host, single-node configuration with the following contracts installed:

arisen.token
arisen.msig
arisen.system

The accounts arisen and arisen.msig are privileged accounts. The other arisen.* accounts are created but are not privileged.

We are now ready to begin staking accounts and expanding the network of producers.

2.4. Create staked accounts

Staking is the process of allocating tokens acquired by an entity in the "real world" (e.g., an individual purchasing something at a Crowdsale or some other means) to an account within the ARISEN system. Staking and unstaking are an on-going process throughout the life of a blockchain. The initial staking done during the bios boot process is special. During the bios boot sequence, accounts are staked with their tokens. However, until producers are elected, tokens are effectively in a frozen state. Thus, the goal of the initial staking done during the bios boot sequence is to get tokens allocated to their accounts and ready for use, and get the voting process going so that producers can get elected and the blockchain is running "live".

The following recommendation is given for the initial staking process:

1.)0.1 token (literally, not 10% of the account's tokens) is staked for RAM. By default, arisecli stakes 8 KB of RAM on account creation, paid by the account creator. In the initial staking, the arisen account is the account creator doing the staking. Tokens staked during the initial token staking process cannot be unstaked and made liquid until after the minimum voting requirements have been met.

2.) 0.45 token is staked for CPU, and 0.45 token is staked for network.
3.) The next available tokens up to 9 total are held as liquid tokens.
4.)Remaining tokens are staked 50/50 CPU and network.

Example 1.  accountnum11 has 100 RIX. It will be staked as 0.1000 RIX on RAM; 45.4500 RIX on CPU; 45.4500 RIX on network; and 9.0000 RIX held for liquid use.

Example 2.  accountnum33 has 5 RIX. It will be staked as 0.1000 RIX on RAM; 0.4500 RIX on CPU; 0.4500 RIX on network; and 4.0000 RIX held for liquid use.

To make the tutorial more realistic, we distribute the 1B tokens to accounts using a Pareto distribution. The Pareto distribution models an 80-20 rule, e.g., in this case, 80% of the tokens are held by 20% of the population. The examples here do not show how to generate the distribution, focusing instead on the commands to do the staking. The script bios-boot-tutorial.py that accompanies this tutorial uses the Python NumPy (numpy) library to generate a Pareto distribution.

Use the following steps to stake tokens for each account. These steps must be done individually for each account.

📘

Note

The key pair is created here for this tutorial. In a "live" scenario, the key value(s) and token share for an account should already be established through some well-defined out-of-band process.

$ arisecli create key --to-console
Private key: 5K7EYY3j1YY14TSFVfqgtbWbrw3FA8BUUnSyFGgwHi8Uy61wU1o
    Public key: RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt
arisecli wallet import --private-key 5K7EYY3j1YY14TSFVfqgtbWbrw3FA8BUUnSyFGgwHi8Uy61wU1o
imported private key for: RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt

Create a staked account with initial resources and public key.

arisecli system newaccount arisen --transfer accountnum11 RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt --stake-net "100000000.0000 RIX" --stake-cpu "100000000.0000 RIX" --buy-ram-kbytes 8192
775292ms thread-0   main.cpp:419                  create_action        ] result: {"binargs":"0000000000ea30551082d4334f4d113200200000"} arg: {"code":"arisen","action":"buyrambytes","args":{"payer":"arisen","receiver":"accountnum11","bytes":8192}}
775295ms thread-0   main.cpp:419                  create_action        ] result: {"binargs":"0000000000ea30551082d4334f4d113200ca9a3b00000000045359530000000000ca9a3b00000000045359530000000001"} arg: {"code":"arisen","action":"delegatebw","args":{"from":"arisen","receiver":"accountnum11","stake_net_quantity":"100000.0000 SYS","stake_cpu_quantity":"100000.0000 SYS","transfer":true}}
executed transaction: fb47254c316e736a26873cce1290cdafff07718f04335ea4faa4cb2e58c9982a  336 bytes  1799 us
#         arisen <= arisen::newaccount            {"creator":"arisen","name":"accountnum11","owner":{"threshold":1,"keys":[{"key":"RSN8mUftJXepGzdQ2TaC...
#         arisen <= arisen::buyrambytes           {"payer":"arisen","receiver":"accountnum11","bytes":8192}
#         arisen <= arisen::delegatebw            {"from":"arisen","receiver":"accountnum11","stake_net_quantity":"100000.0000 RIX","stake_cpu_quantity...

2.5. Register the new account as a producer

To register the new account as a producer:

arisecli system regproducer accountnum11 RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt https://accountnum11.com RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt
1487984ms thread-0   main.cpp:419                  create_action        ] result: {"binargs":"1082d4334f4d11320003fedd01e019c7e91cb07c724c614bbf644a36eff83a861b36723f29ec81dc9bdb4e68747470733a2f2f6163636f756e746e756d31312e636f6d2f454f53386d5566744a586570477a64513254614364754e7553504166584a48663232756578347534316162314556763945416857740000"} arg: {"code":"arisen,"action":"regproducer","args":{"producer":"accountnum11","producer_key":"RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt","url":"https://accountnum11.com/RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt","location":0}}
executed transaction: 4ebe9258bdf1d9ac8ad3821f6fcdc730823810a345c18509ac41f7ef9b278e0c  216 bytes  896 us
#         arisen <= arisen::regproducer           {"producer":"accountnum11","producer_key":"RSNftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt","u...

This makes the node a candidate to be a producer, but the node will not actually be a producer unless it is elected, that is, voted for.

2.6. List the producers

To facilitate the voting process, list the available producers. At this point, you will see only one account registered as a producer.

arisecli system listproducers
Producer      Producer key                                           Url                                                         Scaled votes
accountnum11  RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt  https://accountnum11.com/RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22 0.0000

2.7. Set up and start a new producer

We will set up now a new producer using the previously created accountnum11 account. To set up the new producer, execute these steps to create a dedicated folder for it:

cd ~/netbios/
mkdir accountnum11
cd accountnum11
copy ~/netbios/genesis/stop.sh
copy ~/netbios/genesis/clean.sh

Create the following three shell script files and assign execution permission to them: genesis_start.sh, start.sh, hard_start.sh.

#!/bin/bash
DATADIR="./blockchain"
CURDIRNAME=${PWD##*/}

if [ ! -d $DATADIR ]; then
  mkdir -p $DATADIR;
fi

aos \
--genesis-json $DATADIR"/../../genesis.json" \
--signature-provider RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt=KEY:5K7EYY3j1YY14TSFVfqgtbWbrw3FA8BUUnSyFGgwHi8Uy61wU1o \
--plugin arisen::producer_plugin \
--plugin arisen::producer_api_plugin \
--plugin arisen::chain_plugin \
--plugin arisen::chain_api_plugin \
--plugin arisen::http_plugin \
--plugin arisen::history_api_plugin \
--plugin arisen::history_plugin \
--data-dir $DATADIR"/data" \
--blocks-dir $DATADIR"/blocks" \
--config-dir $DATADIR"/config" \
--producer-name $CURDIRNAME \
--http-server-address 127.0.0.1:8011 \
--p2p-listen-endpoint 127.0.0.1:9011 \
--access-control-allow-origin=* \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors \
--enable-stale-production \
--p2p-peer-address localhost:9010 \
--p2p-peer-address localhost:9012 \
--p2p-peer-address localhost:9013 \
>> $DATADIR"/aos.log" 2>&1 & \
echo $! > $DATADIR"/rsnd.pid"
#!/bin/bash
DATADIR="./blockchain"
CURDIRNAME=${PWD##*/}

if [ ! -d $DATADIR ]; then
  mkdir -p $DATADIR;
fi

aos \
--signature-provider RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt=KEY:5K7EYY3j1YY14TSFVfqgtbWbrw3FA8BUUnSyFGgwHi8Uy61wU1o \
--plugin arisen::producer_plugin \
--plugin arisen::producer_api_plugin \
--plugin arisen::chain_plugin \
--plugin arisen::chain_api_plugin \
--plugin arisen::http_plugin \
--plugin arisen::history_api_plugin \
--plugin arisen::history_plugin \
--data-dir $DATADIR"/data" \
--blocks-dir $DATADIR"/blocks" \
--config-dir $DATADIR"/config" \
--producer-name $CURDIRNAME \
--http-server-address 127.0.0.1:8011 \
--p2p-listen-endpoint 127.0.0.1:9011 \
--access-control-allow-origin=* \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors \
--enable-stale-production \
--p2p-peer-address localhost:9010 \
--p2p-peer-address localhost:9012 \
--p2p-peer-address localhost:9013 \
>> $DATADIR"/aos.log" 2>&1 & \
echo $! > $DATADIR"/rsnd.pid"
#!/bin/bash
DATADIR="./blockchain"
CURDIRNAME=${PWD##*/}

if [ ! -d $DATADIR ]; then
  mkdir -p $DATADIR;
fi

aos \
--signature-provider RSN8mUftJXepGzdQ2TaCduNuSPAfXJHf22uex4u41ab1EVv9EAhWt=KEY:5K7EYY3j1YY14TSFVfqgtbWbrw3FA8BUUnSyFGgwHi8Uy61wU1o \
--plugin arisen::producer_plugin \
--plugin arisen::producer_api_plugin \
--plugin arisen::chain_plugin \
--plugin arisen::chain_api_plugin \
--plugin arisen::http_plugin \
--plugin arisen::history_api_plugin \
--plugin arisen::history_plugin \
--data-dir $DATADIR"/data" \
--blocks-dir $DATADIR"/blocks" \
--config-dir $DATADIR"/config" \
--producer-name $CURDIRNAME \
--http-server-address 127.0.0.1:8011 \
--p2p-listen-endpoint 127.0.0.1:9011 \
--access-control-allow-origin=* \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors \
--enable-stale-production \
--p2p-peer-address localhost:9010 \
--p2p-peer-address localhost:9012 \
--p2p-peer-address localhost:9013 \
--hard-replay-blockchain \
>> $DATADIR"/aos.log" 2>&1 & \
echo $! > $DATADIR"/rsnd.pid"
cd ~/biosboot/accountnum11/
ls -al
drwxr-xr-x   8 owner  group   256 Dec  7 14:17 .
drwxr-xr-x   3 owner  group   960 Dec  5 10:00 ..
-rwxr-xr-x   1 owner  group   40  Dec  5 13:08 clean.sh
-rwxr-xr-x   1 owner  group   947 Dec  5 14:31 genesis_start.sh
-rwxr-xr-x   1 owner  group   888 Dec  5 13:08 hard_start.sh
-rwxr-xr-x   1 owner  group   901 Dec  6 15:44 start.sh
-rwxr-xr-x   1 owner  group   281 Dec  5 13:08 stop.sh

You are now ready to start the second producer node by executing the following commands:

cd ~/biosboot/accountnum11/
./genesis_start.sh
tail -f blockchain/aos.log

After executing the above commands, you should see in the command shell a live stream of aos.log file which is getting written to by the aos continuously. You can stop the live stream monitor by pressing CTRL+C keys.

To stop the new node, you have to execute the stop.sh script and to restart the node, execute the start.sh script and not the genesis_start.sh (this one is used only once in 1.5 Start the genesis node).

To erase everything and start from scratch, you can execute the following set of commands:

cd ~/biosboot/accountnum11/
./stop.sh
./clean.sh
./genesis_start.sh
tail -f blockchain/aos.log

2.8. Repeat the process for creating multiple producers

You can now repeat the process (starting from 2.4. till 2.7) for creating as many producers as you want each with its own staked account, own dedicated directory, named accountnumXY (with X and Y int values in interval [1..5]), and their own dedicated script files: genesis_start.sh, start.sh, stop.sh, clean.sh located in their corresponding folder.

Also, be aware of how you mesh these nodes between each other, so pay particular attention to the following parameters in the genesis_start.sh, start.sh and hard_start.sh scripts:

--producer-name $CURDIRNAME \ # Producer name, set in the script to be the parent directory name
...
--http-server-address 127.0.0.1:8011 \ # http listening port for API incoming requests
--p2p-listen-endpoint 127.0.0.1:9011 \ # p2p listening port for incoming connection requests
...
...
--p2p-peer-address localhost:9010 \   # Meshing with peer `genesis` node
--p2p-peer-address localhost:9012 \   # Meshing with peer `accountnum12` node
--p2p-peer-address localhost:9013 \.  # Meshing with peer `accountnum13` node

2.9. Vote for each of the block producers started

At this point the nodes are started, meshed together in a network, and they receive blocks from genesis node but they do not produce.

15% Requirement

For the nodes to produce blocks, a total of 15% of the token supply must be staked and then voted for all available producers. We gave accountnum11 enough tokens earlier. To elect block producers, execute the following command which allows one account to vote for as up to 30 block producers identified by their account name:

arisecli system voteproducer prods accountnum11 accountnum11 accountnum12 accountnum13

3. Resign arisen account and system accounts

Once producers have been elected and the minimum number requirements have been met, that is, a minimum 15% of tokens have been staked to produce votes, the arisen account can resign, leaving the arisen.msig account as the only privileged account.

arisecli push action arisen updateauth '{"account": "arisen", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen.prods", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen.prods", "permission": "active"}}]}}' -p [email protected]

Resigning involves setting the keys of the arisen. accounts to null. Use the following command to clear the arisen. accounts' owner and active keys:

Also, the system accounts created in step 1.7. Create important system accounts should be resigned as well by running the following commands:

arisecli push action arisen updateauth '{"account": "arisen.bpay", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen.bpay", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]

arisecli push action arisen updateauth '{"account": "arisen.msig", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen.msig", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]

arisecli push action arisen updateauth '{"account": "arisen.names", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen.names", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]

arisecli push action arisen updateauth '{"account": "arisen.ram", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen.ram", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]

arisecli push action arisen updateauth '{"account": "arisen.ramfee", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen.ramfee", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]

arisecli push action arisen updateauth '{"account": "arisen.saving", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen.saving", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]

arisecli push action arisen updateauth '{"account": "arisen.stake", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen.stake", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]

arisecli push action arisen updateauth '{"account": "arisen.token", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen.token", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]

arisecli push action arisen updateauth '{"account": "arisen.vpay", "permission": "owner", "parent": "", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]
arisecli push action arisen updateauth '{"account": "arisen.vpay", "permission": "active", "parent": "owner", "auth": {"threshold": 1, "keys": [], "waits": [], "accounts": [{"weight": 1, "permission": {"actor": "arisen", "permission": "active"}}]}}' -p [email protected]

4. Monitor, test, monitor

cd ~/biosboot/genesis/
tail -f ./blockchain/aos.log
cd ~/biosboot/accountnum11/
tail -f ./blockchain/aos.log

You can test various commands, create accounts, check balance on accounts, transfer tokens between accounts, etc.

For commands on creating new accounts, see the Create test accounts tutorial.

For commands on issuing, allocating and transferring token between accounts, see the Deploy, Issue and Transfer Tokens section.