Skip links

Run an EZChain Node

The quickest way to learn about EZChain is to run a node and interact with the network.

In this tutorial, we will:

  • Install and run an EZChain node
  • Connect to EZChain Mainnet

Requirements

EZChain is an incredibly lightweight protocol, so nodes can run on commodity hardware. Note that as network usage increases, hardware requirements may change.

  • CPU: Equivalent of 4 vCPU
  • RAM: 8 GiB
  • Storage: 80 GiB
  • OS: Ubuntu 20.04

Run an EZChain Node

Let’s install ezcgo, the Go implementation of an EZChain node, and connect to the EZChain Network

Download EZCGo

The node is a binary program, So you can download the pre-built binary for easier setup the node

- Create the folder and change current path to this folder to download ezcgo binaries:

mkdir -p /opt/ezchain && cd /opt/ezchain

- Download the binary of ezcgo with command:

wget https://ezchain-binary.sgp1.digitaloceanspaces.com/ezcgo-v1.2.tar.gz

- You can use MD5 checksum to check the integrity ò the download file, type the follow command on CLI:

md5sum ezcgo-v1.2.tar.gz

Output must be same here:

aa69aec456c42f05aea6178aae92d906  ezcgo-v1.2.tar.gz

- Extract the ezcgo binaries compress file:

tar xvf ezcgo-v1.2.tar.gz

- When extract success, you will see the ezcgo binary and the plugins folder - that contain the binary of evm:

Start a Node, and Connect to EZChain

- Start your own EZChain node with command:

./ezcgo --public-ip=<your_server_public_ip> --http-host 0.0.0.0 \
--http-port=9650 --staking-port=9651 --db-dir=db/node \
--log-level=info --api-admin-enabled=true \
--http-allowed-origins='*'

When the node starts, it has to sync up (catch up with the rest of the network,). You will see logs about syncing.
Pay Attention: You need to wait to your node to finished syncing with the rest of network, before using API expose at your node.
When a given chain is done syncing, it will print a log like this:

INFO [03-21|05:22:32.031] <X Chain> snow/engine/ezcgo/transitive.go#292: bootstrapping finished with 1 vertices in the accepted frontier
INFO [03-21|05:22:32.044] <P Chain> snow/engine/snowman/transitive.go#329: bootstrapping finished with 8ndyi1P6SMdcCbgCk3RpHk3Bx6NumZk6ghrzooRSKhLqXE9Tr as the last accepted block
INFO [03-21|05:22:32.045] <C Chain> snow/engine/snowman/transitive.go#329: bootstrapping finished with 2BaVsniDKhYWfxemEPFS2eED923nc4jK328yiAinCQXFrG3H4u as the last accepted block

To check if a given chain is done syncing, in another terminal window call info.isBootstrapped by copying and pasting the following command:

curl -X POST --data '{
   "jsonrpc":"2.0",
   "id"     :1,
   "method" :"info.isBootstrapped",
   "params": {
       "chain":"X"
   }
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info

If this returns true, the chain is synced with the network.

{"jsonrpc":"2.0","result":{"isBootstrapped":true},"id":1}

If you make an API call to a chain that is not done bootstrapping, it will return API call rejected because chain is not done syncing.

Your node is running and connected now.

You can check your node ID with command:

curl --location --request POST '127.0.0.1:9650/ext/info' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"info.getNodeID",
    "params" :{
    }
}'

Sample response:

{
   "jsonrpc": "2.0",
   "result": {
       "nodeID": "NodeID-6JQD1WHeHQiyz9nYnrvJWVQ8rfTV6ybvt"
   },
   "id": 1
}

Add a validator with EZChain Wallet

When you have run EZChain node sucessfully and finish sync up with the rest of network, you can join your running node as a validator of EZChain network to take profit from validator rewards.

In this section, we’ll add your node to the Primary Network as a validator on EZChain.

DANGER

Note that once you issue the transaction to add a node as a validator, there is no way to change the parameters. You can’t remove your stake early or change the stake amount, node ID, or reward address. Please make sure you’re using the correct values in the API calls below.

Open EZChain Wallet by access to the web wallet address: https://wallet.ezchain.com/

