How to Bond Your REEF and Nominate a Reef Chain Validator Using The Reef.js Browser Extension

Derek E. Silva
Reef
Published in
14 min readMar 3, 2022

--

Following on from our previous instructions on how to bond and nominate validators on Reef Chain using the self-custodial Klever Wallet smartphone app, the Reef team would like to introduce you to a more advanced way to NPoS on Reef Chain using Reef’s very own reef.js browser extension on the Reef Console.

Reef.js is a browser extension that allows you to safely interact with the Reef Chain ecosystem without exposing the private keys. The extension includes, but is not limited to, the following features:

  • Creates / Adds accounts, storing the account secrets in your extension storage
  • Allows you to sign transactions for Reef and other Substrate networks
  • Allows application access to the signing capabilities of these accounts (you can accept / reject requests)
  • Binds Ethereum addresses and interacts with EVM smart contracts
  • Serve as a bridge between Ledger hardware wallets and the Reef ecosystem

The extension is currently supported on the following Reef-built apps:

It’s also supported by a growing number of third-party apps like ebox. It injects the accounts and allows signing of messages and transactions for a specific account, without making the account secrets / seed available to the calling app. It also allows you to manage your accounts, without storing it in the browser site-specific “localStorage”, for use on applications such as Reef Console. As of 3 March 2022, this extension only manages accounts and allows the signing of transactions with those accounts. It does not allow for full wallet capability.

The source for this extension is fully available, with the latest releases always matching up with the source repository available at https://github.com/reef-defi/browser-extension.

Reef.js is currently available on the Chromium-based browsers Google Chrome and Mozilla Firefox:

This guide will show you how to configure the extension, bond your REEF coins and nominate a validator using the Reef Console.

Requirements:

  • Google Chrome and/or Mozilla Firefox browser
  • Reef Chain REEF20 coins
  • A Reef chain wallet generated using Polkadot.js, Reef.js, or Klever Wallet

Bonding and Nominating Steps

For the purposes of this guide we will use Firefox, but the same steps also apply to Google Chrome.

1. Install Reef.js browser extension as explained in our previous Medium posts (Firefox here, Chrome here)

2. Once installed, it will be available in the toolbar to the right of the address bar within your browser; click on it and follow the initial welcome steps

3. Review and accept the Welcome message by clicking on Understood, let me continue

4a. You are now given two options: Create a new Substrate account or Import an existing account. If you wish to create a new account, select the “plus +” sign in the middle of the screen

4b. Please, ensure that you safely store the seed phrase that is generated for your new account as this will be the key to your funds. Confirm that you have saved your mnemonic seed safely and go to the Next step where you will be able to assign a name to your wallet and create a password as an extra security precaution (more on this below)

4c. The other available option to you is to import your existing wallet (e.g., Klever Wallet, polkadot.js). In order to do so, select the “plus +” button that you see on the top right-hand corner, within the extension, and select the option to Import account from pre-existing seed

4d. In the field Existing 12 or 24-word mnemonic seed, type in the mnemonic seed that belongs to your existing Reef Chain wallet (you can export it from the Klever Wallet app, for instance). The wallet address will be populated automatically. Note: select Reef Mainnet in the Network field

4e. Once you have entered your seed phrase and chosen Reef Mainnet, click on Next, add a descriptive name for your account (we will call it Klever Wallet) and create a brand new, unique password required for the extension as an additional security mechanism (more information is available in the “Additional Resources — Glossary” section below). Note: if you forget the password, you can “forget” and re-import the account again

5. Add the account with the supplied seed and you are ready to go. Now, visit the Reef Console at https://console.reefscan.com/#/accounts. If you successfully configured the extension, you will be prompted to accept the connection between reef.js and the Reef Console and grant the necessary permissions for the extension to work and interact with the Reef Chain. Please, note that this is only required once as the choice gets saved into your settings.

It is worth mentioning that only one Reef-related browser extension can be used at one time. For example, if you’re using a Polkadot.js extension with a Reef address and the Reef.js extension with another address, it won’t be possible to use both. Only one extension can be installed and enabled, but you can derive multiple addresses from a single account.

6a. Once access to the dApp is granted, you will see the following screen

It is very important and crucial to accept connections ONLY trusted dapps. Always be careful about which permissions are being provided, and to which dApp. Do not accept connections for every application, especially if you did not trigger the connection yourself.

6b. If a warning message is asking you to update the extension with the latest chain properties, you can do so by going to Settings — Metadata and clicking on Update metadata

6c. This update includes chain metadata and chain properties and it is necessary in order to display the correct information for the chain you are connected to. On the other hand, if you see the following message instead, it means your account was not created successfully and you will need to repeat the steps above again:

One or more extensions are detected in your browser, however no accounts have been injected. Ensure that the extension has accounts, some accounts are visible globally and available for this chain and that you gave the application permission to access accounts from the extension to use them.

7. Now that you have created and connected your account to the Reef Console, and you have transferred your REEF coins to your Reef Chain wallet address available in the reef.js browser extension (i.e., the address starting with digit 5xxx…), go to https://console.reefscan.com/#/staking/actions to bond your coins, then click on “+ Stash”. Use the Account actions to create a new validator / nominator stash and bond it to participate in the NPoS. Do not send funds directly to a validator with a transfer. For the purpose of this documentation, we will bond 1000 REEF coins from the available balance in our wallet (a transfer of coins was already made prior to creating this guide)

Note: for additional information on Stash and Controller accounts, bonding and staking terminology, meaning and available list of extrinsics, and security of the accounts, please scroll down to “Additional Resources — Glossary”. In this guide, we are going to use one account that will serve as both Stash and Controller accounts.

8. When bonding, you have the option to choose where to receive your staking rewards, once paid, by selecting one of the options below. Choose whatever payment destination that makes sense to you. If you’re unsure, you can choose “ Stash account (increase the amount at stake)” to simply accrue the rewards into the amount you’re staking and earn compound interest

9. When ready, click on Bond, decide whether to tip the block author for a faster transaction and click on Sign and Submit

10. Confirm the transaction by entering the password you previously created

11. Sign the transaction and you are done! The following notifications will tell you if the bonding process was successful

12a. We have just bonded 1000 REEF. Now, we need to nominate a validator. Click on Nominate next to the Session Key link, from the Account actions tab. We are going to randomly pick a Validator from the list of validators / candidate accounts that is given to us. For the purposes of this demonstration we will pick JELLY with address 5HSrLv1WnK38v3VLEQFSi67rUfBaLjR47imeTJ9WVyK6ompE, however you should select the Validator you prefer.

12b. On this note, we would like to inform you that members of the Reef Community have recently created and launched the “Reef Chain NPoS — Staking Rewards Calculator”, available at https://reefaq.io/en/staking-calculator, that you can use in order to find the best validator for your bond. The “Reef Chain NPoS — Staking Rewards Calculator” is a community driven project supported and funded by Reef community members. We accept no liability, whether direct or indirect, for any consequential loss of funds, profit, or revenue. You are strongly encouraged to DYOR and take responsibility for your actions. If you have any questions, feel free to reach out to a Reef staff member for further assistance.

13. Once you have chosen your validator(s), click on Nominate, decide whether to tip the block author for a faster transaction and click on Sign and Submit

14. Confirm the transaction by entering the password you previously created

Congratulations! You have just created your account, bonded your coins and nominated your validator on the Reef Chain via NPoS. The following notifications will be displayed if the nomination process was successfully completed

Note: you can stop your nomination at any time by clicking on the Stop button, as well as access additional functions by clicking on the toggle menu beside the Stop button, as follows

Your account, at https://console.reefscan.com/#/accounts, will now display your total balance, your transferable balance, your locked and bonded number of coins. You will find your daily rewards on https://reefscan.com/ after two (2) eras, which is roughly two days after the nominating process is completed. For additional information on account balance, please go to “Additional Resources — Glossary”

Additional Resources — Glossary

Account

An account is identified by its public address on the network. It is totally fine to give away this address, this is also the only information needed to receive funds. The network will not know about the name you give to this account in this application.

Balance

The balance for each account is broken down into a number of areas, giving an overview of the total, transferable and bonded funds as well as the funds currently being unbonded or redeemable. These are:

Total: the overall amount of funds in the account; it includes the vested balance, available for transfer and locked

Available: the funds that can be transferred or bonded; i.e., the funds that are available for any transaction

Bonded: the funds bonded for validating or nominating. They are locked and cannot be transferred, although they can be unlocked for future actions

Redeemable: the funds that can be redeemed; e.g., made available for withdrawal, by clicking on the “lock” icon

Unbonding: the funds that are being unbonded. The funds will be redeemable after the bonding period has passed. These funds can still be slashed. The information icon tells you the number of blocks left before the funds can be redeemed

Account Recovery

You can recover an account in two ways:

Seed or mnemonic: click on the “Add account” button, type your seed or mnemonic in the associated field.

Backup file (also called JSON keystore file) and the account password: click on the “Restore JSON” button, upload your backup file and enter the password associated.

Minimum Account Balances — Essential Deposit & Reaping

Accounts with a balance lower than the minimal amount (a.k.a. existential deposit) will be reaped (e.g., all remaining funds lost, and the account state removed from the network). Accounts with under 1 REEF are considered as non-existent on the network. If an account balance drops below this amount, it is removed from the network state. On the Reef Console, this account will still be visible but with a balance of 0 REEF.

