Using BLS
1. Download version 3.0.X validator client
Check the current Node.js version to ensure that the node version is equal to or greater than v16.0.0.
node -v
If the Node.js version does not meet the requirement, it is recommended to use nvm (Node Version Manager) to switch to a different Node.js version.
nvm use 16
Once you have verified that the current Node.js version meets the requirements, proceed to execute the following command to install the latest version of the client:
npm install @rei-network/cli@3 -g
Eg:
node -v
v14.19.3
nvm use 16
node -v
v16.18.0
npm install @rei-network/cli@3 -g
After the installation is completed, execute the following command to check the version number and confirm if the installation was successful:
rei --version
Eg:
[root@rei-testnet-validators rei-cli] rei --version
3.0.1
2. Generate bls keystore
Use the following command and enter the password according to the prompt to complete the generation of bls keystore.
rei bls new --datadir <path>
note:
This command will create a new bls directory under the specified path, and generate a keystore file in the bls directory.
The specified path is recommended to be the original validator datadir (or migrate the generated bls directory to the original validator datadir), otherwise it will affect the unlocking of the bls private key after rei-dao hardfork.
Please keep the password safe, otherwise bls keystore will not be able to unlock the bls private key.
Eg:
[root@rei-testnet-validators rei-cli] rei bls new --datadir ~/node
Your new bls secrect keyfile is locked with a password. Please give a password. Do not forget this password.
? Password: [hidden]
? Repeat password: [hidden]
Your new key was generated
Public key: 0xa91f44ef2da6a839fbad9654615f017f98d2c5b189cd87e062fbec7c9188a4f951425c5e4e4e1547e91afdc53c2399df
Path of the secret key file: /root/node/bls/UTC--2023-06-27T19-06-09.134Z--0xa91f44ef2da6a839fbad9654615f017f98d2c5b189cd87e062fbec7c9188a4f951425c5e4e4e1547e91afdc53c2399df.json
If you have not registered the BLS public key, please go to https://dao.rei.network to register.
- You can share your publickey with anyone. Others need it to interact with you.
- You must NEVER share the secret key with anyone! The key controls access to your block signature!
- You must BACKUP your key file! Without the key, it's impossible to access block signature!
- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!
From the above information, we can know that the path of the bls keystore file generated in this example is:
/root/node/bls/UTC--2023-06-27T19-06-09.134Z--0xa91f44ef2da6a839fbad9654615f017f98d2c5b189cd87e062fbec7c9188a4f951425c5e4e4e1547e91afdc53c2399df.json
3. Obtain bls publicKey
First, let's enter the directory where the bls keystore file is located
cd ~/datadir/bls
Check the file list to get the name of the bls keystore file we generated
ls
Eg:
[root@rei-testnet-validators rei-cli] cd ~/node/bls
[root@rei-testnet-validators bls] ls
UTC--2023-06-27T19-06-09.134Z--0xa91f44ef2da6a839fbad9654615f017f98d2c5b189cd87e062fbec7c9188a4f951425c5e4e4e1547e91afdc53c2399df.json
Check out the bls keystore file
cat UTC--2023-06-26T19-43-41.889Z--0x8dbfbd24c6e56fbe57cdb5f131e8b255ac7120be6a731b915050530d58fd0d4aba99e4c8cf9541c3b21645bf59272920.json
The displayed data is as follows, where the publicKey is the bls public key we need
{
"encryptedSecretKey": "315160b845d2daedc0d857a9cc289a1bffe448b17366cca6af3fac480204522a",
"iv": "2cf770d6eff32c40c6d805361038f391",
"publicKey": "0x8dbfbd24c6e56fbe57cdb5f131e8b255ac7120be6a731b915050530d58fd0d4aba99e4c8cf9541c3b21645bf59272920"
}
4. Register the bls public key to the chain and check whether the registration is successful
Regarding the bls registration contract, its abi is as follows:
interface IValidatorBLS {
function setBLSPublicKey(bytes calldata key) external;
function getBLSPublicKey(address) external view returns (bytes memory);
function isRegistered(address) external view returns (bool);
function isBLSPublicKeyExist(bytes calldata) external view returns (bool);
}
Functions
setBLSPublicKey : register bls public key
Declaration
function setBLSPublicKey(bytes memory key) external
Args
key
bytes
bls public key
getBLSPublicKey : Query bls public key
Declaration
function getBLSPublicKey(address) external view returns (bytes memory)
Args
address
address
validator address
isRegistered : Query whether the address register bls public key
Declaration
function isRegistered(address) external view returns (bool)
address
address
validator address
isBLSPublicKeyExist : Query whether bls public key is registered
Declaration
function isBLSPublicKeyExist(bytes memory) external view returns (bool)
key
bytes
bls public key
For developers, you can call the setBLSPublicKey method of the validatorBLS contract to register the bls public key to the chain
note:
Before rei-dao fork, the contract address is
0x5b84072EE3e72a58A906FA15182beEdaB5298076
, after rei-dao fork, the contract address is0x0000000000000000000000000000000001009
After the registration is complete, you can call the isRegistered method to check whether the registration is successful or call the getBLSPublicKey method to check whether the bls public key is consistent with the registered one
For general users, you can register bls public key to the chain through REI DAO The steps are as follows:
Step1: Navigate to https://dao.rei.network/#/myAccount/portfolio
Step2: Click on Register BLS public key
button, enter the BLS public key
to Register

Please note that it may take 1 to 2 minutes for the registration record to be updated here after registering with the BLS public key.

Last updated