Original title: "Cognitive Polkadot丨The epoch-making invention behind Polkadot: Substrate framework"
Original source: Polkadot Ecological Research Institute
/p>
When it comes to Polkadot, everyone immediately thinks of cross-chain, and thinks that cross-chain is a new rigid demand after the smart contract platform function of Ethereum. It is true that cross-chain is of great significance to the entire blockchain, but in fact this is only a part of Polkadot, that is, interoperability, and Polkadot has another very important meaning, which is scalability.
Because of the relay chain + parachain structure, Polkadot has Compared with other blockchain projects, it has unprecedented scalability and brings us more possibilities.
The combination of interoperability and scalability makes Polkadot become However, when we dig deep into the technical architecture behind Polkadot, we have to mention an epoch-making invention behind it—the Substrate framework.
If Polkadot is a tall building, then Substrate can be described as It is the reinforced concrete frame of this building that allowed Polkadot to successfully complete the construction of skyscrapers. Therefore, it is of great significance to understand the birth and development of Substrate.
At the Web3 Summit held in 2018, Dr. Gavin, the founder of Polkadot, developed a brand new blockchain within 15 minutes using an original Mac computer, which shocked the world at the time. At the same time, the information spread throughout the entire blockchain circle, and the development tool used was a brand-new blockchain technology framework called Substrate by Parity.
This may be another person who makes the blockchain circle I feel what is called "the power of technology". After all, before 2018, those blockchain projects clamoring to develop a public chain claimed that the difficulty was too high, and it would take months or even years to complete. KO'd for 15 minutes by a framework called Substrate.

p>
The time went back to 2016, when Dr. Gavin already had some preliminary ideas for Polkadot, and the general direction was basically thinking along the idea of sharding, so that the functions of different chains could pass through "A certain intermediate bridge" is linked to improve the scalability of the blockchain network. Following this important concept, we have seen the subsequent parallel chain and relay chain.
Dr. Gavin's experience in developing Ethereum, Parity The development team found that they were repeating the same work they had done on the Ethereum and Bitcoin clients before - building some basic codes of the blockchain, such as accounts, smart contracts, governance and other functions is essentially a similar logical structure , So they imagined whether they could develop something similar to a "module" to simplify the basic development of the blockchain, which would not only liberate developers, but also lower the threshold for blockchain development.
So, they built a The Substrate we see now is just that they didn't expect the power of this framework to be far beyond their imagination.
< p>
Before, we explained the birth of Substrate in plain language. In fact, from this process, we can probably see what role Substrate plays. In the words of Polkadot co-founder Robert Habermeier, "Substrate is a set of libraries for all the annoying things that go into writing a blockchain."
p>
So where exactly are the innovations and advantages of Substrate, we try to further analyze it logically and from the technology itself.
From the perspective of developers, Substrate greatly simplifies the workload of developers participating in the blockchain, which means that the original blockchain development requires at least another A large team provides technical support, but Substrate will integrate core modules (database, public/private key generation, RPC, etc.), basic logic (data structure, settlement, time stamp), P2P network and consensus mechanism, and even on-chain governance Such functions are embedded in Substrate and become callable modules, thus greatly saving the development cycle and development process.
And Substrate is a completely free and open source framework, which means that the world needs Developers are free to use the framework, and it is built through the Rust programming language, which can help developers complete software development quickly and safely.
Just like the full English name of Substrate: A substance or layer that Underlies something, or on which some process occurs.
< p>2. Multiple choices can meet different needs
Of course, some people may question whether the modularization of Substrate will be rigid? In fact, Substrate is a multi-layer architecture, which allows developers to choose between the convenience of development and the freedom of technology. The specific three-layer structure is Substrate Core (with Polkadot-Core integration), Substrate SRML and Substrate Node. .
Specifically, as shown in the figure, from top to Under this condition, technical freedom decreases, abstraction decreases, and dependence increases. Substrate Core is the module used to build the smallest framework of the blockchain, and it is also the most basic layer in the Substrate framework, which can provide modules such as storage, consensus, transaction queue and block production mechanism and low-level JavaScript utilities. The lower SRML layer is simpler. All the developer has to do is to select the group building he needs from the module and set the parameters. Finally, there is Substrate Node, which can be said to be the application layer of the framework. You only need to provide a JSON configuration file to get a complete smart contract blockchain.

p>
And if you need to build your own blockchain from scratch, Just start with the top Polkadot Core block. Therefore, Substrate is not completely modular. In fact, its degree of freedom is still very high, which can meet the various needs of developers, which perfectly confirms the state of "think what you think, do what you do, and listen to your heart". .
< p>3. Runtime update without fork
We know that the phenomenon of "fork" is indispensable in the blockchain world, and traditional forks not only weaken the power of the blockchain network itself, but may even cause serious damage due to inadequate forks. Some projects bring catastrophe. And one of the most exciting features brought by Substrate is the fork-free Runtime upgrade.
As we have introduced in previous articles, based on In Substrate's chain, the chain itself stores something called a WebAssembly Blob or WASM Blob. This blob contains all the logic needed for the chain to build new blocks. The runtime of the chain itself is included in this WASM blob. If you need to modify the relevant information of the blockchain, you only need to combine the governance referendum on the chain. If the votes are passed, the corresponding upgrade, thereby reducing the impact of hard forks.
So the blockchain developed based on Substrate (like Polkadot) Naturally solved the problems caused by the hard fork, so on August 15th, Parity engineer Bastian tweeted that Polkadot's parachain test network Rococo for the first time performed a fork-free Runtime upgrade, which perfectly implemented the solution.
< p>
p>
1. Substrate is Polkadot?
Polkadot is a blockchain project based on the Substrate framework, and the Substrate framework, more appropriately, It is a tool that can be customized to build a blockchain. But Substrate is essentially a general blockchain template after Polkadot is streamlined.
Polkadot’s parallel chain and the chain generated by Substrate can exist independently, of course, Substrate can also be used The framework directly builds Polkadot's parachains, and the relationship between the two can be illustrated with the following figure.

p>
3 , Will the chain issued by Substrate replace other blockchains?
Many friends have been worrying about whether Polkadot and Ethereum 2.0 are in a competitive relationship. In fact, the Substrate framework and Polkadot are not intended to replace existing infrastructure. Their starting points are different. The vision of the Substrate framework and Polkadot is to be an ecology of the chain. It is not in competition with a single blockchain. On the contrary, it plays the role of connecting various chains and filling the gap in engineering possibilities.
Since the parallel chain is connected to the Polkadot blockchain, Its security is secured by Polkadot's relay chain, so it cannot choose its own consensus mechanism. If a blockchain wants to use its own consensus mechanism, or already has a mature blockchain with a different consensus mechanism from Polkadot, such as Bitcoin and Ethereum, then they can use a parallel chain as a "bridge" The function is to connect Polkadot, which is the transfer bridge in Polkadot.
< p>4. Substrate can only be used for public chain development?
Some people may think that Substrate can only be used for public chain development, but it is not the case, Substrate itself is a development The framework does not limit whether it can only be used for public chain development. On the contrary, because of its technological innovation, Substrate will be an important bridge between public chains, ecology and alliance chains.
For example, Polkadot's relay chain is designed to allow parallel Chains authenticate and interact with them through block verification nodes, and similarly, each parachain can also exist as a relay chain of other peripheral parachains, infinitely expandable, but it doesn’t really matter whether the parachain is a consortium chain or a public chain. As long as it can be connected, the interaction can be completed.
< p>
When Substrate appeared in a dazzling manner in 2018, in addition to marveling at the speed of its "chain development", people may be more likely to have unlimited expectations for the future. Now, with the development of the Polkadot ecology With the development, Substrate seems to be getting more and more stable, and we have also seen some different things, and these things may make Substrate go further.
< br>
1. One-click chain issuance opens the next stage of the blockchain
< /p>
2017 is the year when the blockchain ecology exploded. As the Ethereum technology gradually matures and is recognized by more and more people, Many developers realized that they could launch their own envisioned blockchain projects based on Ethereum.
The usual practice is that the project founding team first The combination of blockchain and a certain industry, design a blockchain application, own or design a more advanced public chain, and then carry out financing based on the function of ETH one-click currency issuance, and distribute the corresponding amount according to the proportion of each person's financing This application or the Token of this public chain, and then have funds and then slowly burn money to make this application's private chain or public chain. After this chain is completed, the currency is transferred to the next chain through one-to-one mapping, which completes the development process of a chain.
However, the ideal is full, but the reality does not buy it. Because it is easy to issue digital assets on Ethereum, but the difficulty of building a public chain has risen several levels. To issue digital assets on Ethereum, you only need to learn smart contracts, and then you can make them with a few lines of code. Because of this convenience and speed, it is said that Ethereum is a one-click coin issuance.
But to be a public chain, especially from the bottom It is even more difficult to logically reconstruct the blockchain. The requirements for technical talents include understanding the codes and principles of well-known blockchains, such as Bitcoin, Ethereum, etc., understanding various mainstream consensus algorithms, and understanding smart contracts. In addition, the technical team must have Professionals and even experts in cryptography, distributed systems, and network security. The most difficult of these lies in cryptography, and some public chains are even the Nobel Prizes in computers—initiated by Turing Award winners.
So, blockchain talents will be hard to find, Someone once hoped to recruit a senior blockchain architect to be the CTO of their public chain, but they couldn't recruit anyone with an annual salary of more than one million. After all, people with this ability have gone to work on their own projects.
This is only a problem of high labor costs on the public chain, and One problem is that the research and development of the public chain is difficult and the research and development cycle is long. For a slightly more complicated project, the research and development will take a year or a half, and for a more difficult project, it will take several years. It can be seen that the June of 2020 was postponed to October of 2020.

