Improve docs

Only one node needs to addnode the other, which makes things less complicated to explain
This commit is contained in:
Duke Leto 2022-09-29 15:49:27 +00:00
parent bd1df6a063
commit 5686287445

24
docs.md
View File

@ -63,16 +63,16 @@ h the ticker symbol `LULZ`, `55555` pre-mined coins, and a block reward of `.000
On your first node, change into the directory where Hush's `hushd` and `hush-cli` are installed and execute the following commands in the terminal:
```bash
./hush-smart-chain -ac_name=LULZ -ac_supply=55555 -addnode=<IP address of the second node> &
./hush-smart-chain -ac_name=LULZ -ac_supply=55555 &
```
To create a Hush Smart Chain with z2z (shielded transactions only) you add the `-ac_private=1` param:
```bash
./hush-smart-chain -ac_name=LULZ -ac_private=1 -ac_supply=55555 -addnode=<IP address of the second node> &
./hush-smart-chain -ac_name=LULZ -ac_private=1 -ac_supply=55555 &
```
Remember to use the exact same parameters on both nodes, or they will not be able to connect to each other, because they will be different, incompatible blockchains. All parameters must match exactly for the same RPC port and other details to match.
Remember to use the exact same parameters on both nodes, or they will not be able to connect to each other, because they will be different, incompatible blockchains. All parameters that start with `-ac_` must match exactly for the same RPC port and other details to match.
**For other -ac_ parameters to use with your Hush Smart Chain, refer to [hsc-options-explained.md](hsc-options-explained.md).**
@ -95,26 +95,28 @@ This completes the first half of the Smart Chain creation process.
On the second node you issue the same command, but with a key difference. This time, use the first node's IP address.
```bash
./hush-smart-chain -ac_name=LULZ -ac_supply=55555 -addnode=<IP address of the first node> &
./hush-smart-chain -ac_name=LULZ -ac_supply=55555 -gen -genproclimit=1 -addnode=1.2.3.4 &
```
where you replace `1.2.3.4` with the IP of your first node.
Once the daemon loads, compare the string that starts with `>>>>>>>>>>` in the second node to the one from the first node to make sure they are identical.
Mining can be started on a node using the following command:
The arguments `-gen -genproclimit=1` enables mining on this node with 1 CPU thread. The genesis block should be mined with 1 thread to avoid issues. Once the genesis block (genblock) is mined, you can increase the number of CPU threads it uses with:
```bash
./hush-cli -ac_name=LULZ setgenerate true $(nproc)
./hush-cli -ac_name=LULZ setgenerate true 1
```
`$(nproc)` in the above command makes the daemon mine using all the available CPU threads, which might be necessary in a low end VPS.
to mine with 2 CPU threads. Mining with too many threads will likely degrade performance of your VPS, make sure to leave at least 1 CPU thread not mining, so the operating system and other processes have resources.
On a Hush-based blockchain, all of the pre-mined coins are mined in the first block. Therefore, whichever machine executes the mining command will receive the entirety of the blockchain's pre-mined coin supply, as set in the `ac_supply` parameter. Upon mining the first block, these coins are available in the default `wallet.dat` file.
On a Hush-based blockchain, all of the pre-mined coins are mined in block 1. Therefore, whichever machine executes the mining command will receive the entirety of the blockchain's pre-mined coin supply, as set in the `ac_supply` parameter. Upon mining the first block, these coins are available in the default `wallet.dat` file. Use `getwalletinfo` to see the balance.
To collect all the mining rewards from the node to a single address, execute the following commands before issuing the `setgenerate` command:
```bash
# Get a new address
newaddress=$(./hush-cli -ac_name=HELLOWORLD getnewaddress)
newaddress=$(./hush-cli -ac_name=LULZ getnewaddress)
# Get the corresponding pubkey
pubkey=$(./hush-cli -ac_name=LULZ validateaddress $newaddress | jq -r '.pubkey' )
@ -129,7 +131,9 @@ After enabling mining, you can check that the two nodes are connected by using t
./hush-cli -ac_name=LULZ getinfo | grep connections
```
If the nodes are properly connected, both nodes will respond with: `"connections": 1`
If the nodes are properly connected, both nodes will respond with: `"connections": 1` .
You can get more detailed info about connections with `hush-cli -ac_name=LULZ getpeerinfo` .
These are the coins you will later distribute to your community or use for HushChat or whatever other fun stuff you have planned :smile: