为广大币圈朋友提供币圈基础入门专业知识!
当前位置首页 > 区块链知识> 正文

区块链的数据结构包含哪些内容,区块链的数据结构包含哪些类型

发布时间:2023-12-06-08:24:00 来源:网络 区块链知识 区块   数据结构

区块链的数据结构包含哪些内容,区块链的数据结构包含哪些类型


请查看相关英文文档

『一』What is the six-layer model of the blockchain?

The blockchain has a total of six hierarchical structures. These six hierarchical structures from bottom to top are: data layer, network layer, consensus layer, incentive layer, contract layer, and application layer.
1. Data Layer
The data layer is the bottom layer of the six-level structure of the blockchain. We can understand the data layer as a database, but for blockchain, this database is an immutable and distributed database, which is what we call a "distributed ledger".
On the data layer, that is, on this "distributed ledger", the data information on the blockchain is stored, encapsulating the blockchain structure of the block, asymmetric encryption technology, hash algorithm and other technologies Means to ensure the security of data when it is disclosed to the entire network. The specific approach is:
On the blockchain network, nodes use consensus algorithms to maintain the consistency of data in the data layer (that is, this distributed database), using asymmetric encryption and hash algorithms in cryptography. , to ensure that this distributed database cannot be tampered with and is traceable.
This constitutes the lowest level data structure in blockchain technology. However, it is not enough to have a distributed database. The data information in the database also needs to be shared and exchanged. Next, we introduce the upper layer of the data layer - the network layer.
2. Network layer
The network system of the blockchain is essentially a P2P (point-to-point) network. Point-to-point means that there is no need for an intermediate link or centralized server to control the system. Everything in the network Resources and services are allocated to each node, and information can be transmitted directly between the two nodes. However, it should be noted that P2P
(peer-to-peer) was not invented by Satoshi Nakamoto. Blockchain just incorporates this technology.
So, the network layer of the blockchain is actually a particularly powerful peer-to-peer network system. In this system, each node can both produce and receive information, just like sending emails. You can write your own emails or receive emails sent to you by others.
On the blockchain network, nodes need to jointly maintain the blockchain system. Whenever a node creates a new block, it needs to notify other nodes in the form of broadcast, and other nodes receive After receiving the information, the block is verified, and then a new block is created based on the block. In this way, the entire network can jointly maintain and update the general ledger of the blockchain system.
However, what rules should the entire network follow to maintain and update the general ledger of the blockchain system? This involves the so-called "laws and regulations" (rules), which is what we will introduce next: the consensus layer.
3. Consensus Layer
In the world of blockchain, consensus, simply put, means that the entire network must maintain and update the general ledger of the blockchain system according to a unified and agreed-upon rule. Similar to the rules for updating data. highly dispersedNodes efficiently reach consensus in a decentralized blockchain network, which is one of the core technologies of the blockchain and the governance mechanism of the blockchain community.
The current mainstream consensus mechanism algorithms include: Bitcoin's Proof of Work (POW), Ethereum's Proof of Stake
(POS), EOS's Delegated Proof of Stake (DPOS), etc.
We have now introduced the data layer, network layer, and consensus layer. These three layers ensure that there is data and network on the blockchain, and there are rules for updating data on the network. However, there is no free lunch in the world. How to make it happen? Nodes can actively participate in the maintenance of the blockchain system. This involves incentives, which is what we will introduce below: the incentive layer.
4. Incentive layer
The incentive layer is the so-called mining mechanism. The mining mechanism can actually be understood as an incentive mechanism: how much you contribute to the blockchain system, you can get as many rewards as you want. Using this incentive mechanism, nodes across the entire network can be encouraged to participate in data recording and maintenance on the blockchain.
The mining mechanism and the consensus mechanism are actually the same. The consensus mechanism can be understood as the company's general rules and regulations, and the mining mechanism can be understood as, within this general rules and regulations, what you have done can What kind of reward you get, this kind of reward rules.
Just like Bitcoin’s consensus mechanism PoW, its stipulation is that the more work you do, the more you gain. Whoever can find the correct hash value first can get a certain amount of Bitcoin rewards;
And Ethereum PoS stipulates that the longer who holds the currency, the greater the probability of receiving rewards.
It should be noted that the incentive layer is generally only available in public chains, because public chains must rely on nodes across the entire network to jointly maintain data, so there must be such an incentive mechanism to encourage nodes throughout the network to participate in the blockchain system. Construction and maintenance to ensure the security and reliability of the blockchain system.
The blockchain is safe and reliable, but it is not smart enough, right? The contract layer we will introduce below can make the blockchain system more intelligent.
5. Contract Layer
The contract layer mainly includes various scripts, codes, algorithm mechanisms and smart contracts, and is the basis for blockchain programmability. The "smart contract" we are talking about belongs to the contract layer.
If the Bitcoin system is not smart enough, then the "smart contracts" proposed by Ethereum can meet many application scenarios. The principle of the contract layer is mainly to embed code into the blockchain system and use this method to implement customizable smart contracts. In this way, on the blockchain system, once the terms of the smart contract are triggered, the system can automatically execute the order.
6. Application Layer
The last is the application layer. The application layer is very simple. As the name suggests, it is the various application scenarios and cases of blockchain. The "blockchain+" we are talking about now is the so-called application layer. The blockchain applications that have been implemented so far are mainly various blockchain applications built on public chains such as ETH and EOS.There are many color and game applications, but truly practical applications have yet to appear.

