EOSIO Private Network Installation
#
Private Network Installation TutorialSeveral topologies can be designed in the sense of quantity of nodes or redundancy of the data, nevertheless, for the practicity of this tutorial, the following topology is used as a main reference:
#
Software RequirementsAt the time of configuring a private EOSIO network there are some software installation requirements:
- EOSIO precompiled binaries installation
- EOSIO.CDT binaries installation
Also, we are using Ubuntu 18.04 LTS, but if you want to use macOS or other supported OS, take a look at EOSIO releases
#
EOSIO Precompiled Binaries InstallationExecute the following commands to install EOSIO precompiled binaries:
Once you installed EOSIO binaries; nodeos, a blockchain configuration from scratch and P2P networks interactions are among available functionalities that the protocol provides.
To uninstall EOSIO execute:
$ sudo apt remove eosio
#
EOSIO.CDT (Contract Development Toolkit) Binaries InstallationEOSIO.CDT is a toolkit that facilitates smart contract development in a EOSIO based blockchain networks. To install EOSIO.CDT v1.6.3 execute the following commands:
You may want take a look at EOSIO.CDT releases.
#
Genesis Node ConfigurationBefore to configure the genesis node, it is necessary to create a directory called ~/biosboot/genesis
, this is due to protocol particularities. So, for this execute the following:
Now, create a file called genesis.json
in the ~/biosboot/
directory, so for this execute the following command to create and edit the file:
Copy and paste the following content in the previous created file:
This can be changed later on using privileged
set_param
function. Read more here.
#
Start the nodeos ServiceBefore to start the nodeos service, it is necessary to create the file genesis_start.sh
. For this, execute the following commands:
Create the file
Paste the following content in the
genesis_start.sh
file:Remember to replace
EOS_PUB_DEV_KEY
andEOS_PRIV_DEV_KEY
with the previous generated key pair, also replace GENESIS_NODE_IPFinally, assign execution permission to the script:
Once the previous command were executed, the genesis node that will bring eosio as a name will be able to:
Produce blocks
Listen HTTP requests at
SPECIFIED_GENESIS_NODE_IP:8888
Listen connection requests with other nodes at
SPECIFIED_GENESIS_NODE_IP:9010
Print smart contracts output in the terminal
#
nodeos Service RegistriesYou can inspect the nodeos service registries with the following commands:
To exit log print mode, press CTRL+C.
eosio.contracts
Configuration and Compilation#
It is necessary to install the latest version of eosio.contracts
along with v1.8.0 version. To facilitate the understanding of the steps here described, the latest version will be referred as EOSIO_CONTRACTS_DIRECTORY
and the v1.8.0
as EOSIO_OLD_CONTRACTS_DIRECTORY
.
The following installation steps must be followed in the order they appear.
- Clone and compile the
eosio.contracts
: - Clone and install
eosio.cdt
v1.6.3
(necessary version to compileeosio.contracts
v1.8.0
): - Clone and compile
eosio.contracts
v1.8.0
:
eosio.bios
Contract Deployment#
PREACTIVATE_FEATURE
#
Activate Due to updates introduced in v1.8 and v2.0, it is necessary to activate a protocol feature called PREACTIVATE_FEATURE. To activate this feature, execute the following command:
#
Deploy Old Contracts VersionNow it is necessary to deploy the old version of the smart contracts (EOSIO_OLD_CONTRACTS_DIRECTORY
), for this it execute the following command:
Expected output:
Now that the old version of the contracts has been deployed, it is also necessary to activate special features that are recommended for networks based on the EOSIO protocol. To activate these features, execute the following commands:
#
Deploy Latest Contracts VersionOnce the old version of the contracts has been deployed and the features have been activated, we proceed to deploy the recent version of the contracts:
Expected output:
#
Block Producer Nodes: Configuration and ExecutionWe must create the configuration files for each block producer in each server. Since three block producers were conceived in the topology, let's proceed to create their corresponding files. To do this, execute the following commands:
Once the files are created, copy the code snippet content to each corresponding file and repeat the process for each directory on each server (rename the directory according to the node):
config.ini
#
genesis.json
#
start.sh
#
To run each node it is necessary to enter the directory, assign permissions and execute each start.sh
file:
#
Create Block Producer Accounts#
Set Block Producers ScheduleCreate the producers.json
file and paste the following content into it:
Now, execute the following command to set the schedule:
#
API Node: Configuration and ExecutionNow copy the code snippet content to the appropriate file:
config.ini
#
genesis.json
#
start.sh
#
To start the node, assign execute permissions to start.sh
and run it:
#
Seed Node: Configuration and ExecutionNow copy the code snippet content to the appropriate file:
config.ini
#
genesis.json
#
start.sh
#
To start the seed node, simply assign execution permissions to the start.sh
file and execute it:
#
Stop the nodeos ServiceCreate the file stop.sh
in the ~/biosboot/genesis/
directory and copy the following contents:
Now you can execute stop.sh
file:
#
Reboot the nodeos ServiceIt is important to take into account that once the node is producing blocks it is not possible to restart the nodeos service using the same script created in the section Start the nodeos service, since the blockchain database already contains information from the initial execution. This is why it is recommended to create a new script with the name start.sh
. This file can continue to be used for future restarts of the node once the process is stopped.
Copy and paste the following content into the start.sh
file:
Now, assign execution permissions to the start.sh
file and execute it:
The following code fragment corresponds to the hard_replay.sh
script with the --hard-replay-blockchain
flag:
“perhaps we need to replay”: this error may occur when restarting nodeos due to a missing
--hard-replay-blockchain
flag (parameter that replays all transactions from the genesis node). To fix this error, run thehard_replay.sh
script.
#
Reboot nodeos from ScratchTo restart the nodeos service from scratch, create the clean.sh
script, copy the following content and give it execution permissions (chmod 755 clean.sh
):
If you want to delete the current configuration, blockchain data and log files, execute the following commands in the order they appear:
#
Interacting with the NetworkAt this point, the network is able to host any contract. Let's suppose you want to deploy a contract like easycontract EOS Costa Rica's example repo. After you follow the specified instructions there, you can call easycontract's save
ACTION like following:
After the execution, you will get an output in the terminal.