Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Below is the quick user guide of BEP-283 pr. #176

Closed
A1985J09 opened this issue May 19, 2024 · 1 comment
Closed

Below is the quick user guide of BEP-283 pr. #176

A1985J09 opened this issue May 19, 2024 · 1 comment

Comments

@A1985J09
Copy link

Below is the quick user guide of BEP-283 pr.

Run Node

Mainnet/Testnet

If you run a mainnet or testnet node, you just run your node with a new flag --history-segment . It will use hard code history segment to auto prune useless ancient data(except tx index) when node restart.

./bsc --config "./node/config.toml" --rpc.allow-unprotected-txs --allow-insecure-unlock --gcmode full --syncmode snap --ws --datadir "./node/data-seed" --metrics --metrics.addr 0.0.0.0 --metrics.port 6062 --pprof --pprof.port 6072 --http.corsdomain "*" --maxpeers 500 --history.transactions 0 --metrics.expensive --history-segment

Default segment config as below:

Parameter Value Description
BoundStartBlock 31,268,600 The starting block height of the first segment.
HistorySegmentLength 2,592,000 assume 1 block for every 3 second, 2,592,000 blocks will be produced in 90 days.

There are also provide a offline prune tool, it will prune tx index too.

./bsc prune-history-segments --datadir {dataDir}

It is also compatible with pruneancient & prune-block feature.

Snap Sync

If you start snap sync from genesis, the node will only download latest 2 segments blocks.

image

Private Network

If you run a private network, you could export & import your custom history segment file.

  • export history segment config, specific segment boundstart block, and segmentlen .
./bsc export-segment --datadir {dataDir} --history-segment.output ./history_segments.json --history-segment.boundstart 31268530 --history-segment.segmentlen 1000000
  • run node with custom history segment, with flag --history-segment --history-segment.custom ./history_segments.json .
  • prune ancient data.
./bsc prune-history-segments --datadir {dataDir} --history-segment.custom ./history_segments.json

Attention: history segment need Luban hardfork.

Storage Profile

Type DIsk Usage Storage Size
Normal Node 2.2 T 2.41 T
Enable History Segment Prune
837 G, -63% 1001.25 G, -60%

Originally posted by @0xbundler in bnb-chain/bsc#2017 (comment)

@Turtus
Copy link
Member

Turtus commented May 20, 2024

thanks

@Turtus Turtus closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants