create account

Core services - the block log revolution is here! by thebeedevs

View this thread on: hive.blogpeakd.comecency.com
· @thebeedevs ·
$135.54
Core services - the block log revolution is here!
## Dude, where did my block go?  

It's official now, you can configure your hived node to get rid of some of the 490+ gigabytes of compressed block log burden. You can even shed all of it, but do you really want to and what if you change your mind?

### The time of no choice is over

Since the beginning of Hive blockchain (and its predecessor) there was that huge single file named block_log, mandatory for all nodes. A single file with a size of over 490 gigabytes now, requiring continuous disk space of its size. The block log revolution that comes into force with `1.27.7rc0` tag brings following improvements:
- Multiple one-million-block-each block log files can be used instead of a legacy single monolithic file.
- You can keep all of the files or only a number of most recent ones.
- Complete wipeout of block log is possible too, leaving you with one last block only kept in memory.

### The pros and cons

Let's examine the new modes in detail:
- Split mode - keeps each full block from genesis, hence provides full functionality of e.g. block API & **allows blockchain replay**. At the same time its 1M-blocks part files of block log may be physically distributed to different filesystems using symlinks which allows to e.g. keep only the latest part files on fast storage. Good for API node.
- Pruned mode - a variation of split mode, which keeps only several latest part files of block log. **Replay is no longer guaranteed**. Provides only partial functionality of block API & others - handles requests for not-yet-pruned blocks, e.g. serves latest several months of blocks through `block_api`. Good for transaction broadcaster.
- Memory-only mode - the ultimate pruning - no block log files at all, only single latest irreversible block held in memory. **Unable to replay** obviously. Unable to provide past blocks through block API & similar.

### The summary of block log modes

| mode name |  blocks kept | replayable | the value of `block-log-split` option in config.ini |
| --- | --- | --- | --- |
| legacy | all | yes | -1 |
| split | all | yes | 9999 (default value now) |
| pruned | last n millions | sometimes | n > 0 |
| no-file | last 1 | no | 0 |
Wait a minute, you may say, the split mode number (9999) meets the condition of pruned one (> 0), there must be a mistake here. Let me explain in detail then - positive value of `block-log-split` option defines how many full millions of last irreversible blocks are to be kept in block log files. It means that when you set it to e.g. 90, all blocks will be kept for the time being, because Hive's got a little over 89 millions of blocks now. Thus for the time being the block log is not _effectively pruned_. After a while however, when the threshold of 90 millions is crossed, the file containing oldest (first) million of blocks will be pruned (deleted) and from that moment the block log will be _effectively pruned_. As you can see the boundary between split & pruned modes is blurred, but setting it to the biggest possible number (9999) means that your block log won't be pruned for the next 950+ years.


Now we're getting to the question why replay is available _sometimes_ in pruned mode. Full replay (from block #1) requires **all** blocks to be present in block log, therefore it can be performed as long as block log is **not** _effectively pruned_ due to combination of `block-log-split` value in configuration and current head block of the blockchain. After the oldest part file containing initial 1 million blocks is removed, the block log is _effectively pruned_ and full replay is no longer possible.

![Comparison of block log directory contents with different settings of block log option](https://images.hive.blog/DQmVMQw23UEz8FhnzRQ2QKhCvA854VcviLTm6pDGSXYdocE/ComparisonOfBlockLogDirectoryContents.png) 

<center>Block log files of nodes configured with different values of block-log-split option. Note the file size differences.</center>
### Tips & tricks

- There are two ways to obtain split block log files from legacy monolithic one - a) Using `block_log_util`'s new `--split` option or b) running hived configured to have split block log with legacy monolithic one provided in its `blockchain` directory, which triggers built-in auto-split mechanism. The former is recommended as it allows to generate the 490+ GB of split files into output directory other than the source one (possibly on different disk space).
- All files of split/pruned block log, except the head one (the latest one, with highest number in filename) can be made read-only as they won't be modified anymore. The head file needs to be writable as it's where the new blocks are applied to.
- Split block log allows to scatter its part files over several disk spaces and symlink them all in hived's `blockchain` directory. Not only can smaller disk volumes be used, you can even consider placing older parts (i.e. the ones rarely used by hived) onto slower drives.
- The names of split/pruned block log files follow the pattern `block_log_part.????` where `????` stands for consecutive numbers beginning with `0001` followed by `0002`, etc. Since each one contains up to a million of blocks, `block_log_part.0001` contains blocks numbered `1` to `1 000 000`, while `block_log_part.0002` contains blocks numbered `1 000 001` to `2 000 000` and so on. Hived recognizes the block log files by their names, so don't change them or it becomes lost.

