What is Substrate?
In this post, I will try to explain the Substrate blockchain framework in a way that anyone with a bit of technical experience could understand.
You may have heard before that Substrate is an extensible, modular, and open-source framework for building blockchains. But what does that mean?
Substrate provides you with all the core components needed to build a distributed blockchain network:
While these layers are extensible, Substrate mostly assumes the average blockchain developer should not care about the specific implementation details of these core components. Instead, Substrate's core philosophy is to make development of a blockchain's state transition function as flexible and easy as possible. This layer is called the Substrate runtime.
But before we dive into all these details, first we need to establish a common understanding of what a blockchain is...
What is a Blockchain?
In its most basic form, a blockchain is a simple data structure where blocks of data are linked together forming an ordered chain. The specific details of a blockchain can vary depending on the functionality of that chain. However, at a high level, all blockchains should share some common properties.
Blocks
Each block in a blockchain has some data that can be used to generate a unique identifier for that block. One part of this data is the unique identifier for the preceding block, known as the "parent block". Since each block has a pointer to its parent block, the blocks can be ordered in a deterministic way.
Any small changes to the data in a block will change its unique ID. Since this block's ID changed, the block that comes after it (the "child block") will also change. Same with the next child, and the next one, and the next... In fact, all the blocks that come after the originally modified block will have to change their unique ID in order to maintain the chain! This means that it is easy to verify that two blockchains have the exact same data by simply checking the unique identifier of the last block on the chain.
To learn more about these basics of a blockchain, visit the demo/videos found here: https://anders.com/blockchain/
Block Production
Due to these properties, blockchain systems are commonly used to keep track of a shared ledger. The contents of the ledger are changed not by changing an existing block, but by adding new blocks to the blockchain with instructions about how the state of the ledger should change from block to block. These instructions are commonly referred to as transactions.
There are usually rules associated with how the ledger can change, which are defined by a state transition function. For cryptocurrency systems, these rules can be quite simple; for example:
Rule: Users can only spend funds that they own.
These rules can also be more complex, even allowing for blockchain systems to act as a Turing complete computer, and the ledger acting as that computer's storage.
Once a valid set of transactions are collected, they are put into the content of a block, and then this block is placed at the end of the chain. This block production process allows the underlying state of the blockchain to change over time.