PARAMETA

Pruning in loopchain: Making Blockchain Nodes Lightweight

2022.07.20Insight
Blog — ArticleScroll

The growth of blockchain data

A blockchain gathers transactions (TX) into blocks and links those blocks into a hash chain, acting as a tamper-proof data store while updating its internal state as transactions execute. By its very nature, the data a blockchain stores keeps expanding. Look at the growth curve for Ethereum full node data size, for example: roughly 800GB currently has to be synced, and the number keeps climbing. The pace is steep — the figure more than doubled between January 2021 and January 2022.

* Source: Ethereum Chain Full Sync Data Size, https://ycharts.com/indicators/ethereum_chain_full_sync_data_size

Blockchain data volume that only ever grows is one of the bigger obstacles to adopting blockchain in the first place.

The first problem is cost. Storage costs rise continuously, and so do the hardware and network specifications needed to handle the growing data — so the financial burden compounds over time.

The second problem is that it limits the participation of new validator nodes, which can be devastating for decentralization. If the cost of joining as a new validator keeps rising and syncing to the existing validators takes weeks or more, new validators simply cannot join. That leaves the network running on its existing validators alone, which undermines decentralization.

Pruning in loopchain: making nodes lightweight

In loopchain, developed in-house by PARAMETA, a node can run in lightweight form by holding only the most recent block data. The heart of lightweight blockchain nodes is being able to verify newly created blocks even without holding the data for every block, and loopchain achieves this through pruning.

Fundamentally, a blockchain prevents tampering — and makes it possible to verify blocks newly propagated from other nodes — by including the hash of the previous block header in the next block header. A block header contains the block height, transaction root hash, transaction result root hash and validator root hash, along with the hash of the previous block header. Regenerating those hashes and comparing them against the ones propagated from other nodes is how a node verifies the existence and integrity of transactions and their execution results. In other words, these hashes are built up as a chain or tree that starts at the genesis block and keeps extending, so you need the earlier data in order to verify the new data. That is exactly why blockchain nodes hold on to old data too, and it is also why a blockchain keeps growing over time.

To cut such a hash chain or tree somewhere in the middle — to prune it — you have to keep enough data to verify newly propagated blocks, or generate the verification data you need. The verification data that must be kept can differ depending on each blockchain's block structure and consensus algorithm.

In loopchain, a block (BN) is composed of TransactionsN, ReceiptsN-1, StateN, ValidatorsN+1 and so on. loopchain takes the approach of including transaction execution results in the next block. And to create or verify the next block (BN+1), you need not only TransactionsN+1 but also ReceiptsN and StateN+1 — the results of executing the current block's TransactionsN — plus the VotesN collected on those results, and you also need to confirm that those VotesN appear in the previous block's ValidatorsN list. The blocks and vote information required for block creation and verification are then used to generate a new genesis block.

loopchain supports pruning by taking the last three blocks and the vote information for the final block and building a new genesis block from them. Data older than that new genesis block is not needed for block verification, so a node can delete it — and that is what makes the lightweight form possible. Such a node can still verify new blocks, so it can become a validator immediately and take part in consensus alongside full nodes that hold all the data, with no difference between them.

Given how a blockchain works, stored data only ever moves in one direction — up — and the larger the volume grows, the more seriously it affects both cost and decentralization. Lightweight nodes are therefore essential, and that calls for deleting data through pruning within limits that do not compromise blockchain's core strengths of immutability and transparency.

loopchain supports lightweight nodes by extracting the information needed from existing blocks and building a new genesis block so that new blocks can still be created and verified. Beyond pruning earlier data, we expect that applying additional techniques to slim down state data will make nodes lighter still.

[Reference] Go to the blog section of the official PARAMETA website ▼

Pruning in loopchain: Making Blockchain Nodes Lightweight

The growth of blockchain data. A blockchain gathers transactions (TX) into blocks and links those blocks into a hash chain, acting as a tamper-proof data store while updating its internal state as transactions execute. By its very nature, the data a blockchain stores keeps expanding. Look at the growth curve for Ethereum full node data size, for example: roughly 800GB currently has to be synced, and the number keeps climbing. In particular, compared with January 2021 ...

www.iconloop.com

Thanks for reading.

Web3 Enabler, PARAMETA

Back to list