The easy way to upgrade to Hardfork 26 (Hive-in-a-box)

in #witness2 years ago

Hive-in-a-box Logo

Despite my lack of posting for a while, I'm not dead! :)

I've been dealing with the useless healthcare system in the UK. I hope to return fulltime to Hive tool development once I have my health issues under control (nothing "serious", but severely impedes my productivity), I'll still be staying on top of my witness nodes, as well as urgent things such as hard forks, critical bug fixes for my Hive projects, etc. - my projects have mostly reached a point of stability anyway.

What is, and when is Hard Fork 26?

Understanding a hard fork

A Hard Fork is a set of breaking changes for a cryptocurrency network - a series of updates to the official "node" software which are
NOT backwards compatible with older versions of the software.

Due to the lack of backwards compatibility, it would be dangerous if immediately after installing the new software on a block producing node, it started to produce blocks that were incompatible with the existing network. This would result in the blockchain splitting into two different networks, with separate blockchains.

On the Hive network, we call these block producers "witnesses", somewhat similar to "miners" on other cryptocurrencies.

Hard fork lock-in date

To prevent such a split in the network, hard forks generally have a lock-in date/time or hardfork date/time.

As of right now, the Hive network's Hard Fork 26 (HF26) is set to trigger on October 11th 2022 at 12:00 PM UTC

Tue, 11 October 2022 12:00:00 UTC (08:00:00 ET)

When the clock hits 12:00:00 PM on 11-Oct-2022, the Hive network will check to see if one of the following conditions has been met:

Either:

  • At least 17 of the top 20 witnesses are running v1.26.0 or newer (Hard Fork 26)

Or:

  • 16 of the top 20 witnesses produce a block using the HF26 software, plus one backup witness (outside of the top 20)

Blockchain Compression

HF26 introduces Blockchain Compression, so the block_log file will now only take up ~300GB of disk space :)

When you replay your node, or sync it up from scratch, the block_log will be compressed, saving you a lot of disk space.

Upgrading from an existing HF25 HIAB installation

Read this if you've got an existing Hive-in-a-box (hive-docker) installation running the current active version of Hive (HF25).

WARNING: If you're upgrading a witness node, please remember to disable your signing key or switch to a backup node before upgrading your server, as it will require a full replay.

Core update

Hive-in-a-box is an application independant of the Hive software itself, it's important to update the core files (i.e. the small programs and files which make up the Hive-in-a-box application) to obtain all the latest bug fixes, new features, and general improvements to HIAB over the past few months.

First, open your hive-docker folder.

cd ~/hive-docker

Next, make sure your Hive-in-a-box is on the master branch to ensure you get the correct updates.

git checkout master

