Skip to content

Commit

Permalink
Update runmultinode.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wangkui0508 committed May 27, 2021
1 parent 7ab3fc9 commit bb4cb46
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions developers-guide/runmultinode.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ This document shows how to start a testnet of smartBCH with multiple nodes.

We suggest to use ubuntu 20.04.

In these nodes, just pick one to generate the genesis file. And all the other nodes do not generate the genesis file, instead, they use the generated genesis file as is.
Among these nodes, just pick one to generate the genesis file. And all the other nodes do not generate the genesis file, instead, they use the generated genesis file as is.

### 1. On the nodes which do not generate the genesis file

#### Step 0: Prepare

Follow the instructions in [running a single-node testnet](./runsinglenode.md), and Just finish the steps 0, 1, 2, 3 and 4 described in it.
Follow the instructions in [running a single-node testnet](./runsinglenode.md), and just finish the steps 0, 1, 2, 3 and 4 described in it.



Expand Down Expand Up @@ -51,7 +51,7 @@ The output hex string is consensus pubkey which will be used in `generate-genesi
7b2241646472657373223a5b3136362c3234382c3230392c39312c32342c3137382c3138352c36302c3139312c3132372c3137342c32352c33332c3133322c3230342c3231372c3232342c35392c3235302c3234345d2c225075626b6579223a5b3136302c3132302c3131332c3230392c382c38382c32332c3135362c32372c3137392c3139332c3234302c3231352c3138362c3137392c31372c332c31392c39312c3131382c3234392c3130372c3130372c3230392c3234302c3130362c39312c3139322c3231312c38302c3234382c39385d2c22526577617264546f223a5b3136362c3234382c3230392c39312c32342c3137382c3138352c36302c3139312c3132372c3137342c32352c33332c3133322c3230342c3231372c3232342c35392c3235302c3234345d2c22566f74696e67506f776572223a312c22496e74726f64756374696f6e223a2268617070796d616e222c225374616b6564436f696e73223a5b302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c302c305d2c2249735265746972696e67223a66616c73657d
```

The `validator-address` uses the one we get at step 1, and the `consensus-pubkey` is the one we get at step 2.
The `validator-address` is the one we get at step 1, and the `consensus-pubkey` is the one we get at step 2.

The output hex string contains the information of a validator. Send the this hex string to the node who is genesis-generator.

Expand All @@ -70,7 +70,7 @@ tar zxvf dot.smartbchd.tgz
cp -rf dot.smartbchd/* .smartbchd/
```

The balance number and the test-keys are not importance, because these information will be overwritten by the genesis.json file in the `dot.smartbchd` directory.
In the `./smartbchd init` command, the balance number and the test-keys are not importance, because these information will be overwritten by the genesis.json file coming from the `dot.smartbchd` directory.



Expand All @@ -92,27 +92,19 @@ Now start the node:

#### Step 6: activate validator

before you activate your genesis validator, try to get testnet BCH in your validator address, it need at least
Before you activate your genesis validator, try to get testnet BCH in your validator address, it needs at least

```
1000000000000000000000 bch
```

you can connect smartBCH team to get testnet bch, you can check your balance with below command:

replace `your_validator_address` with your genesis validator address
You can ask the genesis-generator to send you some testnet BCH. And you can check your balance with below command (Replace `your_validator_address` with your genesis validator address):

```
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["your_validator_address","latest"],"id":1}' -H "Content-Type: application/json" http://localhost:8545
```

After you have enough bch, you can follow below:

replace the `--validator-key` with your validator private key

repace the `--staking-coin` with `1000000000000000000000` or even more you have.

⚠️Keep your private key safe, and execute this command on a secure, offline machine
After you have enough bch, you can run the following command:

```
./build/smartbchd staking \
Expand All @@ -122,23 +114,23 @@ repace the `--staking-coin` with `1000000000000000000000` or even more you have.
--chain-id=0x2711
```

replace `--your_tx_data` with what hex string get above.
Note: replace the content after `--validator-key` with your validator private key, and repace the content after `--staking-coin` with `1000000000000000000000` or even more you have.

⚠️Keep your private key safe, and execute this command on a secure, offline machine

Then broadcast the transaction (replace `--your_tx_data` with what hex string get above):

```
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["you_tx_data"],"id":1}' -H "Content-Type: application/json" http://localhost:8545
```

now, you had send a editValidator tx to staking contract,check the tx receipt

replace `your_tx_hash` with what the hex string you get above.
Now, you had send an `editValidator` transaction to staking contract. Check this transaction's receipt (replace `your_tx_hash` with what the hex string you get above):

```
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["your_tx_has"],"id":1}' -H "Content-Type: application/json" http://localhost:8545
```

if the `status` displays `0x1`, congratulations, your genesis validator actived now.


If the `status` is `0x1`, congratulations, your genesis validator is activated now.



Expand All @@ -152,7 +144,7 @@ Just finish the steps 0-9 as [running a single-node testnet](./runsinglenode.md)

#### Step 1: add genesis validator info to genesis.json using hex strings sent by other nodes

Using `./build/smartbchd add-genesis-validator` multiple times, one time with one hex string sent by one node. Finally we'll get all the validators' information in the genesis.json file.h
Using `./build/smartbchd add-genesis-validator` multiple times, one time with one hex string sent by one node. Finally you'll include all the validators' information in the genesis.json file.

Then, make a copy of the `~/.smartbchd` directory, excluding the `node_key.json` file.

Expand Down

0 comments on commit bb4cb46

Please sign in to comment.