This is a copy–paste friendly guide to get a Hive consensus node running for HF28.
Simple recipes for:
To keep the recipes dead simple, I assume:
Single-core CPU performance matters most during the initial replay/resync, and later for keeping up with the head block. The more RAM you have, the more data Linux can keep in the page cache, which means less pressure on your storage.
The required size of the shared memory file (where the node state lives) has dropped significantly, so we no longer recommend forcing it into RAM via tmpfs. In most cases it's enough to keep it on disk and let the kernel’s page cache do its job, especially on systems with plenty of RAM. You can still use tmpfs as an optional optimization if you really want to squeeze out every bit of replay/resync performance.
(*) Others are just out of scope now
hive
uid = 1000HOME = /home/hive/home/hive/datadirscreen to keep hived runninglbzip2 for compressed snapshotsdocker if you follow the Docker section2001 – P2P (seed)8090, 8091 – WebSocket / HTTP APIsSame binary, different config:
get_block, broadcasts transactions, tracks the head block.The role is decided by config.ini (plugins, tracked accounts, witness name, private key, etc.), not by different binaries.
A snapshot may already contain extra data (like history for tracked accounts), but if you remove the related plugins or tracked accounts from config.ini, that data simply won’t be used.
hive user)# create basic tree
mkdir -pv ~/datadir/{blockchain,snapshot} ~/bin
Start from the "exchange" config and then tweak it for your node's desired role (seed / witness / wallet / API).
wget https://gtg.openhive.network/get/snapshot/exchange/example-exchange-config.ini \
-O ~/datadir/config.ini
Later you might want to:
plugin = ... entries you don’t needwitness and private-key if you run this node as a witnessblock_log is split to match your storage preferenceswget https://gtg.openhive.network/get/bin/hived-1.28.3 -nc -P ~/bin
wget https://gtg.openhive.network/get/bin/cli_wallet-1.28.3 -nc -P ~/bin
chmod u+x ~/bin/{hived,cli_wallet}-1.28.3
shared_memory.bin is hot. Putting it in RAM can speed up replay and reduce SSD wear, but if it’s gone (for example after a reboot) or corrupted, you will need to start over with replay or load a snapshot. Treat this as an optional optimization, not the default.
sed -i '/^# shared-file-dir/s/^# //' ~/datadir/config.ini
# or manually uncomment line: shared-file-dir = "/run/hive"
/run/hive (run as root):sudo mkdir -p /run/hive
sudo chown -Rc hive:hive /run/hive
sudo mount -o remount,size=12G /run
Please note that aside from shared_memory.bin, Hive now also uses a comments-rocksdb-storage directory for part of the state. By default this lives alongside shared memory in the shared-file-dir (on disk), but if you move shared-file-dir to /run/hive, both shared_memory.bin and comments-rocksdb-storage will live in RAM.
You can either:
block_log (recommended), orwget https://gtg.openhive.network/get/blockchain/block_log -nc -P ~/datadir/blockchain
wget https://gtg.openhive.network/get/blockchain/block_log.artifacts -nc -P ~/datadir/blockchain
The
block_logis very large (hundreds of GB), so downloading it can take many hours.
If you already have ablock_log, definitely reuse it for upgrades.
If you don’t have one yet, with the current improvements it’s usually better to just let the node sync from the P2P network instead of downloading a freshblock_logfile from a single source.
Snapshot = ready-made node state from another machine.
wget https://gtg.openhive.network/get/snapshot/exchange/latest.tar.bz2 -O - \
| lbzip2 -dc \
| tar xvC ~/datadir/snapshot
latest~/datadir/snapshot/latest)Make sure:
block_log is at least as fresh as the snapshothived-1.28.3 and config.ini are compatible with itHere compatible means: your config does not require any extra plugins or tracked accounts that were not used when the snapshot was created
(for example, using new account-history-rocksdb-track-account-range entries that weren’t present when the snapshot was made).
Having fewer plugins or a subset of tracked accounts is fine.
All roles use the same data dir and binary, just different config.ini.
In ~/datadir/config.ini:
p2p-endpoint = 0.0.0.0:2001
You can now start hived using Recipe 8.
In ~/datadir/config.ini:
witness = "yourwitnessname"
private-key = 5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Keep it clean and simple: comment out or remove non-essential plugins (APIs, history, etc.).
Then start hived using Recipe 8.
In ~/datadir/config.ini:
Example config.ini you've downloaded in Recipe 2 is good enough as long as your desired account(s) are already tracked.
If so, use Recipe 8a.
If you need to add any new tracked accounts to the list of tracked accounts using format:
account-history-rocksdb-track-account-range = ["mytrackedaccount","mytrackedaccount"]
you simply cannot use that snapshot anymore. In that case you must rebuild the state from scratch using your block_log (no --load-snapshot), use Recipe 8b.
example-exchange-config.ini.webserver-http-endpoint = 0.0.0.0:8090
webserver-ws-endpoint = 0.0.0.0:8091
Then start hived using Recipe 8a.
hived (native binary)screen -S hived
~/bin/hived-1.28.3 -d ~/datadir --load-snapshot=latest
Detach from screen with: Ctrl+a, then d
Reattach with: screen -r hived
block_log (no snapshot)If you don’t use a snapshot and just want to rebuild state from your block_log:
screen -S hived
~/bin/hived-1.28.3 -d ~/datadir --replay
Detach from screen with: Ctrl+a, then d
Reattach with: screen -r hived
block_log)WARNING: this removes your local blockchain data (don't do that unless you want to download everything again from the P2P network).
If you are upgrading, see Recipe 9.
Before you "start from scratch", double-check your directory tree. If you really want a clean resync, make sure there are no leftovers in your data dir, especially in ~/datadir/blockchain/. Old files (like a previous monolithic block_log) can still occupy a lot of space even if they’re no longer used. When you’re sure you don’t need them anymore, rm -rf ~/datadir/blockchain/* gives you a truly empty blockchain directory to start from.
screen -S hived
~/bin/hived-1.28.3 -d ~/datadir --resync
Detach from screen with: Ctrl+a, then d
Reattach with: screen -r hived
If there is no existing state or block_log, running hived without --load-snapshot and without --replay will also effectively start resync from scratch.
Assuming you already run a node laid out like this:
hived.~/datadir), especially blockchain/block_log.hived-1.28.3 and cli_wallet-1.28.3).Then choose one of these paths:
--load-snapshot=latest).block_log: start with Recipe 8b (--replay).block_log (unlikely when you are upgrading): let the node sync from P2P, i.e. go with Recipe 8c (--resync).In all cases, you reuse the same config.ini (adjusted as needed for your role).
Some upgrades don’t require replay (for example, certain bug-fix releases within the same 1.28.x line – please refer to the release notes for details).
In such case it's enough to just stop your current hived-1.28.0 and start it with hived-1.28.3 to resume its operations.
But make sure you don't use any of --load-snapshot, --force-replay, or --resync.
Same idea as Part 1, just wrapped in a container.
All assumptions from Part 1 still apply (same ~/datadir, same config.ini, optional block_log and snapshot).
Additionally we assume:
hive can run docker.Most common Docker run (seed + basic API), using your existing /home/hive/datadir from Part 1:
docker run \
-e HIVED_UID=$(id -u) \
-p 2001:2001 \
-p 8090:8090 \
-p 8091:8091 \
-v /home/hive/datadir:/home/hived/datadir \
hiveio/hive:1.28.3 \
--set-benchmark-interval=100000 \
--load-snapshot=latest \
--replay
What this does:
hiveio/hive:1.28.3/home/hive/datadir to /home/hived/datadir inside the container2001, 8090, 8091 from the container to the hostHIVED_UID=$(id -u)) so files created by hived are owned by hive on the hosthived to:
/home/hived/datadir/snapshot/latest as the snapshot (--load-snapshot=latest)block_log as needed (--replay)--set-benchmark-interval=100000)You still need:
config.ini inside /home/hive/datadir (on the host)block_log, andblock_log.artifacts (unless pruned) and snapshot, exactly like in the bare-metal recipesFor simpler cases:
--load-snapshot=latest (keep --replay or --force-replay if you want a full replay from block_log)--load-snapshot=latest and --replayAdjust ports / extra flags to match your intended role (seed / witness / exchange / wallet / API), using the same config.ini rules as in Part 1.
If you just want one long paste (native binary, default config, download block_log, use snapshot):
screen -S hived
mkdir -pv ~/datadir/{blockchain,snapshot} ~/bin
wget https://gtg.openhive.network/get/bin/hived-1.28.3 -nc -P ~/bin
wget https://gtg.openhive.network/get/bin/cli_wallet-1.28.3 -nc -P ~/bin
chmod u+x ~/bin/{hived,cli_wallet}-1.28.3
wget https://gtg.openhive.network/get/blockchain/block_log -nc -P ~/datadir/blockchain
wget https://gtg.openhive.network/get/blockchain/block_log.artifacts -nc -P ~/datadir/blockchain
wget https://gtg.openhive.network/get/snapshot/exchange/latest.tar.bz2 -O - | \
lbzip2 -dc | tar xvC ~/datadir/snapshot
# that will overwrite your config
wget https://gtg.openhive.network/get/snapshot/exchange/example-exchange-config.ini \
-O ~/datadir/config.ini
~/bin/hived-1.28.3 -d ~/datadir --load-snapshot=latest
block_log – roughly half thatCongratulations, you have your Hive HF28 node running (or at least a copy-paste away).