Join Amber as a Validator
This document introduces how to join the amber as a validator node.
Before you start, you must have a trusted server running bitcoincashnode's client with RPC enabled. The executable smartbchd will connect to it for querying staking information.

1. build the binary

Running the step 0, 1, 2, 3 of this document.
Then clone the source code of smartBCH and build the executable of smartbchd.
1
cd ~/smart_bch
2
git clone -b v0.4.2 --depth 1 https://github.com/smartbch/smartbch
3
cd smartbch
4
go build -tags "params_amber cppbtree" github.com/smartbch/smartbch/cmd/smartbchd
Copied!
After successfully executing the above commands, you'll get a ~/smart_bch/smartbch/smartbchd file for amber.

2. prepare the working directory

1
cp ~/smart_bch/smartbch/smartbchd ~/build/smartbchd
2
cd ~
3
rm -rf .smartbchd
4
~/build/smartbchd init mynode --chain-id 0x2711
5
wget https://github.com/smartbch/artifacts/releases/download/v0.0.5/dot.smartbchd.tgz
6
tar zxvf dot.smartbchd.tgz
7
cp -rf dot.smartbchd/* .smartbchd/
Copied!

3. Prepare the validator keys

Running step 1 and step 2 of this doc to generate validator key and consensus pubkey.
Then, copy the priv_validator_key.json to work directory by running command below:
1
cp ./priv_validator_key.json ~/.smartbchd/config/
Copied!

4. Modify App config

Open the ~/.smartbchd/config/app.toml file to modify the information of the bitcoincashnode's client with RPC enabled.
1
# BCH mainnet rpc url
2
mainnet-rpc-url = "http://ip-address:8332"
3
​
4
# BCH mainnet rpc username
5
mainnet-rpc-username = "<my user name>"
6
​
7
# BCH mainnet rpc password
8
mainnet-rpc-password = "<my password>"
Copied!

5. start smartbchd

1
cd ~/build
2
~/build/smartbchd start --mainnet-genesis-height=602983
Copied!

6. Build createValidator Tx

Using validator private key and consensus pubkey generated in step 3 to build command below:
1
./smartbchd staking \
2
--validator-key=<your validator private key> \
3
--staking-coin=1 \
4
--consensus-pubkey=<your consensus pub key> \
5
--introduction=<your validator introduction> \
6
--type=create \
7
--nonce=0 \
8
--gas-price=10000000000 \
9
--chain-id=0x2711
Copied!
This command generate createValidator tx raw data, send it in step 8 below.

7. Get some BCH to Send Tx

Get some BCH from some one has BCH in smartBCH already to your validator account. To check your account balance like this.
1
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["<your validator account address>","latest"],"id":1}' -H "Content-Type: application/json" http://127.0.0.1:8545
Copied!

8. Send Tx to smartBCH Amber

Please follow step 1, 2 of this doc.

9. Vote your consensus pubkey in Amber Xhedge Contract

Please go to https://amber.xhedge.cash/ to split your BCH to LeverNFT and HedgeNFT, and vote for your validator just created.
Copy link
Contents