shortname: BEP-21
name: Dynamically add/update/remove validators at runtime
type: Standard
Status: Draft
editor: Vanshdeep Singh <vanshdeep@bigchaindb.com>
The original BEP-3 spec for adding new validators required that the node administrators coordinate when dynamically adding a new validator i.e. all the node operators have to simultaneously execute upsert-validator in order to ensure that the validator is added on all the nodes. A lack of coordination can result in a situation wherein only a part of the network updates their validator set which could eventually lead to a network hangup. Furthermore, for a sufficiently large network the coordination itself can become a tedious task.
Another major issue with the current implementation is that a new dynamically added validator (V_i) cannot be propagated to any new dynamically added validators added after V_i i.e. consider the following scenario,
- Given a 4 node network wherein the
genesis.jsonfile contains each of the four nodes{N1,N2,N3,N4}a validator. - When a new node
N5is to be dynamically added, each node executesupsert-validatoron their respective nodes (includingN5) and addsN5. - When another new node
N6needs to be added then each of the nodes in the network{N1,N2,N3,N4,N5}executeupsert-validatorto add the new nodeN6. - At this point the node
N6won't seeN5as a validator because thegenesis.jsonwould only contain{N1,N2,N3,N4}as validators. - Since
N5was added dynamically andupsert-validatoronly mutates the local validator set of a given node it implies that in order for theN6to seeN5as a validator it would have to executeupsert-validator N5_PUB_KEY N5_POWERon its own node at the exact block height (when syncing with the network) whenN5was previously added by the network.
From the above description it is evident that propagating dynamically added validators is a major hassle with huge possibility of errors.
To solve the aforementioned issue, the following change to the behaviour of upsert-validator is being proposed. We use the transaction election process (TEP) proposed in BEP 18 to automate and synchronize the operation on the validator set.
Consider a network of 4 nodes {A,B,C,D}. If a node A wishes to add a new node E to the network then following steps should be followed,
-
Node
Aexecutes$ bigchaindb election new upsert-validator E_PUBKEY E_POWER E_NODE_ID --private-key /home/user/.tendermint/config/priv_validator.json [SUCCESS] Submitted proposal with id: <election_id>
The above command POSTs a VALIDATOR_ELECTION transaction and returns the election_id.
NOTE:
- The
VALIDATOR_ELECTIONtransaction is signed with the private key of the validator proposing the election. The private key is generated by Tendermint, and stored in thepriv_validator.jsonin the Tendermint's$TMHOMEdirectory (usually located at~/.tendermint/). E_POWERshould be such that0 < E_POWER < TOTAL_POWER/3whereTOTAL_POWERdenotes the total voting power of the current network.E_NODE_IDcan be generated by executingtendermint show_node_idin the shell of the node
-
The
election_idis then manually sent (via email or message) to all members of the network. -
The node operator can list the contents of
election_idrequest usingbigchaindb election show ...,$ bigchaindb election show <election_id> public_key=Wn2DedV9OA0LJJjOxr7Sl7jqCSYjQihA6dCBX+iHaEI= power=10 node_id=82190eb6396bdd80b83aef0f931d0f45738ed075 status=ONGOING -
If the node operator aggrees to the operation being proposed by the
election_idthen they can vote on the same using the following,$ bigchaindb election approve <election_id> --private-key /home/user/.tendermint/config/priv_validator.json
The above command POSTs a VOTE transaction casting the vote of the node for given election_id.
NOTE: The VOTE transaction is signed using the private key generated and stored by Tendermint in priv_validator.json.
Two new transaction ("operation") types are proposed, namely VALIDATOR_ELECTION and VOTE. The VALIDATOR_ELECTION transaction is an extension of theCREATE transaction and VOTE is an extension of TRANSFER. A VALIDATOR_ELECTION transaction must satisfy all the constraints that a CREATE transaction must satisfy, plus some additional ones (e.g. its own JSON Schema). A VOTE transaction must satisfy all the constraints that a TRANSFER transaction must satisfy, plus some additional ones (e.g. its own JSON Schema).
Note: At the time of writing, all BigchainDB JSON Schema files (YAML files) could be found in the bigchaindb/common/schema/ directory of the bigchaindb/bigchaindb repository on GitHub.
A valid VALIDATOR_ELECTION is one where the total change to validator set power is < 1/3 CURRENT_POWER.
A validator can choose to vote/delegate/burn their vote. It is purely up to a voter to decide how to spend their vote.
Election conclusion is inherited from TEP definition. Note that this BEP is aimed at implementing only constrained approach.
The approach suggested in this specification is entirely different. The previous approach involved storing upsert-validator request in a seperate collection, which will not be required anymore. So migrating to the implementation of this new approach would involve to optionally drop collection holding the upsert-validator request.
- @kansi
- @ldmberman
- @z-bowen
BigchainDB 2.0.0b6

To the extent possible under law, all contributors to this BEP
have waived all copyright and related or neighboring rights to this BEP.