### Links and resources

- Source code version containing the improvements - https://gitlab.syncad.com/hive/hive/-/tags/1.27.7rc0

### Your feedback is invaluable and always welcome.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 436 others
properties (23)
authorthebeedevs
permlinkcore-services-the-block-log-revolution-is-here
categoryhive-139531
json_metadata"{"format":"markdown+html","summary":"Description of revolutionary improvements to block log configuration of hive applications. Explanation of new config option block-log-split.","app":"@hiveio/wax/1.27.6-rc4-240917114249","tags":["hive","dev","hived","block-log","pruning"],"image":["https://images.hive.blog/DQmVMQw23UEz8FhnzRQ2QKhCvA854VcviLTm6pDGSXYdocE/ComparisonOfBlockLogDirectoryContents.png"],"author":"zgredek"}"
created2024-11-08 13:35:30
last_update2024-11-08 13:35:30
depth0
children8
last_payout2024-11-15 13:35:30
cashout_time1969-12-31 23:59:59
total_payout_value45.198 HBD
curator_payout_value90.339 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,603
author_reputation214,413,890,391,020
root_title"Core services - the block log revolution is here!"
beneficiaries
0.
accountzgredek
weight5,000
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id138,341,018
net_rshares547,564,382,447,271
author_curate_reward""
vote details (500)
@andablackwidow ·
> because Hive's got a little over 89 millions of blocks now

Heh. I see I'm not the only one who takes a month to write a post :oP

> After the oldest part file containing initial 1 million blocks is removed, the block log is effectively pruned and full replay is no longer possible.

Technically the information is correct, but it is worth pointing out explicitly that even if you are missing oldest block_log parts, you can still replay as long as you have valid snapshot that covers missing blocks. Although personally I'd keep all parts somewhere, because snapshots are easily outdated.
properties (22)
authorandablackwidow
permlinkre-thebeedevs-2024118t16422782z
categoryhive-139531
json_metadata{"tags":["hive","dev","hived","block-log","pruning"],"app":"ecency/3.0.35-surfer","format":"markdown+html"}
created2024-11-08 15:04:21
last_update2024-11-08 15:04:21
depth1
children0
last_payout2024-11-15 15:04:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length591
author_reputation97,189,462,735,448
root_title"Core services - the block log revolution is here!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id138,342,563
net_rshares0
@danzocal ·
!PIZZA
properties (22)
authordanzocal
permlinkre-thebeedevs-smnqla
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2024.10.15","image":[],"users":[]}
created2024-11-09 00:27:09
last_update2024-11-09 00:27:09
depth1
children0
last_payout2024-11-16 00:27:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6
author_reputation12,432,803,008,396
root_title"Core services - the block log revolution is here!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id138,351,276
net_rshares0
@gtg ·
Awesome feature, especially for witnesses, because usually they are running tons of various Hive nodes to serve the community.

{(Amidala meme: "Because they are running tons of various Hive nodes to serve the community???")}

For example, I can run a few broadcaster nodes on cheap VPS servers, as they no longer need a huge amount of storage. It will also improve my block_log serving service, as it will be much easier to resume downloads, even if you had a different source of blocks before (the blocks are the same, but because of the compression, their storage can differ between the nodes).
👍  , ,
properties (23)
authorgtg
permlinksmmz4z
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2024-11-08 14:34:09
last_update2024-11-08 14:34:09
depth1
children0
last_payout2024-11-15 14:34:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length597
author_reputation461,898,288,716,338
root_title"Core services - the block log revolution is here!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id138,342,106
net_rshares29,562,232,858
author_curate_reward""
vote details (3)
@hive-lu ·
#### Hello thebeedevs!
**It's nice to let you know that your article won 🥇 place.**
Your post is among the best articles voted 7 days ago by the @hive-lu | King Lucoin Curator by **szejq**
 
