Skip to content

[DEPRECATED]The purpose of this is to semi-automate the process of staking coins on all 64 segids on a komodod ac_staked chain. This process is neccesary to secure a newly created ac_staked chain.

License

Notifications You must be signed in to change notification settings

Alrighttt/dockersegid

Repository files navigation

After creating a staking chain, it is vital to distribute staking coins across all 64 segids. If there is not at least one UTXO staking in each segid, this may give someone the ability to 51% attack the chain. This can be done easily using this repo.

Dependencies/Prerequisites :

Docker/Docker CE installed https://docs.docker.com/install/linux/docker-ce/ubuntu/

python3 and requests installed

sudo apt-get install python3
sudo apt-get install python3-pip
pip3 install requests

Komodod installed and running. This tutorial assumes you have already created a Proof of Stake chain, and you have a node running on the computer you're using. Please see this tutorial if you have not already.

Tutorial

The first step is to create the docker image. Run

git clone https://github.com/alrighttt/dockersegid
cd dockersegid
sudo docker build -t komodod .

Edit the config.py file to the appropriate RPC settings for the node you will be generating the addresses from. You will also be funding all 64 segid addresses from this node, so it must have a balance. The RPC settings can be found in ~/.komodod/<CHAINNAME>/<CHAINNAME>.conf. The IP should not be changed unless you are running the node from a separate computer. If you are running the node on a separate computer, ensure that the RPC port is open.

Edit the dockerstart.sh file. Set PASSWD to a long string of random characters. Set SEEDIP to the IP of the node the docker nodes will connect to. The node the docker nodes will connect to must have its p2p port open. Edit the ac_parameters to match the parameters of your chain. Make sure you have every ac_parameter you would use to start a typical node on your chain including -addnode. For example the default setting for this repo is for this chain ./komodod -ac_name=STAKETEST -ac_supply=10000000 -ac_reward=1000000000 -ac_staked=90

Edit the kmdcli script. Change ac_name to fit your chain and -rpcpassword to the same value as PASSWD set in dockerstart.sh.

Stop your node's daemon and rename the wallet.dat

cd ~/komodo/src
./komodo-cli -ac_name=<CHAINNAME> stop
mv ~/.komodo/<CHAINNAME>/wallet.dat ~/.komodo/<CHAINNAME>/wallet.dat.bk

Running the ./generateaddresses script will generate up to a couple hundred addresses and should not be done on a wallet.dat you plan to continually use. Restart the node and ensure that it is running with a newly created wallet.dat.

Run

cd ~/dockersegid
./generateaddresses.py > list.py

Check that it generated the file list.py properly. This file is the basis for the scripts, and it's vital that it is the correct format. This file is an array including an address with corresponding pubkey/privkey for each segid in the format [segid, pubkey, privkey, address] . THIS FILE CONTAINS THE PRIVATE KEYS FOR EACH ADDRESS. KEEP IT SAFE.

After verifying list.py was created properly, stop the node, delete the wallet.dat, rename the other wallet.dat and restart the node

cd ~/komodo/src
./komodo-cli -ac_name=<CHAINNAME> stop
rm ~/.komodo/<CHAINNAME>/wallet.dat
mv ~/.komodo/<CHAINNAME>/wallet.dat.bk ~/.komodo/<CHAINNAME>/wallet.dat

Now restart the node and go back to the repo's directory. cd ~/dockersegid

Run sudo ./launchcontainers Wait for each to launch.

Run sudo ./importprivkey This will import the private key to each docker container's node.

Run ./sendmany64 100. This will send 100 coins to each docker node's komodod. Change 100 to how ever many coins you would like each docker container to stake.

You can check that each node received these coins by running sudo ./kmdcliall "getbalance". This kmdcliall script can be used to send any komodod-cli commands to all 64 nodes at once. To send a command to a specific node, use the sudo ./kmdcli. For example to send a getbalance command to the segid40 node, you would use sudo ./kmdcli 40 "getbalance"

Once you have confirmed that each node has received coins, run sudo ./kmdcliall "setgenerate true 0"

As soon as the coins are eligible to stake all 64 nodes will begin to stake.

About

[DEPRECATED]The purpose of this is to semi-automate the process of staking coins on all 64 segids on a komodod ac_staked chain. This process is neccesary to secure a newly created ac_staked chain.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published