Validator DApp

The Validator DApp provides an interface to manage the validator set of nodes. To manage this set, it is possible to add and remove nodes. To identify nodes, the account address is used.

Prerequisites

Note

MetaMask is having issues running on Firefox. This bug was reported back in August 2018 and we’re awaiting a fix. Until then please use Chrome.

Start the DApp

There are two options to get the DApp up and running:

Option 1: Docker image (fastest)

To get the DApp up and running quickly, you can directly tap into our Clearmatics image with

docker run -d -p 3000:3000 --name validator-dapp clearmatics/validator-dapp:latest

You can now find the DApp at http://localhost:3000/ in your browser.

If you would like to run several DApps in parallel, please change the first port number to avoid collisions, e.g. if you would like the Validator to show up on http://localhost:3001 you run same command as above but -p 3001:3000.

Option 2: From source

First, clone the Validator DApp repository with your terminal

git clone git@github.com:clearmatics/validator-dapp.git

Please write the following in your terminal before you proceed

cd validator-dapp

To build it locally, you need to install the dependencies first with

npm install

As long as the terminal doesn’t display any error messages, you can now proceed with starting the app by writing

npm start

This should automatically open a tab in your Chrome browser which shows the user interface. If this is not the case, you can see it at http://localhost:3000/.

Does it work?

When the page has finished loading, you should see the user interface. In the user interface, you can see a list of current validators.

../_images/validator.png

Perhaps you have noticed that pressing the buttons does not seem to have any effect. That is because MetaMask refuses connection from any invalid address. If your address is not part of the validator set, you will not be able to add or remove an address. Access is allowed if you can demonstrate that your account has a private key which belongs to any of the addresses in the list.

Note

To add a new validator or remove an existing one, you need to have a private key that corresponds to an address in the validator set

Note

It is not possible to add an existing address since each validator has to be a different node

Import a private key

To be a validator, you need to prove it to the network and this is where your private key comes into play. It is assumed that you know the private key to at least one of the validators. To import it please follow these three steps:

Firstly, you need to open MetaMask and press the account icon, in the upper right corner of the dropdown menu:

../_images/import-privkey-step1.png

Now you need to press Import Account.

../_images/import-privkey-step2.png

Finally, you need to paste your private key in the field and press Import.

../_images/import-privkey-step3.png

If the account loads correctly you should be good to go. You can try that your account is authenticated by attempting to remove a validator. By pressing Remove, you should see a popup window from MetaMask asking you to confirm your transaction. If you see this window, that means that the connection was successfully authenticated.

../_images/metamask-tx.png

When you do want to perform an actual change in the permissioning, you need to press Confirm to propagate your submission to the network.

Node management verification

Apart from the ability to display the current set of validators (or observers) through the user interface, we can verify it by network logs. In this example, we have filtered for any changes in the validator set. Before we make any changes to the permissioning, we have 7 validators and the full set can seen in the logs as follows:

DEBUG[05-02|15:26:49.308|consensus/istanbul/core/core.go:259]  New round  address=0xb494F71B4b792BB043cd4D5Fc51A5FD54a84abDF old_round=0  old_seq=4098161 old_proposer=0x33b99aa299AaE4dc67a0690Fc3F55474Ce49cD7f new_round=0 new_seq=4098162 new_proposer=0x69515E02c02D9D38C8d3421a395C0AD06F233d8c
valSet="[0x33b99aa299AaE4dc67a0690Fc3F55474Ce49cD7f 0x49244BC7883522683b2355Cb3Eaed07234B546a4 0x5a1c5288A5AcfC471A1f6c44D24886f75Ea3D54a 0x69515E02c02D9D38C8d3421a395C0AD06F233d8c 0xa87408eBf1b5A4d65c8754d0BD43EcDdaFC7D1f1 0xb494F71B4b792BB043cd4D5Fc51A5FD54a84abDF 0xb92276AF73BD16c85Ea1d1d680d7786765baC9eb]"
size=7  isProposer=false

After we have issued a request to remove the second validator through the DApp interface, we can see that the validator set has changed (and its size):

DEBUG[05-02|15:26:50.285|consensus/istanbul/core/core.go:259]  New round  address=0xb494F71B4b792BB043cd4D5Fc51A5FD54a84abDF old_round=0  old_seq=4098162 old_proposer=0x33b99aa299AaE4dc67a0690Fc3F55474Ce49cD7f new_round=0 new_seq=4098163 new_proposer=0xa87408eBf1b5A4d65c8754d0BD43EcDdaFC7D1f1
valSet="[0x33b99aa299AaE4dc67a0690Fc3F55474Ce49cD7f 0x5a1c5288A5AcfC471A1f6c44D24886f75Ea3D54a 0x69515E02c02D9D38C8d3421a395C0AD06F233d8c 0xa87408eBf1b5A4d65c8754d0BD43EcDdaFC7D1f1 0xb494F71B4b792BB043cd4D5Fc51A5FD54a84abDF 0xb92276AF73BD16c85Ea1d1d680d7786765baC9eb]"
size=6  isProposer=false

Finally, we add the same validator back to return to our initial state:

DEBUG[05-02|15:27:07.121|consensus/istanbul/core/core.go:259]  New round  address=0xb494F71B4b792BB043cd4D5Fc51A5FD54a84abDF old_round=0  old_seq=4098179 old_proposer=0x33b99aa299AaE4dc67a0690Fc3F55474Ce49cD7f new_round=0 new_seq=4098180 new_proposer=0x69515E02c02D9D38C8d3421a395C0AD06F233d8c
valSet="[0x33b99aa299AaE4dc67a0690Fc3F55474Ce49cD7f 0x49244BC7883522683b2355Cb3Eaed07234B546a4 0x5a1c5288A5AcfC471A1f6c44D24886f75Ea3D54a 0x69515E02c02D9D38C8d3421a395C0AD06F233d8c 0xa87408eBf1b5A4d65c8754d0BD43EcDdaFC7D1f1 0xb494F71B4b792BB043cd4D5Fc51A5FD54a84abDF 0xb92276AF73BD16c85Ea1d1d680d7786765baC9eb]"
size=7 isProposer=false

Next steps

That’s it. Since the contracts are pre-deployed as part of the Autonity client, you should now be able to adjust the network permissioning. If your MetaMask is properly set up and your account has sufficient funds, you should be able to fully interact with the validation mechanism.

For further information about managing the deployed validator contract please visit Soma.