For a fund transfer to a new account (balance of 0), if the amount transferred is less than the minimum allowed balance, then the transfer will “succeed” but the destination account will not be created (its balance will remain 0); this essentially burns the transfer balance from the sender because the receiver balance never exceeds the minimum allowed balance. Note that the new account could be a previously active account, but as a reaped account with a balance of 0 REEF before the transfer. On the other hand, a transfer higher than the existential deposit amount will succeed as expected and create a new account with the same address. Note that if the receiver already exists (i.e., a balance greater than 0), it is also possible to transfer very low amounts.

Contacts

You can store and get quick access to the most commonly used addresses, such as friends’ accounts. Any contact that you create on the Reef Console will be reflected in the dApp. You can edit the name of a contact by clicking on it. To remove a contact from the list, click on the trash icon in order to “forget” it.

Extrinsics

An extrinsic states changes that come from the outside world, i.e., they are not part of the system itself. Extrinsics can take two forms, “inherents” and “transactions”. Read more here: https://wiki.polkadot.network/docs/glossary#extrinsic. A full list of available extrinsics can be found here: https://polkadot.js.org/docs/substrate/extrinsics/ (specifically here: https://polkadot.js.org/docs/substrate/extrinsics#staking)

Staking

On the Reef Console, you have a complete overview of all the validators on the network and you can participate in the network either as a validator (i.e., running a node that helps secure the network), or as a nominator (i.e., adding funds to help secure the network, NPoS). Validators and nominators earn rewards at the end of each era. The rewards are split between the validators and its nominators, in proportion to the amount bonded.

Bonding

Bonding funds is the first step to validate or nominate. It locks up a portion of funds that is used to secure the network. These funds are placed at your own risk; i.e., you can be slashed and lose a portion if the validator node misbehaves. Validators and nominators share both rewards as well as the slashing effects. Choosing a “behaving” validator to nominate is crucial.

In order to bond, you need to have 2 accounts:

Stash account: this is the primary account that holds the funds and has a portion bonded for the NPoS

Controller account: this is used to control the operations of the validator or nominator; e.g., switching between validating, nominating and idle. Note that this account only needs enough funds to send transactions when actions are taken.

To bond, you select the Stash account, bond from it and designate a Controller. Additionally, you can select the amount of funds to bond and set your payout preferences. Having two different accounts is optional, not mandatory.

Nominating

Nomination is a process of selecting a number of validators (or potential validators) that you deem trustworthy. Once the validators are selected, the bonded value is assigned to participate in the network security. You can stop nominating at any point in time, using the controller account. You can also bond more funds using the Stash account.

Validating

Validators run nodes that create (author) blocks. The primary requirement here is the ability to run a node that is available 24/7 and is well-connected to the network. In addition to the Stash and Controller accounts described above, a validator has to indicate an additional account called Session Key.

Session Key account: the seed of this account should be passed to the node using the — key parameter. The Session Key account does not need to have funds as it does not need to send any transaction. The best practice is to create a dedicated account to be used as Session Key account. Although, a single account can theoretically be used as both Session Key and Controller, it is not recommended to do so. Having a dedicated Session Key account would prevent the theft of funds, should the validator node be compromised and the — key leaked. As with the nomination operations, you can stop validation at any time using the Controller account (e.g., be it for maintenance, upgrades, or for any other reasons).

Security

The public address is generated from a private key, itself generated from a seed or a mnemonic phrase. The seed or the mnemonic phrase should never be shared with anybody as they give access to your funds. It must be stored securely. The password needed to create an account is used to encrypt your private key, but only on the device you’re using at the time. Importing the wallet passphrase to another wallet application or device allows you to set a different password or security mechanism for that wallet application. The password is device and wallet application specific. You must choose a strong and unique password. This password is also used to encrypt the private key in the backup file downloaded upon account creation. Thanks to this, file together with your account password, you can recover your account.

Cryptography

Substrate and Polkadot use Schnorrkel/Ristretto x25519 (“sr25519”) as its key derivation and signing algorithm. Sr25519 is based on the same underlying Curve25519 as its EdDSA counterpart, Ed25519. However, it uses Schnorr signatures instead of the EdDSA scheme. Schnorr signatures bring some noticeable benefits over the ECDSA/EdDSA schemes. For one, it is more efficient and still retains the same feature set and security assumptions. Additionally, it allows for native multi-signature through signature aggregation. Note: If you wish to validate, the Session Key account needs to use “Ed25519” cryptography.

--

--

Derek E. Silva
Reef

Community & developer relations professional.