dan_s
c0919dc26d
|
2 years ago | |
---|---|---|
LICENSE | 3 years ago | |
README.md | 2 years ago |
README.md
Initial set up
This page describes all required steps to run TESTCOIN, a run-time fork of the Hush source code, other resources to have a look:
- What are HUSH Smart Chains
- Using The HUSH Smart Chain Creator
- HUSH Smart Chain Creator
- Creating a HSC with RandomX
⚠️ Make sure to replace ip-of-node1
and ip-of-node-2
with their respective ip addresses ⚠️
Both machines (nodes) being used will need a static ip address, after changing both to a static ip configuration:
- On our first node we will use
sudo ufw allow from ip-of-node2
- On our second node we will use
sudo ufw allow from ip-of-node1
We can verify that both machines can see each other by pinging each ip address now.
ping ip-of-node2
ping ip-of-node1
Install hush3
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib \
autoconf libtool ncurses-dev unzip git python3 zlib1g-dev wget \
bsdmainutils automake curl unzip nano libsodium-dev cmake
git clone https://git.hush.is/hush/hush3 && cd hush3
# Change the branch to dev
git checkout dev && git branch
./build.sh -j$(nproc)
cd src
Use of tmux
tmux is a terminal multiplexer, this allows us to run multiple terminal sessions in the same window and switch between them.
sudo apt install tmux -y
Here we are going to start 2 tmux sessions. We do not want to lose our process and break our chain. So we can run the following:
tmux new-session -t NODE1
on our first node and tmux new-session -t NODE2
on our second node
Here is quick cheat sheet of tmux commands:
- detach current session:
Ctrl + b + d
- list all active sessions:
tmux ls
- attach to a session:
tmux attach -t session_name
- split window in current session vertically:
Ctrl + b + %
- split window in current session horizontally:
Ctrl + b + "
- Navigate split windows:
Ctrl + b + (arrow keys)
It is better to have more than 2 nodes
Running a HSC
From your first tmux session, NODE1 run:
./hush-smart-chain -ac_name=TESTCOIN -ac_private=1 -ac_blocktime=260 -ac_halving=420000 -ac_reward=2400000000 -ac_supply=987318 -addnode=ip-of-node2 &
From your second tmux session, NODE2 run:
./hush-smart-chain -ac_name=TESTCOIN -ac_private=1 -ac_blocktime=260 -ac_halving=420000 -ac_reward=2400000000 -ac_supply=987318 -addnode=ip-of-node1 &
-ac_name=TESTCOIN
- name
-ac_private=1
- full z2z privacy feature, just like Hush or ARRR
ac_supply=987318
- pre-mined supply
-ac_blocktime=260
+ -ac_halving=420000
+ -ac_reward=2400000000
makes TESTCOIN with block time of 260 seconds and halving every 420000 blocks with initial reward of 24 TESTCOINs.
Compare the magic number
Example: magic.c89b00b16, the string c89b00b16
will be different, but must be identical on both nodes
Before mining the pre-mined supply
All of the pre-mined coins are mined in the first block. Therefore, whichever machine executes the mining command will receive the entirely 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.
To collect all the mining rewards from the node to a single address, execute the following command:
if not yet installed: sudo apt install jq
# Get a new address
newaddress=$(./hush-cli -ac_name=TESTCOIN getnewaddress)
# Get the corresponding pubkey
pubkey=$(./hush-cli -ac_name=TESTCOIN validateaddress $newaddress | jq -r '.pubkey' )
# Indicate the pubkey to the daemon
./hush-cli -ac_name=TESTCOIN setpubkey $pubkey
Enable mining
./hush-cli -ac_name=TESTCOIN setgenerate true $(nproc)
Mining is prohibited by all VPS providers, so in that case it is safer to run with -j2
(?) option instead of $(nproc)
, will be updated...
Verify if mining is working
After mining was enabled, you can check if the two nodes are connected by using the following command:
./hush-cli -ac_name=TESTCOIN getinfo | grep connections
Must be "connections": 1
.
Useful RPC commands
All RPC commands for Hush can be used the same way for any HSC. The total list: https://faq.hush.is/rpc/coinsupply.html
Most useful:
./hush-cli -ac_name=TESTCOIN getinfo
TO-DO list
- ac_? for the total supply.
- DPoW?
- Specify the devReward wallet, so some portion of all mined coins can go to the devReward address.
- Add RANDOMX HSC documentation here
The last response from @Duke regarding the last to-do mentioned above:
https://git.hush.is/hush/hush3/src/branch/master/src/hushd#L85
ac_founders
and there is also ac_foundersreward
ac_script
is the pubkey of the FR address
ac_perc
is the percentage
Info
- SDL/SD/SDP are fully compatible with a HSC, but requires writing some code and running servers.
- At first, HSC's can just be CPU mined. If we can get the
stratum
branch merged, that makes it easier for people to use multiple CPUs/GPUs or ASICs to mine HSC's. This assumes the deault PoW algorithm of Equihash (200,9). - All HSC's have code inside them already that implements DPoW, such as recognizing notarization transactions and
dpowconfs
that Duke originally wrote for KMD. So in that sense, all HSC's come equipped with DPoW knowledge. But injecting the data into a new HSC is a service that can be paid for or a project can decide to do it themselves. Projects using HSC's should contact the Hush project to talk about pricing. ac_?
for the total supply does not exist. You must get all the other parameters to work exactly right to get the number you want. It's extremely hard, and there will likely be rounding errors because you can't divide 3 satoshis perfectly in half, etc... You can also use-ac_end
to say "stop block rewards at this height". KMD internals were not able to represent the HUSH emission schedule, so Duke had to end up manually specifying every single halving until the HUSH BR goes to 0.