Risk Warning: Beware of illegal fundraising in the name of 'virtual currency' and 'blockchain'. — Five departments including the Banking and Insurance Regulatory Commission
Information
Discover
Search
Login
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt
BTC
ETH
HTX
SOL
BNB
View Market
Polkadot one-click chain issuance: how to use Substrate to build a blockchain?
贝数区块链
特邀专栏作者
2020-02-27 10:36
This article is about 4002 words, reading the full article takes about 6 minutes
Substrate is not Polkadot. Although Substrate can easily build a blockchain for Polkadot, the blockchain in the Polkadot network does not need to use Substrate. Even if you don't want to connect your blockchain to Polkadot.

In the previous article, we talked about the founder of Polkadot Polkadot and the blockchain technology Polkadot.

If you've followed Polkadot's progress, you've probably seen the word "Substrate" a lot. It is an important part of the Polkadot project.

Beishu Blockchain believes that if there is no cross-chain technology, the blockchain built on Ethereum will not be able to retrieve data from other blockchains, and will not be able to run smart contracts, nor can it achieve cross-chain transfers. A closed blockchain is not decentralized in nature, only the Internet formed by the entire blockchain network is the real blockchain when cross-chain is realized. In other words, without cross-chain technology, blockchain cannot be fully applied to life.

Substrate: The best blockchain building tool

Substrate is also a project from Polkadot, a larger vision with many interoperable blockchains. Substrate not only facilitates the construction of blockchains, but also builds all blockchains connected to the public network. Substrate hopes to become the absolute best platform for blockchain innovators in the future, and the natural choice for anyone who is considering building a blockchain.

In order to effectively build many different (heterogeneous) blockchains for the Polkadot ecosystem, Parity developers put all the functions needed to build blockchains into a framework called Substrate. The things learned during the development of Ethereum and Bitcoin are used as simple and easy as possible to create a blockchain.

Substrate is not Polkadot. Although Substrate can easily build a blockchain for Polkadot, the blockchain in the Polkadot network does not need to use Substrate. Even if you don't want to connect your blockchain to Polkadot, you will still find that Substrate is a very useful framework for creating state-of-the-art blockchains.

In March 2019, at the Consensus conference in New York, Polymath announced the development of an underlying blockchain. The blockchain, called Polymesh, is a public chain designed from the ground up. This public chain will empower compliant tokenized assets and change our thinking about securities in the regulated market. This public chain is built based on the excellent framework of Parity Substrate.

Polymath helps people create and manage security tokens more easily. The platform simplifies the complex technology of creating security tokens, hoping to bring the multi-trillion dollar financial securities market to the blockchain field.

The core idea of ​​Substrate is to make the development of the state transition function (State Transition) of the blockchain as flexible and easy as possible. This layer is called "Substrate runtime" - the function code that executes the logic of the chain. Substrate has built-in all the core components required to build a blockchain: database, networking, transaction queue, and consensus.

Substrate runtime is divided into multiple separate logical components (logical components), these logical components are called runtime modules. Modules can be understood as "plug-ins" for the entire building system. The modules are pre-installed in the substrate, and you can import them into your own blockchain construction framework by selecting what you need in the module library.

For example, the "balance" module is used to manage the currency of the chain; such as "democracy" and "election", which are used to set decision-making and governance mechanisms. Another example is the "contract" module, which can convert the function of this chain into a smart contract platform with one click.

If you want to use Substrate to build a new project, all you have to do is implement a very small number of hooks in your code, and you get:

1. Consensus, finality and block voting logic. This is desirable even if you are not building a cryptocurrency, and means you get Byzantine Fault Tolerant consensus for free. Therefore, even if some nodes in the system are compromised or turned into malicious nodes, the system can continue to work normally;

2. An efficient and deterministic sandbox WebAssembly runtime (application runtime environment), which can be used to run smart contracts and even run other Substrate-based projects. The Polkadot team strongly believes in the benefits of using the WebAssembly runtime, and by doing so you can take advantage of the tools the global development community has created for it;

3. Ability to seamlessly run nodes in a browser, it can communicate with any desktop or cloud node;

4. Cross-platform database and file storage abstraction, even it can work in the browser;

5. Seamless client updates, any updates that may affect the consensus, are handled by compiling the code to WebAssembly and deploying it as another message on the network. Not only that, but you can store as many versions of the consensus code as you want, and Substrate will handle the complexity of ensuring that the native code being executed is consistent with the currently deployed WebAssembly code.

6. When the Polkadot network is officially launched, you can immediately seamlessly connect your project with the Polkadot network.

Another great feature of Substrate is its forkless upgrades. The governance and forks of the public chain have caused many organizations to have concerns when embracing the blockchain. After all, a controversial fork will bring serious risks, and it will also force institutions to spend resources to set up a risk control team to deal with this problem.

There are many cross-chain projects, why do you think Polkadot has a greater advantage?

Polkadot provides its own accounting books, allowing the whole world to use its own books, so that all blockchain projects can achieve asset exchange; the chain connected to Polkadot is called a parachain (corresponding to Zone), and the parachain is mainly responsible for data. operations and processing of transaction information. Through multiple parallel chains, the horizontal expansion of the blockchain can be completed, that is, the performance problem of the blockchain can be solved. The chain connecting the parallel chains is called the relay chain (corresponding to the Hub). The relay chain is a center of Polkadot. The main function is to verify the blocks given by each parallel chain and give the final deterministic prove.


Relay chain: The relay chain is responsible for maintaining the consensus of each parallel chain, confirming (deciding) the finality of each block, and the governance of the entire Polkadot.

It is like a government affairs hall system, which connects various departments (parallel chains), and each department is responsible for business records and processing, final review and confirmation of business, and transmission of information to other departments are all handled by the government affairs hall.

Parallel chain: Parallel chain is an independent and equal blockchain ecology. Different from the general blockchain, the confirmation of the block and the governance of the ecology are handed over to the relay chain to complete.

Just like the previous example of the government affairs hall, the parachains are various departments, and they all have different functions, but they don’t need to make a separate system for each department, they can directly use the system of the government affairs hall (the relay chain ensures that each Consensus unification of parallel chains). But this system is decentralized.

Transfer bridge: The transfer bridge is a special kind of parallel chain, which is used to connect some existing links that cannot be directly connected to the relay chain.

A bridge is a converter. For example, Polkadot is an Apple system, and its connecting cable is also an interface of the Apple system, while other chains are like Android devices, which are USB3.0 interfaces. To connect to Polkadot, you need an Apple -The Android adapter can be connected, and this adapter is the bridge.

Polkadot connects a series of blockchains from general-purpose chains to application-specific chains to create a platform that supports more advanced applications. Some examples of such advanced applications utilizing cross-chain arbitrary messaging:

1. The oracle (Oracle) service that uploads real-world data to the chain

2. An identity management system that links user identities across multiple applications

3. Order books and custody of decentralized exchanges

4. An Internet of Things (IoT) network that receives messages from other networks or controllers

5. Cross-chain smart contract call

6. Message passing between private chain and public chain

The role of parachains

The main purpose of the parachain is to develop specific practical functions. Because consensus, governance, and message routing are all governed by the relay chain. So parallel chain operation will be very simple and safe. You only need to focus on the business functions you want to develop and develop.

For example, the ChainX parachain only needs to cross-chain with light nodes of both sides of the currently running ChainX chain, and any digital currency that has been docked in ChainX can be crossed to the Polkadot ecosystem for use by any parachain in the Polkadot ecosystem.

The role of the relay chain (Relay Chain):

1. Management of the entire Polkadot consensus:

The consensus nodes of all chains in Polkadot (including relay chains and parachains) are managed, allocated and scheduled by the relay chain. The parallel chain only needs to register information with the relay chain through a fixed interface,
After the review and confirmation of the relay chain, a part of consensus nodes can be randomly assigned to the parachain to maintain the security of the parachain.

2. Routing of message communication in Polkadot:

The relay chain will manage the routing table of the global parallel chain so that messages between the various parallel chains can collude with each other.

3. Global governance:

The relay chain is the main staking object of currency holders, and currency holders can participate in the governance of the entire Polkadot ecosystem through democratic voting. Such as (system upgrade, punishment for doing evil)

How does Polkadot solve scalability?

1. A main chain can be linked with various parallel chains, and the parallel chains can be connected through the transfer bridge.

2. The security of the parallel chain can be concentrated in the main chain to form a security pool.

3. Each parallel chain can be connected to each other through the relay chain, including the call of the smart contract.

There are two different consensuses in the Polkadot network, namely GRANDPA and BABE. The reason why there are two different consensuses is that Polkadot adopts a hybrid consensus approach. Here the hybrid consensus separates block generation from block finalization, where BABE consensus is used for block generation, and GRANDPA consensus is used for block determination. BABE is a slot-based algorithm. It divides time into time segments, and each time segment is divided into time slots. In Polkadot, the time gap between our target blocks is six seconds long. BABE will select an author (or authors) to create a block in each slot.

The first rule for choosing the best extended chain is simple: BABE must build on the chain finalized by GRANDPA. This is one of the requirements for using GRANDPA.

The first rule for choosing the best extended chain is simple: BABE must build on the chain finalized by GRANDPA. This is one of the requirements for using GRANDPA.

The best chain at BABE is simply the one with the most blocks created by the original creator.

The best chain at BABE is simply the one with the most blocks created by the original creator.

Polkadot's current goal is to prepare for a new round of public offering, debug the new Westend testnet, a new relay, a new experimental site, until the network is stable. The initial parachains may be system utilities. (Relay chain offload function, etc.)

The layered relay chain ("infinite scalability" or Polkadot 2.0) will undergo initial research this year, be developed next year, and initially deployed in the first quarter of 2022.

Disclaimer: The information published in this article does not represent any investment suggestion of the company, nor does it constitute any investment advice. The picture is from the Internet. If there is any infringement, please contact to delete it. Please note the source for reprinting.

Follow the official Weibo of Beishu blockchain (WeChat ID: shuliancj), join the community and become a great master with me.

Disclaimer: The information published in this article does not represent any investment suggestion of the company, nor does it constitute any investment advice. The picture is from the Internet. If there is any infringement, please contact to delete it. Please note the source for reprinting.

跨链
Polkadot
公链
Welcome to Join Odaily Official Community