Node
Become An GEMNODE Node
Adding Subnet Validator
The newly created Subnet requires validators to validate the transactions on the Subnet's every blockchain. Now we will write the code in addSubnetValidator.js
to add validators to the Subnet. Only transactions signed by the threshold (here 1) number of Subnet owners will be accepted to add validators. The Subnet owners which will sign this transaction is passed as the subnetAuth
parameter. It is an array of indices, representing the Subnet owners from the array of addresses that we passed earlier in the createSubnetTx()
.
The arguments for the AvalancheJS API call for buildAddSubnetValidatorTx()
is explained with the help of comments. All the transaction calls of AvalancheJS starting with build
will return an unsigned transaction. We then have to sign it with our key chain and issue the signed transaction to the network.
We have to pass command-line arguments like nodeID
, startTime
, endTime
, weight
and subnetID
while calling the command. If we do not pass any nodeID, then by default it will use ID corresponding to the URI in the config.js
by calling the info.getNodeID()
API from AvalancheJS. Similarly, the default weight will be 20, if not passed. You can run this program now with the following command.
We will keep the start time 5 minutes later than the current time. This $(date -v +5M +%s)
will help to achieve the same. But you can put any timestamp in seconds there, given it is 20s later than the current time.
Whitelisting Subnet from the Nodeβ
Subnet owners can add any node to their Subnet. That doesn't mean the nodes start validating their Subnet without any consent. If a node wants to validate the newly added Subnet, then it must restart its avalanchego
binary with the new Subnet being whitelisted.
Once the node has restarted, it will again be re-assigned to a random API port. We have to update the config.js
file with the new port.
Last updated