『二』What does the blockchain industry architecture include

The architecture model of blockchain technology is as follows:

1. Data layer

The data layer encapsulates the underlying data blocks and related data encryption and timestamp technologies;

2. Network layer

The network layer includes distributed networking mechanism, data dissemination mechanism and data verification mechanism;

3. Consensus layer

The consensus layer mainly Encapsulates Mingsong's various consensus algorithms of network nodes;

4. Incentive layer

The incentive layer integrates economic factors into the blockchain technology system , mainly including the issuance mechanism and distribution mechanism of economic incentives;

5. Contract layer

The contract layer mainly encapsulates various scripts, algorithms and smart contracts , is the basis of the programmable features of the blockchain;

6. Application layer

The application layer encapsulates various application scenarios and case.

『三』 What are the three sets of metadata contained in the block header in blockchain technology

1. The hash value of the previous block. Used for pre-index blocks
2. Mining difficulty, random value (for proof of work calculation), timestamp
3. Merkel tree, which can summarize and quickly summarize the verification blocks The root data of all transaction data.

『四』What are the blockchain technology frameworks

The current mainstream blockchain architecture contains six levels: network layer, data layer, consensus layer, incentive layer, and contract layer and application layer. The positions of the data layer and the network layer are reversed in the figure, and their main uses will be detailed in the next section.
Network layer: The essence of the blockchain network is a P2P (Peer-to-peer) network. The resources and services in the network are scattered on all nodes. The transmission of information and the implementation of services are directly between the nodes. It can be carried out in a short period of time without the intervention of intermediate links and servers. Each node both receives and generates information. The nodes synchronize information by maintaining a common blockchain. When a node creates a new block, it notifies other nodes in the form of broadcast, and other nodes receive the information. The block is then verified and a new block is created based on the block, thereby achieving the role of the entire network jointly maintaining an underlying ledger. Therefore, the network layer will involve the design of P2P network, propagation mechanism, verification mechanism, etc. Obviously, these designs can affect the confirmation speed of block information. The network layer can be used as a research direction in the scalable solution of blockchain technology;
Data layer: The underlying data of the blockchain is a block + linked list data structure, which includes data blocks, chain structures, timestamps, hash functions, Merkle trees, asymmetric encryption and other designs. The data block, chain structure can be used as an improvement direction for data layer research on the scalable solution of blockchain technology.
Consensus layer: It is the basis for highly dispersed nodes to achieve rapid consensus on the validity of block data. The main consensus mechanisms include POW (Proof Of Work) and POS (Proof of Stake). Mechanism), DPOS (Delegated Proof of Stake Delegated Proof of Stake Mechanism) and PBFT (Practical Byzantine Fault Tolerance), etc., which have always been the highlight of the scalable solutions of blockchain technology.
Incentive layer: It is what everyone often calls a mining mechanism. It is used to design a certain economic incentive model and encourage nodes to participate in the security verification of the blockchain, including the design of issuance mechanisms and distribution mechanisms, etc. This level of improvement does not seem to be directly related to blockchain scalability.
Contract layer: mainly refers to various script codes, algorithm mechanisms, smart contracts, etc. Strictly speaking, this layer is missing in the first generation of blockchains, so they can only conduct transactions and cannot be used in other fields or perform other logical processing. The emergence of the contract layer makes it possible to use blockchains in other fields. has become a reality. This part of Ethereum includes two parts: EVM (Ethereum Virtual Machine) and smart contracts. Improvements at this level seem to provide potential new directions for blockchain scalability, but there seems to be no direct connection in structure
Application layer: It is the display layer of the blockchain, including various application scenarios and cases. . For example, Ethereum uses truffle and web3-js. The application layer of the blockchain can be the mobile terminal, the web terminal, or it can be integrated into the existing server, and the current business server is regarded as the application layer. Improvements at this level seem to provide potential new directions for blockchain scalability, but there does not seem to be a direct connection in structure.
The Xueshuo Innovation Blockchain Technology Workstation under Lianqiao Education Online is the only approved "Blockchain Technology Professional" pilot of the "Smart Learning Workshop 2020- Xueshuo Innovation Workstation" launched by the School Planning, Construction and Development Center of the Ministry of Education of China. workstation. The professional base is based on providing students with diversified growth paths, promoting the reform of the training model integrating professional degree research, production, and research, and building an applied and compound talent training system.