You and your curator receive **0.0587 Lu** (Lucoin) investment token and a **15.51%** share of the reward from [Daily Report 477](/lucoin/@hive-lu/daily-report-day-477). Additionally, you can also receive a unique **LUGOLD** token for taking 1st place. All you need to do is reblog [this](/lucoin/@hive-lu/daily-report-day-477) report of the day with your winnings.
 
<center>[![2.png](https://files.peakd.com/file/peakd-hive/now.calendars/23uEwt7Djmb4N3dE96ecCUemJez6vLU3fmoTrdjEJn1ws4d8iPw2QrrsB22nyhbb178sx.png)](/@hive-lu)</center>
 
---
<center><sub>Invest in the **Lu token** (Lucoin) and get paid. With 50 Lu in your wallet, you also become the curator of the @hive-lu which follows your upvote.
Buy Lu on the [Hive-Engine](https://hive-engine.com/trade/LU) exchange | World of Lu created by @szejq </sub></center>
<center><sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP` _or to resume write a word_ `START`</sub> </center>
properties (22)
authorhive-lu
permlinklucoin-prize-9fx4se
categoryhive-139531
json_metadata""
created2024-11-16 03:30:12
last_update2024-11-16 03:30:12
depth1
children0
last_payout2024-11-23 03:30:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,183
author_reputation33,701,449,834,975
root_title"Core services - the block log revolution is here!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id138,484,597
net_rshares0
@hivebuzz ·
Congratulations @thebeedevs! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

<table><tr><td><img src="https://images.hive.blog/60x70/https://hivebuzz.me/@thebeedevs/upvoted.png?202411081735"></td><td>You received more than 4500 upvotes.<br>Your next target is to reach 4750 upvotes.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@thebeedevs) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Check out our last posts:**
<table><tr><td><a href="/hive-122221/@hivebuzz/pum-202410-delegations"><img src="https://images.hive.blog/64x128/https://i.imgur.com/fg8QnBc.png"></a></td><td><a href="/hive-122221/@hivebuzz/pum-202410-delegations">Our Hive Power Delegations to the October PUM Winners</a></td></tr></table>
properties (22)
authorhivebuzz
permlinknotify-1731087815
categoryhive-139531
json_metadata{"image":["https://hivebuzz.me/notify.t6.png"]}
created2024-11-08 17:43:36
last_update2024-11-08 17:43:36
depth1
children0
last_payout2024-11-15 17:43:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length956
author_reputation369,483,390,319,365
root_title"Core services - the block log revolution is here!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id138,344,932
net_rshares0
@oflyhigh ·
This is indeed an exciting feature.
In this case, I think we can run a full node locally, and when necessary, such as upgrades or hard forks, we can replay from the beginning. Then run lightweight nodes on the server (bare metal or VPS), which can meet the needs and save disk space costs.
properties (22)
authoroflyhigh
permlinksmnxxz
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2024-11-09 03:06:00
last_update2024-11-09 03:06:00
depth1
children0
last_payout2024-11-16 03:06:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length289
author_reputation6,435,987,827,056,412
root_title"Core services - the block log revolution is here!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id138,352,601
net_rshares0
@pizzabot ·
<center>PIZZA!


$PIZZA slices delivered:
@danzocal<sub>(7/10)</sub> tipped @thebeedevs 


</center>
properties (22)
authorpizzabot
permlinkre-core-services-the-block-log-revolution-is-here-20241109t002908z
categoryhive-139531
json_metadata"{"app": "pizzabot"}"
created2024-11-09 00:29:06
last_update2024-11-09 00:29:06
depth1
children0
last_payout2024-11-16 00:29:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length100
author_reputation7,737,314,250,392
root_title"Core services - the block log revolution is here!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id138,351,301
net_rshares0
@rishi556 ·
This is going to be great! Reducing the cost of running nodes is going to get more participants! Great work.
properties (22)
authorrishi556
permlinksmowsb
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2024-11-09 15:38:39
last_update2024-11-09 15:38:39
depth1
children0
last_payout2024-11-16 15:38:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length108
author_reputation134,530,025,716,854
root_title"Core services - the block log revolution is here!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id138,360,498
net_rshares0