Go to Earn tab and choose Add Validator:

Fill out the staking parameters. When you’ve filled in all the staking parameters and double-checked them, click Confirm.

The parameters include:

  1. Node ID: ID of the node you have run before, and get by call curl at previous section
  2. Staking End Date: time you want to end the staking process and get rewards
  3. Staking amount: Amount EZC you want to add to validator node to stake
  4. Delegation fee: fee that users who delegate to your node charge for you
  5. Reward address(Optional): the P-Chain address you want to receive reward after finish staking, default is the address of current wallet

Make sure the staking period is at least 2 weeks, the delegation fee rate is at least 2%, and you’re staking at least 2,000 EZC.

You should see this success message, and your balance should be updated.

Go back to the Earn tab, and click Estimated Rewards.

Once your validator’s start time has passed, you will see the rewards it may earn, as well as its start time, end time, and the percentage of its validation period that has passed.

All Done!

Backup your Node to keep the nodeID for disaster recovery

Once you have your node up and running, it's time to prepare for disaster recovery. Should your machine ever have a catastrophic failure due to either hardware or software issues, or even a case of natural disaster, it's best to be prepared for such a situation by making a backup.

When running, a complete node installation along with the database can grow to be multiple gigabytes in size. Having to back up and restore such a large volume of data can be expensive, complicated and time-consuming. Luckily, there is a better way.

Instead of having to back up and restore everything, we need to back up only what is essential, that is, those files that cannot be reconstructed because they are unique to your node. For EZChain node, unique files are those that identify your node on the network, in other words, files that define your NodeID.

Even if your node is a validator on the network and has multiple delegations on it, you don't need to worry about backing up anything else, because the validation and delegation transactions are also stored on the blockchain and will be restored during bootstrapping, along with the rest of the blockchain data.

The installation itself can be easily recreated by installing the node on a new machine, and all the remaining gigabytes of blockchain data can be easily recreated by the process of bootstrapping, which copies the data over from other network peers.

NodeID

NodeID is a unique identifier that differentiates your node from all the other peers on the network. It's a string formatted like NodeID-6JQD1WHeHQiyz9nYnrvJWVQ8rfTV6ybvt. In essence, NodeID is defined by two files:

  • staker.crt
  • staker.key

In the default installation, they can be found in the working directory, specifically in ~/.ezcgo/staking/. All we need to do to recreate the node on another machine is to run a new installation with those same two files.

Backup

To back up your node, we need to store staker.crt and staker.key files somewhere safe and private, preferably to a different computer, to your private storage in the cloud, a USB stick or similar. Storing them to a couple of different, secure locations increases the safety.

Let's get the staker files off the machine running the node.

From Local Node​

If you're running the node locally, on your desktop computer, just navigate to where the files are and copy them somewhere safe.

On a default Linux installation, the path to them will be ~/.ezcgo/staking/. Select and copy the files from there to a backup location. You don't need to stop the node to do that.

From Remote Node on cloud or somewhere else​

If you're running the node on Cloud Server, or Physical Server, you need to login to your server via SSH, or using some remote copy tool like: scp or rsync to get staker cert and key file to local machine to backup

When you have means of remote login into the machine, you can copy the files over with the following command:

scp -r [email protected]:/home/ubuntu/.ezcgo/staking ~/ezchain_backup

This assumes the username on the remote machine is ubuntu, replace with correct username in both places if it is different. Also, replace PUBLICIP with the actual public IP of the remote machine.

Restore​

To restore your node from a backup, we need to do the reverse: restore staker.key and staker.crt from the backup to the working directory of the node

First, we need to do the usual installation of the node like the . This will create a new NodeID, which we need to replace. When the node is installed correctly, log into the machine where the node is running and stop it.

Then copy the backup cert from local machine to remote machine:

scp ~/ezchain_backup/staker.* [email protected]:/home/ubuntu/.ezcgo/staking

Finally, re-run the EZChain Node. And then check the nodeID with curl call API:

curl -X POST --data '{
   "jsonrpc":"2.0",
   "id"     :1,
   "method" :"info.getNodeID"
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info

All Done!

This website uses cookies to improve your web experience.