『Wu』 What exactly is the blockchain?

What exactly is the blockchain? In essence, blockchain is a distributed, decentralized network database system that will make the storage, update, maintenance, and operation of data different. Blockchain has four indispensable core technologies, namely: distributed storage, consensus mechanism, cryptography principles, and smart contracts.

Then let’s talk about how blockchain is different from traditional data processing to help everyone understand what blockchain is and give everyone an understanding of blockchain.General awareness.

1. Data storage in blockchain: block chain data structure

In terms of data storage, blockchain technology utilizes "block chain data structure" To verify and store data.

What does the blockchain structure mean? Everyone has seen an iron chain, with one link within another. In fact, each link can be regarded as a block, and many links are linked together to form a blockchain.

How does this so-called "iron chain" store data? To put it simply, the difference between blockchain and ordinary stored data is that on blockchain, the data in the next block includes the data in the previous block.

Take reading as an example: when we read a book, we finish page 1, then page 2, page 3...
What about in the blockchain? If each block is marked with a page number, then the content on page 2 contains the content on page 1, the content on page 3 contains the content on page 1 and page 2...Page 10 contains The content of the first 9 pages is such a chain nested layer by layer. In this way, the most original data can be traced back. This is the traceability of the blockchain.

The "blockchain data structure" of blockchain makes it traceable, which is naturally suitable for many fields, such as: food traceability, drug traceability, etc. In this way, the probability of tainted milk powder, fake vaccines, and fake and substandard food incidents will be greatly reduced, because once a problem occurs, through traceability, we can clearly know which link caused the problem, and accountability and recovery will be clearer.

2. Data update in the blockchain: distributed node consensus algorithm

In terms of data update, blockchain technology uses the "distributed node consensus algorithm" to Generate and update data.

Every time a new block is generated (that is, when data is updated), an algorithm needs to be used to obtain the approval of more than 51% of the nodes in the entire network to form a new block. To put it bluntly, it is a vote, and it can be generated if more than half of the people agree, which makes the data on the blockchain non-tamperable.

Why do you say that? Let’s make an analogy: we compare the blockchain to a ledger, because it records data. In the traditional world, the bookkeeping power lies with the bookkeeper, and the ledger belongs to the bookkeeper alone. So in the blockchain, everyone owns this account book. If you want to update the account, you must vote. Only if more than half of the people agree can you update the account data.

In this process, we will involve several terms: distributed, node, consensus algorithm. These terms are actually very easy to understand:

Everyone Accounting (That is, everyone has a ledger, and the ledger is scattered in everyone's hands), which is the so-called "distributed";

The accounting method that everyone discusses, votes, and unanimously agrees on is the so-called "distributed" Consensus algorithm";

Every person who participates in accounting is a so-called "node".

3. Data maintenance in blockchain: cryptography

In the data maintenance stage, the difference of blockchain is that it uses cryptography to Ensure the security of data transmission and access.

The cryptographic principles applied in the blockchain mainly include: hash algorithm, Merkle hash tree, elliptic curve algorithm, and Base58. These principles actually ensure data security on the blockchain through a series of complex operations and conversions.

4. Data operations in the blockchain: smart contracts

A smart contract is a commitment agreement defined and automatically executed by a computer program. To put it bluntly, it is executed with code A set of transaction rules, similar to the current automatic repayment function of credit cards. If you turn this function on, you don't have to worry about anything. The bank will automatically deduct the money you owe when it expires.

The outstanding advantage of smart contracts is that they largely avoid a series of problems caused by trust.
Many of us have encountered the situation of being borrowed money: a friend who is short of money borrows 2,000 yuan from you and promises to pay back the money after the salary is paid next month, but next month he finds other excuses. Also, dragging this matter around would be pointless. We didn't have much money, but we were still friends. Even though you were depressed, let it go.

Then, with the smart contract, he can no longer default on his debt, because in the smart contract, once the terms in the contract are triggered, the code will automatically execute, whether he wants it or not, as long as he sends Once you have earned your salary and have money in your account, he has to pay you back.

To summarize the contents of this section, there are four indispensable core technologies in the blockchain, namely: distributed storage, consensus mechanism, cryptography principles, and smart contracts.

We can understand it this way: distributed storage corresponds to the data storage stage, the consensus mechanism corresponds to the data processing and update stage, cryptography corresponds to data security, and smart contracts correspond to data operational issues.