Now it's time to update Hive-in-a-box's core files (this will not affect your Hived node if it's running)

git pull

Your HIAB files should now be up to date.

Now we can stop the server (if upgrading a witness, please make sure to disable your key or switch to a backup).

./run.sh stop

If your HIAB files were upgraded successfully, your stop output should look like this:

root@myserver ~/hive-docker # ./run.sh stop
If you don't care about a clean stop, you can force stop the container with ./run.sh kill
[2019-08-12 11:28:08 CEST] Stopping container 'witness' (allowing up to 600 seconds before killing)...
witness
[2019-08-12 11:28:12 CEST] Removing old container 'witness'...
witness

Server Updates

If you haven't upgraded your server's operating system and packages in a while, now is a good time to do that.

For Ubuntu / Debian:

sudo apt update -y
sudo apt autoremove -y
sudo apt upgrade

After all server updates have been installed, reboot your server to ensure any OS kernel updates are applied.

sudo reboot

Upgrading to HF26

Before proceeding with this section, please make sure you've updated HIAB and your server's OS (see above section "Core Update")

First, make sure you're in the hive-docker folder

cd ~/hive-docker

Ensure your Hive node is stopped by running ./run.sh stop

./run.sh stop

Download the latest Hive docker image (non-MIRA) using install

./run.sh install

Ensure that your /dev/shm RAM disk is the appropriate size (at least 20G or bigger is recommended)

sudo ./run.sh shm_size 24G

To make sure there's no leftover shared_memory files that might cause problems, you can use the new clean command to remove them.

Note: Generally you only need to remove the shared memory files. Leave the blockchain and p2p folder.

sudo ./run.sh clean shm

Example output for clean shm:

[2019-08-12 11:40:04 CEST]  :: Blockchain:           /root/Hive-docker/data/witness_node_data_dir/blockchain
[2019-08-12 11:40:04 CEST]  :: P2P files:            /root/Hive-docker/data/witness_node_data_dir/p2p
[2019-08-12 11:40:04 CEST]  :: Shared Mem / Rocksdb: /dev/shm

[2019-08-12 11:40:14 CEST]  !!! Clearing shared memory files...
removed '/dev/shm/shared_memory.bin'
[2019-08-12 11:40:18 CEST]  +++ Cleared shared memory files
[2019-08-12 11:40:18 CEST]  ++ Done.

Now you're ready for a replay :)

Use the replay command to begin replaying Hive 0.21.0 (or whatever the latest version is at the time you're reading this)

./run.sh replay

To check that it's working, monitor the logs using the logs command. (You can also use tslogs to show the logs with timestamps)

./run.sh logs
------------------------------------------------------

            STARTING Hive NETWORK

------------------------------------------------------
initminer public key: STM8GC13uCZbP44HzMLV6zPZGwVQ8Nt4Kji8PapsPiNq1BK153XTX
chain id: 0000000000000000000000000000000000000000000000000000000000000000
blockchain version: 1.26.0
------------------------------------------------------
2425233ms main.cpp:121                  main                 ] Backtrace on segfault is enabled.
2425233ms chain_plugin.cpp:468          plugin_startup       ] Starting chain with shared_file_size: 64424509440 bytes
2425233ms chain_plugin.cpp:571          plugin_startup       ] Replaying blockchain on user request.
2425233ms database.cpp:235              reindex              ] Reindexing Blockchain
2425261ms block_log.cpp:142             open                 ] Log is nonempty
2425276ms block_log.cpp:151             open                 ] Index is nonempty
2425284ms database.cpp:258              reindex              ] Replaying blocks...
   0.281818%   100000 of 35483857   (61434M free)
   0.563637%   200000 of 35483857   (61434M free)
   0.845455%   300000 of 35483857   (61433M free)

Assuming you see blockchain version: 1.26.0 and no strange error messages, then you've successfully upgraded your Hive node :)

Now go sit back, watch a movie, grab some food, and come back in 8-24 hours to check on the replay progress. Most servers (with at least 64G RAM) should be able to replay a witness/seed node within 10-12 hours. Your replay speed may vary anywhere from just 6-8 hours, up to 72 hours.


Thanks for reading!

GIF Avatar by @stellabelle


Do you like what I'm doing for Hive?

Vote for me to be a Hive witness - every vote counts.


Don't forget to follow me for more like this.


Have you ever thought about being a witness yourself? Join the witness channel. We're happy to guide you! Join in shaping the Hive economy.

Are you looking for a new server provider? My company @privex offers highly-reliable and affordable dedicated and virtual servers for HIVE, HBD, EOS, LTC, BTC, and even DOGE! Check out our website at https://www.privex.io

You can join Privex's public Discord at https://discord.privex.io - we also have a Matrix server, sign up at https://riot.privex.io (or if you have an existing Matrix account, join our General chat at #privex:privex.io)


Sort:  

Thanks for building and pushing the Docker images. I was able to upgrade and replay yesterday. For a bit I was stuck on an issue that was resolved by the ./run.sh clean step.

something is wrong with my node after I followed the instructions

Happy Hard Fork day!