Sure, here’s a comprehensive guide on using your Koinos node to produce blocks. Please note that while this guide is designed to be as user-friendly as possible, some basic understanding of command line interface and system administration is beneficial.
Step 1: Prerequisites
Before you start, make sure you have the following installed:
- Docker: Docker is a platform that allows you to develop, ship, and run applications in containers. You can download Docker from here.
- Git: Git is a distributed version control system that lets you manage and keep track of your source code history. You can download Git from here.
- Koinos Node: Follow the guide on running a Koinos Node. Be sure to start the node with the
--profile all
or--profile block_producer
option to start the optional block producer microservice.
Step 2: Retrieve Your Address and Key
Upon starting a new node, a private block production key will be automatically generated for you. This key will be at $KOINOS_BASEDIR/block_producer/private.key
($KOINOS_BASEDIR
is ~/.koinos
on macOS/Linux and C:\koinos
for Windows if following the guide). There is a corresponding public.key
file that is written out when the block producer runs and is always the public key corresponding to the private key that the block producer is configured to use (private.key
by default).
You will want to copy the contents of public.key
and save this for later use. This is our “hot” key.
cat $KOINOS_BASEDIR/block_producer/public.key
Step 3: Register Your Key and Burn KOIN
Using the address from your main account and the public key from your block producer, you will now create the association in the Proof-of-Burn contract.
./koinos-cli -r http://localhost:8080/
🔐 > register pob 159myq5YUhhoVWu3wsHKHiJYKPKGUrGiyv
🔐 > open <wallet_file> <password>
🔓 > pob.register_public_key 1P4msR22FXKHZragcLk2dCNweTEi9JWgxn Aq4Ps_Ch-f8OZDnpQOov2SiMvdYyA5tn0oWa36QWnTeH
Next, you must burn some KOIN in order to receive Virtual Hash Power (VHP). Let’s burn 10,000 KOIN in exchange for 10,000 VHP. The pob.burn
call is requesting that 10,000 KOIN be burned from the first address and place 10,000 VHP into the second address. In our case, we want the address to burn KOIN from to be the same that receives VHP.
🔓 > pob.burn 1000000000000 1P4msR22FXKHZragcLk2dCNweTEi9JWgxn 1P4msR22FXKHZragcLk2dCNweTEi9JWgxn
Note: You may repeat this process to top off your VHP as you run your block producer over time. Do not burn your entire KOIN balance as you will need liquid KOIN and its associated mana in order to produce blocks.
Step 4: Configure the Block Producer
At this point, the chain has all the information required in order for us to produce blocks. Let’s update our block producer configuration file to reflect the information we provided the chain. We should uncomment or add the producer line to let the block producer know which account holds our VHP. Below is an example configuration using the address and key from this guide.
block_producer:
algorithm: pob
pob-contract-id: 159myq5YUhhoVWu3wsHKHiJYKPKGUrGiyv
vhp-contract-id: 1AdzuXSpC6K9qtXdCBgD5NUpDNwHjMgrc9
producer: 1P4msR22FXKHZragcLk2dCNweTEi9JWgxn
Step 5: Producing Blocks
Now that our configuration file is prepared we may restart our block producer in order to use the new settings. From the directory containing your docker-compose.yml execute:
docker compose restart block_producer
If everything is working as expected your block production logs should look like this:
koinos-block_producer-1 | 2022-08-18 17:56:08.489496 (block_producer.Koinos) [block_producer.cpp:296] <info>: Produced block - Height: 220753, ID: 0x1220003c080793c08de2bb3a7d94986b85cbe4f0c8c3c9ad3b6dd036379bc048f421
koinos-block_producer-1 | 2022-08-18 17:56:08.495517 (block_producer.Koinos) [block_producer.cpp:219] <info>: Created block containing 0 transactions utilizing approximately 0/204800 disk, 0/1048576 network, 0/287500000 compute
koinos-block_producer-1 | 2022-08-18 17:56:08.501338 (block_producer.Koinos) [pob_producer.cpp:347] <info>: Difficulty target: 0x00000000000002c7bf812846eacfa2a3
koinos-block_producer-1 | 2022-08-18 17:56:08.502196 (block_producer.Koinos) [pob_producer.cpp:349] <info>: Estimated total VHP producing: 863917.30411773 VHP
koinos-block_producer-1 | 2022-08-18 17:56:08.502890 (block_producer.Koinos) [pob_producer.cpp:352] <info>: Producing with 10000.00000000 VHP
koinos-block_producer-1 | 2022-08-18 17:56:10.539163 (block_producer.Koinos) [pob_producer.cpp:98] <info>: Burn difficulty met at quantum 1660845375530
Congratulations, you are now producing blocks using Proof-of-Burn!
Step 6: Updating the Block Producer
To update the block producer, you need to pull the latest changes from the Koinos Docker repository, rebuild the Docker image, and run the Docker container again.
git pull
docker build -t koinos .
docker run -p 2001:2001 -p 8080:808
0 -v $(pwd)/data:/var/lib/koinos koinos
You Are Now Mining Koin with Your Node
Congratulations! You’ve successfully set up and started using your Koinos node to produce blocks. Remember to regularly update your node to get the latest features and security updates. If you encounter any issues, you can ask for help in the Koinos community.