Skip to content

Instantly share code, notes, and snippets.

@smk762
Last active April 15, 2023 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smk762/a21e36a366b16a251aa6cb5c8a744011 to your computer and use it in GitHub Desktop.
Save smk762/a21e36a366b16a251aa6cb5c8a744011 to your computer and use it in GitHub Desktop.
Komodo Notary Node Testnet 2023 setup cheat sheet
This guide assumes you have already completed the steps in the following two links:
- https://docs.komodoplatform.com/notary/setup-Komodo-Notary-Node.html#initial-server-setup
- https://docs.komodoplatform.com/notary/setup-Komodo-Notary-Node.html#install-komodo-by-compiling-it-from-source
### Clone dPoW and checkout the testnet branch
```
git clone https://github.com/KomodoPlatform/dPoW/
git checkout 2023-testnet
```
### Create pubkey.txt
`echo "pubkey=<pubkey>" > ~/dPoW/iguana/pubkey.txt`
### Create wp_testnet and make it executable
```
echo 'curl --url "http://127.0.0.1:7779" --data "{\"method\":\"walletpassphrase\",\"params\":[\"YOUR_SEED_OR_PRIVKEY_HERE\", 9999999]}"' > ~/dPoW/iguana/wp_testnet
chmod +x ~/dPoW/iguana/wp_testnet
```
### Open Iguana p2p port
`sudo ufw allow 17778 comment '2023 Testnet Iguana'`
### Create symboloc links for the komodod & komodo-cli
```
sudo ln -sf /home/$USER/komodo/src/komodo-cli /usr/local/bin/komodo-cli
sudo ln -sf /home/$USER/komodo/src/komodod /usr/local/bin/komodod
```
### Start KMD, DOC and MARTY
Create a file named `launch_testnet_chains.sh` and add the launch parameters.
```
#!/bin/bash
source ~/dPoW/iguana/pubkey.txt
komodod -pubkey=$pubkey &
komodod -ac_name=MARTY -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=65.21.77.109 -addnode=65.21.51.47 -pubkey=$pubkey &
komodod -ac_name=DOC -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=65.21.77.109 -addnode=65.21.51.47 -pubkey=$pubkey &
```
Make the script executable with `chmod +x launch_testnet_chains.sh`, then launch the chains with `./launch_testnet_chains.sh`
You can check the status of these chains with
```
tail -f ~/.komodo/debug.log
tail -f ~/.komodo/DOC/debug.log
tail -f ~/.komodo/MARTY/debug.log
```
### Import your private key to all chains
```
komodo-cli importprivkey YOUR_PRIVATE_KEY "" true $(komodo-cli getblockcount) # This will import without rescanning which is faster but will not display existing balance.
komodo-cli -ac_name=DOC importprivkey YOUR_PRIVATE_KEY
komodo-cli -ac_name=MARTY importprivkey YOUR_PRIVATE_KEY
```
Send some funds to your notary node chain addresses. If you need some RICK / DOC, ask Alright or Smk. If you need some KMD, post a DOC/MORTY meme in the Discord testnet channel with your address below and if its funny enough, charity may follow.
### Create a splitfunds script
Create split script called `split_testnet.sh`. Use the following template as an example.
```
#!/bin/bash
source ~/dPoW/iguana/pubkey.txt
chain="KMD"
unspent=$(komodo-cli listunspent | jq '[.[] | select (.generated==false and .amount==0.0001 and .spendable==true and (.scriptPubKey == "'21${pubkey}ac'"))] | length')
echo "${chain}: $unspent"
if [ $unspent -lt 50 ]; then
echo "Topping up ${chain}"
curl --url "http://127.0.0.1:7779" --data "{\"coin\":\""${chain}"\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":"50"}"
fi
chain="DOC"
unspent=$(komodo-cli -ac_name=DOC listunspent | jq '[.[] | select (.generated==false and .amount==0.0001 and .spendable==true and (.scriptPubKey == "'21${pubkey}ac'"))] | length')
echo "${chain}: $unspent"
if [ $unspent -lt 50 ]; then
echo "Topping up ${chain}"
curl --url "http://127.0.0.1:7779" --data "{\"coin\":\""${chain}"\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":"50"}"
fi
chain="MARTY"
unspent=$(komodo-cli -ac_name=MARTY listunspent | jq '[.[] | select (.generated==false and .amount==0.0001 and .spendable==true and (.scriptPubKey == "'21${pubkey}ac'"))] | length')
echo "${chain}: $unspent"
if [ $unspent -lt 50 ]; then
echo "Topping up ${chain}"
curl --url "http://127.0.0.1:7779" --data "{\"coin\":\""${chain}"\",\"agent\":\"iguana\",\"method\":\"splitfunds\",\"satoshis\":\"10000\",\"sendflag\":1,\"duplicates\":"50"}"
fi
```
Make it executable with `chmod +x split_testnet.sh`
Add a crontab entry for this script so it will ensure you have enough UTXOs when you are asleep.
Open the cron job editor with `crontab -e`
Add the following entry: `0 * * * * /home/YOURUSERNAME/split_testnet.sh`
This will check/replenish your UTXOs every hour
### Start Iguana
```
cd ~/dPoW/iguana
./m_notary_build
./m_notary_testnet_2023
```
Good luck! Don't be shy to ask questions and learn from the Vetern Notary Node Operators!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment