Episode 2: How Is a Blockchain Stored?
Episode 2: How Is a Blockchain Stored?*In Episode 1, we built a blockchain from a series of connected blocks.*Every block contains data, the hash of its predecessor, and a nonce. Together, they form a continuously verifiable chain.
But where is this chain actually located? Who stores its data? How can we access the contents of a particular block? And does every participating computer have to keep every block forever?
A Blockchain Consists of Ordinary Data
Our simplified blockchain consisted of three blocks:
Block 1
Data Hello Anna!
Previous hash –
Nonce 183
Hash 00ab71Block 2
Data Hello Anne!
Previous hash 00ab71
Nonce 4,927
Hash 003f92Block 3
Data Hello Anna and Anne!
Previous hash 003f92
Nonce 716
Hash 00c841All of this information is ordinary digital data.
Like other data, it can be stored in files or databases on hard drives and SSDs.
A blockchain therefore does not require a special storage medium. What makes it special is not where its data is stored, but how its blocks are verified and synchronized between multiple computers.
Not One Storage Location, but Many Copies
If the blockchain were stored on only one central server, the operator of that server would have complete control over the data.
A public blockchain is therefore not stored in just one place.
Many independent computers maintain their own copies of the chain. A computer that runs the blockchain software and participates in the network is called a node.
Node A Block 1 Block 2 Block 3
Node B Block 1 Block 2 Block 3
Node C Block 1 Block 2 Block 3There is no single computer on which “the blockchain” is located.
The blockchain exists as a jointly verified chain of which many nodes possess their own copies.
Where Does a Node Get the Blocks?
A node is connected to other nodes through the network.
When another block becomes available, it is passed between the participants. Each node can store it and verify it independently.
A node does not simply assume that the received data is correct.
It checks whether the data, previous hash, and nonce produce the stated hash. It also verifies that the block points to the correct predecessor, that its hash meets the required condition, and that all other rules of the blockchain have been followed.
Only after all blocks and their connections have been successfully verified does the node accept the blockchain as valid.
The nodes therefore do not have to trust one another. Each node can determine the validity of its own copy.
What Happens When Copies Differ?
Different nodes may temporarily receive different continuations of the same blockchain.
Version A Block 1 → Block 2 → Block 3A
Version B Block 1 → Block 2 → Block 3BBoth versions may have correct hash connections and meet all the required conditions.
The nodes therefore need a common rule for choosing between these versions.
In our Proof-of-Work blockchain, the valid chain is the one containing the greatest total amount of proven computational work.
If another valid block is added to Version A, it contains more Proof of Work than Version B.
Version A Block 1 → Block 2 → Block 3A → Block 4A
Version B Block 1 → Block 2 → Block 3BThe nodes can adopt Version A and continue building on it together.
The number of claimed copies does not decide which version is valid. What matters is the verifiable Proof of Work contained in the complete chain.
A New Node Joins the Network
A newly installed node initially has no copy of the blockchain.
It connects to other nodes and downloads the existing blocks.
It does not simply trust that the received data is correct. It begins with the first block and verifies the chain itself.
First, it verifies Block 1. It then checks whether Block 2 correctly points to Block 1 and meets all conditions. Block 3 and every following block are checked in the correct order.
This process is called synchronization.
For a long blockchain, the initial synchronization can require a great deal of time, storage space, and network traffic.
At the end, the new node possesses its own independently verified copy of the blockchain.
Must the Entire Chain Be Verified Again for Every New Block?
No.
During its initial synchronization, the node verifies the blockchain from the first block to the current final block.
It stores the result of this verification and the information required for further processing.
When another block arrives, the node does not begin again with Block 1.
It checks whether the new block correctly points to the most recently confirmed block, meets the Proof-of-Work condition, and follows all other rules of the blockchain.
If the block is valid, it is appended to the already verified chain.
The complete history therefore does not have to be processed again whenever another block arrives.
How Do We Access a Stored Block?
A node stores the complete blocks in files or a database.
It also maintains an index. This allows it to find a particular block directly instead of searching through every block file from the beginning.
A block can be located using its position in the chain or its hash.
A request for Block 2 in our example blockchain would return:
Block 2
Data Hello Anne!
Previous hash 00ab71
Nonce 4,927
Hash 003f92For a public blockchain, these requests can also be made through a blockchain explorer.
A blockchain explorer is a website that accesses data stored by its own nodes and presents it in a readable form.
The original content cannot be reconstructed from a hash.
A hash can be used to locate an existing block or verify its data. The actual data must still be stored by a node.
The Blockchain Continues to Grow
The stored chain grows with every additional block.
After many years, the complete history may consist of a very large number of blocks and a correspondingly large amount of data.
This does not mean that the blockchain will eventually stop working automatically.
However, the requirements for storage space, network traffic, initial synchronization, and complete verification by a new node continue to increase.
This raises the question of whether every node really needs to retain all old block data permanently.
Removing Old Block Data
During its initial synchronization, a node downloaded and verified every old block.
It then knows the valid chain and has stored the information required to verify future blocks.
The complete data of very old blocks is not always needed for the node’s ongoing operation.
The node can therefore remove this old block data from its local copy.
This process is called pruning.
Pruning does not mean that unverified data is skipped.
The node first downloads the blocks, verifies them, and processes their information. Only then does it remove the complete data of old blocks.
What Remains After Pruning?
A pruned node retains the result of its previous verification, the technical information about the connections between the blocks, the current valid state of the blockchain, and a certain number of more recent complete blocks.
The complete contents of older blocks can be removed from its local copy.
Before pruning
Block 1 complete
Block 2 complete
Block 3 complete
Block 4 complete
Current verified stateAfter pruning
Required chain information
Block 3 complete
Block 4 complete
Current verified stateThe node can continue to verify new blocks in full.
It verified the old chain itself and removed some of the stored data only afterward.
Can a Pruned Node Still Access Block 2?
If the complete data of Block 2 has been deleted locally, that node can no longer display its contents directly.
The node still knows the necessary technical information about the chain. However, it cannot reconstruct the deleted content from the hash.
If the complete data of Block 2 is required, it must be retrieved from another node or another data source that still stores the complete history.
This is why some nodes permanently retain every block.
Does Pruning Delete the Blockchain?
No.
Pruning removes old block data only from the local copy of one particular node.
Other nodes can continue to store the complete history.
A node that permanently retains every block and its complete contents is often called an archival node.
There are also pruned nodes that store the verified current state, the required chain information, and more recent blocks.
Lightweight clients store even less data and rely on other nodes for certain information.
Not every participant has to retain the complete history.
However, enough complete copies must continue to exist so that new nodes can download the blockchain and verify it independently from the first block onward.
Why Does the Blockchain Continue to Work After Pruning?
A pruned node does not blindly trust a result provided by someone else.
It first verified the complete blockchain itself.
It then stores the result of that verification and the information required to verify future blocks.
When another block arrives, the node does not need to read all the old block contents again. It verifies the new block against the already accepted chain and its current state.
Pruning only reduces the size of the local copy. It changes neither the blockchain in the network nor the copies stored by other nodes.
Summary
A blockchain is not located on one special central server.
Its blocks are stored as ordinary digital data by many independent nodes.
Each node can verify its own copy. A new node begins with the first block and checks every following block in the correct order.
After this one-time complete verification, all old blocks do not have to be processed again whenever another block arrives.
An index allows a node to access stored blocks and their contents directly.
If the node removes old block data through pruning, it can no longer display that content locally. However, it can continue to verify the blockchain because the necessary chain information and the current verified state remain available.
Other nodes retain the complete history and make it available to new participants.
In Episode 3, we look at Bitcoin as a practical application of this technology.We then explain which data Bitcoin stores in its blocks, how transactions are verified, and how mining searches for a suitable nonce for a block.
Top comments (0)