The blockchain facilitates countless transactions daily, from one point to another worldwide. With this amount of transactions happening simultaneously, keeping track of all the details is essential. This is where the Data layer comes in.
The Data layer is responsible for keeping track of and organizing all transactions in the form of blocks. To recall, the blockchain can be imagined as a bunch of blocks lined up and chained together. This is how the Data layer organizes the transactions.
Adding transactions to the blockchains can be simplified into three easy steps.
Once transactions are approved, the transaction is bundled into a block, the fundamental unit of a blockchain. But what exactly are inside these blocks?
A block is the basic unit of a blockchain which stores together various transactions. It is like a container for various transactions. Each block contains a header which is used to help differentiate it from other blocks. This is because the block header contains metadata which tells us specific information about it. Think of a block header as like an ID and the metadata being our name, age, birthday and such.
Typical block metadata comprises the following.
Recall: The data layer contains the details of various transactions. Once transactions are approved, their data is bundled up into a block, the fundamental unit of a blockchain. This block is then connected to all previous blocks forming a chain. Moreover, all this data is encrypted thus making it secure.
Let’s go over how the information in the data layer is actually secured:
As mentioned in our previous module, blocks are secured through the process of hashing. It is deterministic in that each input of data gives a set output in the blockchain and is irreversible so no one can backtrack the input from the output. Hashing ensures that if a bad actor tampers with data, it would be detected easily. Learn more about hashing here.
Another reason blocks are secure is due to digital signatures. They act as verifiable real-life signatures but are not prone to tampering and counterfeit. Digital signatures allow for encryption of data and are able to prove others ownership of funds without giving them direct access to it like banks. Learn more about digital signatures here.
The organization of data within the blockchain architecture offers several advantages:
Now that we've seen how data is securely structured within a block and understood the benefits of blockchain's data architecture, let's transition into exploring how this valuable data is accessed and communicated within the blockchain network.
One way to access data would be blockchain indexing. As more blocks are added to a blockchain, searching for specific data becomes more difficult. Generally, most data is collected in a scattered manner such that one would need to access specific transactions that occurred over a period of time. They would need to go over several blocks. This is because unlike other databases, blockchains lack a method to search for data. Blockchain’s node structure, though making it more secure, also makes it difficult to access data since they aren’t all stored in the same place. Blockchain indexing solves these issues by allowing you to search for specific data similar to using online search engines.
Another way to access data would be through Merkle trees. A Merkle tree is a data structure in computer science that allows for better security and encryption. It is visualized in a tree-like structure with leaves, branches and a root which represents hashes of transactions in a block. This is made from hashing pairs of transactions in a block until one hash is left.
The magic of the Merkle tree lies in its ability to simplify data efficiently by hashing pairs of transactions until a single hash remains. This is invaluable because, with the root hash in hand, anyone can verify whether a specific transaction is part of a block without the need to download the entire blockchain. This not only conserves storage space but also significantly speeds up the process of verifying and searching for information within the blockchain.
All of these parts in the data layer ensure that the blockchain’s various data are accessible and secure. Let’s now look at how this data circulates within the network.