p>
From this point of view, building a public chain project is a huge project that is costly and time-consuming. However, this problem that has plagued the blockchain field for many years is easily resolved by the Substrate framework. It only takes one person and 15 minutes to create a blockchain with customized functions. The Substrate framework has raised the convenience of one-click issuance of coins to the level of "one-click issuance of chains". It seems to be an understatement only to reduce costs and R&D cycles, but it is actually an epoch-making step.
Why is it epoch-making? This is equivalent to the fact that only supercomputers At that time, the microcomputer was suddenly born, so that the computer is no longer exclusive to individual organizations, but an electronic device that everyone can easily use. This is how the Internet was born later, and the Internet ecology is now developed. Similarly, the Substrate framework has also taken an important step in simplifying the complexity of the computer revolution.
< p>
2. Blockchain applications mature quickly
Before the emergence of the Substrate framework, for a team that wanted to make a blockchain application, it was equivalent to making an app in the Internet era, and it would take 90% of the time and money to integrate the Android system Together, now with Substrate's one-click release chain, it can be developed as easily as checking in with a bag, and the main time and energy are devoted to improving the business level of the application itself.
But traditional blockchain applications have another problem , the system will restrict the development of applications. In order to introduce new features or change existing rules, the system is often upgraded by changing the rules of the underlying protocol. However, the system upgrade of the traditional blockchain needs to be upgraded through a hard fork, which greatly increases the difficulty of the work.
Imagine, if the system of the Apple mobile phone is upgraded every time The upgrade can only be considered successful if more than half of the people upgrade, which is very demanding for the fault tolerance of the system. If there is a problem during the upgrade process, it may lead to the loss of the user's digital assets, and it is possible for the user to split into two ecology.
But this is not a problem for the Substrate framework. The Substrate framework allows the system to be upgraded without a hard fork, creating a robust, secure, and fast-changeable system, which is worry-free for blockchain applications.
In addition, the Substrate framework has many functional modules, making a Highly customized blockchain is also very easy, or if you want to adjust some functions due to the needs of the project later, you can also increase or decrease at will, which is very flexible and free. The emergence of Substrate is like the birth of the Linux system in the Internet, which will provide an important foundation for the development of subsequent industries. With Linux, there is Android, Huawei, Xiaomi, and Samsung mobile phones. In the same way, with Substrate, there will be a lot of excellent related applications and projects in the blockchain industry in the future.
The Substrate framework solves the most The problem of building the main chain with money and time ensures that the operating system of the application keeps pace with the times. At the same time, the rich functional module library meets the various functional requirements of the blockchain project, which greatly shortens the development of the blockchain application from the early stage. The mature cycle also accelerates the iterative evolution of the project. It can be foreseen that a golden age of blockchain application development is coming.
< p>
3. Blockchain ecological development will accelerate to bloom
Before the one-click issuance of the Substrate framework, a project began to accept the test of landing from fundraising to launching the main network. , and the Substrate framework can reduce this time to months, which not only accelerates the iteration time of a single project, but also means that the evolution speed of the blockchain ecology is as fast as eight times.
Looking back at blockchain projects in recent years, many projects Since the issuance of digital assets, the main network was not launched until two or three years later, and it began to accept the test of landing. The entire process takes years. Many projects have been in the dark after they go online due to operational problems, project design problems, and economic model issues. , leading to chronic death, and some project parties, citing the difficulty of research and development, have been reluctant to launch the main network for a long time, fearing that they will die as soon as they are launched on the market.
Such a phenomenon is actually bound to happen, just as the Internet began to rise back then, people flocked to all kinds of portals, but in the end it was all in one place chicken feathers. With the rise of the mobile Internet, various O2O applications emerge in endlessly, which is dazzling, but how many are left now? Once the success is complete, the maturity of an industry will inevitably go through brutal growth, and in the end, after the big waves wash away the sand, what remains are truly practical and valuable projects.
The same is true for the blockchain industry, all kinds of public chains, DApp, DeFi and other projects are more than tens of thousands, and only a hundred of the truly valuable ones have survived. How much capital has been turned into the cost of new technology exploration with the ups and downs of the previous two years. Nevertheless, this newly developed blue ocean, like a vortex, will still attract more talent and capital investment, until the real value of the blockchain is discovered.
The Substrate framework is undoubtedly for the entire blockchain ecosystem Development, pressed the fast forward button. The speed of project iteration is accelerating, more and more people and capital are involved, more projects will die, and projects that find the true value of blockchain will be getting closer and closer to us.
The spark has appeared, the lead has been ignited, the blockchain ecology It will bloom like bright fireworks before dawn, and it will welcome a sunny day.
< p>
Before we mentioned a lot about the advantages and uniqueness of Substrate convenience, so how to get started? We published an article called "Substrate One-click Chain Posting Minimalist Tutorial" published by PolkaWorld last year (original link: www .polkaworld.org/articles/substrate-simple-tutorial) article to share with you, interested readers can try it out, and there may be unexpected gains.
< /p>
p>
The Substrate 2.0 version was launched at the end of September this year, and the new version brings new features - off-chain workers and more than 70 composable modules. Off-chain workers securely integrate data onto the blockchain, ideal for Internet of Things (IoT) devices or actual data entry via oracles (Oracles).
This also reflects the excellent scalability of Substrate and Polkadot Even if the functional modules are not involved at present, they can also be added in the future, so as to truly keep pace with the times.
At the beginning of November, the V1 version of the parachain has been launched. The launch is imminent. If this function is successfully launched, it means that Polkadot will start a real cross-chain, and Substrate will soon usher in a bigger stage.
From the perspective of the development of the times, as the torrent of the times As far as we are concerned, it is difficult to really judge the core development path of a thing, but we can see more possibilities through the mirror of history, and the birth of Substrate may be called a An important turning point in the development of the blockchain field is like the "smart contract" many years ago, so this is the best story
Reference materials:
1. Introduction to Polkadot's Substrate base chain
2. Polkadot's one-click chain issuance, How to use Substrate to build a blockchain?
3. In-depth understanding of Substrate 2.0
4. Video | Substrate is the general framework for the next generation of blockchain
5. Substrate 2.0 is here!
6. Substrate, the next-generation blockchain development framework, is quietly being studied by the tech giants!
7, PolkaWorld 丨Summary, everything about Polkadot and Substrate
8, Substrate has arrived
9. Substrate in a nutshell
Original link
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia