Anyone new to blockchain has one simple question, “where blockchain is stored?” Infact, many people who use blockchain through dApps or digital currencies are still not clear how the blockchain data is stored and accessed.
Blockchain is gaining more momentum with time as it is evolving at a rapid pace. Right now, there are tons of digital currencies that you can purchase, store, and use them in the real world. For example, Hyperledger is one of the open-source projects trying to solve businesses’ problems by providing a suite of tools, libraries, and frameworks that are enterprise-grade ready.
However, there are few questions that still need to be answered including where blockchain is stored.
In this article, we will learn how blockchain stores and transfers the data among its peers. So, where is blockchain data stored?
Build your identity as a certified blockchain expert with 101 Blockchains’ Blockchain Certifications designed to provide enhanced career prospects.
Decentralized – The Key To Change
The first thing that we will discuss include decentralization. It is the core concept of blockchain. With it, there is no need for a centralized authority to manage the network. The peers are more than capable of managing and validating the transactions using a consensus method.
In short, blockchain is a network of peers where a consensus method is used to validate transactions among peers.
This leads us to another interesting question.
Where does blockchain store data? Do the peers take care of it? Or it is equally managed by everyone in the network. The fact that this cannot be answered in just one line means that there are a lot of things that go into storing transactional data in the blockchain.
So, let’s get started to learn it.
But, before we go into detail, let’s first learn how Blockchain works.
How Blockchain Works?
You can think of blockchain as a ledger system where peers communicate and collaborate with each other for accessing and storing information.
To get a better understanding, let’s take two parties, Jim and Carry. Jim wants to send some money to Carry. To do so, he will initiate the transaction using his private key and Carry’s public address. The transaction is then allocated to the block. The block is then validated with the help of a consensus algorithm used by the network. The network verifies the transaction(s) using it. On
Once the transaction is verified completely, it is added to the blockchain, and Carry receives the amount. This information once written is immutable and hence cannot be changed once written.
This same process can be carried between two entities. It can be a bank, a company or a buyer who is looking to do transactions on the blockchain network.
Get familiar with the terms related to blockchain with Blockchain Basics Flashcards.
Where Blockchain is Stored?
Please include attribution to 101blockchains.com with this graphic. <a href='https://101blockchains.com/blockchain-infographics/'> <img src='https://101blockchains.com/wp-content/uploads/2020/06/where-blockchain-is-stored-1.png' alt='where blockchain is stored='0' /> </a>
So now that we have a proper understanding of blockchain, we are now ready to learn where blockchain is stored. The question can also be termed as “where blockchain data is stored?” The answers to both questions are the same.
Let’s get started.
When a transaction is made in a blockchain, the following data is transmitted.
- Transaction date and time
- The amount sent from the sender to receiver
- The sender address
- The receiver address
The transaction can contain other vital information that can be required to make the transaction successful.
Let’s try to understand it with the perspective of bitcoin. In a bitcoin transaction, the following information is stored and transmitted.
- Transaction date
- Amount sent
- Bitcoin address of the sender
- Bitcoin address of the receiver
A bitcoin block has a header which collects the transactions. These headers are back-linked to the main blockchain creating a chain of blocks and hence it is known as “block-chain.”
Technically the transaction structure can help us explain a lot of stuff.
class Transaction { public: const int32_t Version; const uint32_t NumberOfInputs; const vector<TransactionInput> CollectionOfInputs; const uint32_t NumberOfOutputs; const vector<TransactionOutput> CollectionOfOutputs; const uint32_t LockTimestamp; };
Here each field has its own purpose where the CollectionOfInputs is a vector of objects and contains transactions where BTC needs to be redeemed. On the other hand, CollectionofOutputs refers to the BTCs to spend and is also a vector of objects.
With all this information available, blockchain can quickly learn about the address balance without the need to query the address. This is really useful as it helps to not overburden the network.
As you can see things are not as simple as you see. There are a lot of things that go under the hood for the transactions to be generated, validated, and then stored in the block.
Wondering why you should really devote to a career in enterprise blockchains? Enroll Now: How to Build Your Career in Enterprise Blockchains
So, where does blockchain is stored?
The answer is not straightforward.
Blockchain is decentralized and hence there is no central place for it to be stored. That’s why it is stored in computers or systems all across the network. These systems or computers are known as nodes. Each of the nodes has one copy of the blockchain or in other words, the transactions that are done on the network.
So, you can think about the blockchain system similar to a spreadsheet where the values stored in each entry is the value of an address. Also, the spreadsheet is updated whenever a change happens.
Also, do you remember the Jim and Carry transaction example? If you do, then it is how the transaction is carried out, the data is generated, verified, and stored in the blockchain. Here, Jim and Carry both are termed as nodes. Jim uses his digital wallet to send the digital currency.
Also, the digital wallet is capable of connecting to the network and also has the list of other nodes and users. So, once Jim sends the transaction, it is transparent to the whole network.
It is broadcasted to the whole network that Jim has sent a certain amount to Carry. The broadcast is made until every other node knows about the transaction. Few nodes known as miners validate the transaction and once validation is done, the transaction becomes immutable and irreversible.
The whole process can take anywhere between a few minutes to a few hours depending on the network congestion.
Why would you want to store data on Blockchain?
Now that we have learned where blockchain is stored, it is now time to learn weather data can be stored in blockchain? The question is best aimed at developers who may want to use blockchain to store data. After all, blockchain offers extensive features including better security, immutability, and transparency.
However, the blockchain is ideal for storing massive amounts of data. Yes, it cannot be a database if you want to build a video streaming platform similar to Twitch for Youtube.
However, it is ideal for storing small amounts of data, but in large numbers of transactions. Blockchain networks are highly scalable and there are many variants of blockchain that are highly efficient in accessibility as well.
Types of Blockchain and How They Store Data
Bitcoin is the first cryptocurrency that utilized blockchain technology. It was the first generation of technology and left a lot of things for improvement.
Clearly, there were other blockchain solutions out there and the first blockchain platform to solve the majority of bitcoin blockchain technology problems as Ethereum. It was developed by Vitalik Buterin.
Data storage in Ethereum works differently compared to bitcoin. They use the tire data structure to ensure better accessibility, scalability and usability of the data.
It also separates the temporary data and mined transaction data. The data structure is also very efficient when it comes to managing permanent and temporary data. The data is recorded to the transaction trie only when the transaction is confirmed.
A state trie is used to store temporary data including account address and so on. This also enables data change in some cases.
In short, there are three types of trie in Ethereum blockchain:
- State Trie
- Storage Trie
- Transaction Trie
Another example that we want to go through is the Corda blockchain.
Corda is an open-source blockchain platform that is made for businesses. We covered Corda in detail where we discussed how it works. It is a distributed ledger technology which works differently compared to Ethereum or Blockchain.
Curious to learn the basic and advanced concepts of R3 Corda Development? Enroll Now: Beginner’s Guide to Corda Development
The difference is mainly on how it stores and manages data. First of all, it doesn’t have global broadcasts. The communication between peers is made in such a way that it can be verified without the need to download the whole data.
All of these are possible because it uses graphs and persistent queues. Each node is discoverable through the network map service, just like a phone address book.
Conclusion
This led us to the end of our article where we discussed how blockchain data is stored and maintained. There is no doubt that there are different ways to use different blockchain platforms or solutions. We also tried to look at two different solutions Corda and Ethereum and how they manage data on their network.