Originally posted in GitHub.
We are excited to announce a significant improvement to the CKB node’s Initial Block Download (IBD) process. With pull request #4254, we are introducing a default assume_valid_target
for both mainnet and testnet that will substantially reduce the time required for block synchronization.
Motivation
During the IBD process, a CKB node must validate all blocks from the genesis block up to the current tip of the chain. This process can be time-consuming, especially as the blockchain grows larger. By setting a default assume_valid_target
, we can safely skip some of the historical block verifications, resulting in much faster synchronization times.
How it Works
The assume_valid_target
specifies a block that the node considers valid for all blocks from the genesis block up to the specified block. When assume_valid_target
is specified, the node will skip verification until that block and then proceed with full verification from that point onwards. PR #4254 introduces a hardcoded default assume_valid_target
set to a block on Fri Jan 26 04:59:07 PM CST 2024, which is 60 days prior to the publication of the PR. This default value will be used when the user does not explicitly specify an --assume-valid-target
argument. Still, users retain the flexibility to override this default value by providing their own --assume-valid-target
argument, or opt-out this feature and run full verification by setting --assume-valid-target
to the all-zero hash: 0x0000000000000000000000000000000000000000000000000000000000000000
.
Updating Default Values
With each new release of CKB, we will update the hardcoded default assume_valid_target
to ensure it remains approximately 60 days in the past. This will be done through script devtools/release/update_default_valid_target.sh
.
The script will set the default assume_valid_target
based on the block timestamp from 60 days prior to the release date. These values will be clearly documented in the code comments.
Performance Improvements
In our performance tests, using the default assume_valid_target
resulted in a 59% reduction in block synchronization time compared to the previous release (v0.115.0-rc2). Synchronizing blocks 0 to 12,500,000 now only takes 12 hours and 40 minutes with this change, down from 30 hours and 40 minutes in the previous version (refer to the image below).
We believe this improvement will greatly enhance the user experience and make it easier for new nodes to join the CKB network. As always, we appreciate your support and feedback as we continually optimize CKB software.