区块链的底层架构,区块链底层原理
请查看相关英文文档
Ⅰ What is the six-layer model of the blockchain?
The blockchain has a total of six levels of structure. These six levels of structure 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. Let highly dispersed nodesEfficiently reaching consensus in a decentralized blockchain network is one of the core technologies of the blockchain and is also 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. Gambling,There are many gaming applications, but truly practical applications have yet to appear.
II What is the structural layer 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.
Data layer - The data layer is the lowest 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, distributed storage database, which is the so-called distributed ledger.
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.
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. Therefore, 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.
Application layer - The application layer 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, and there are many applications in gambling and games. A truly practical blockchain application currently has the world's first IoT application invested by CoinBank.
Consensus layer - In the world of blockchain, consensus simply 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. Allowing highly dispersed nodes to efficiently reach consensus in a decentralized blockchain network is one of the core technologies of the blockchain and is also 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. The three layers of data layer, network layer and consensus layer ensure that there is data and network on the blockchain.Network, with rules.
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, how much reward you can get. This incentive mechanism can encourage nodes throughout the network to participate in data recording and maintenance on the blockchain.
The Xueshuo Innovation Blockchain Technology Workstation under Lianqiao Education Online is the only “blockchain technology workstation” approved by the “Smart Learning Workshop 2020- Xueshuo Innovation Workstation” carried out by the School Planning and Construction Development Center of the Ministry of Education of China. "Technical Professional" pilot 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.
Ⅲ Blockchain Architecture Design
As an implementation of architectural design, blockchain is quite different from basic languages or platforms. Blockchain is the technology behind cryptocurrency. It is one of the popular technologies currently on par with VR and virtual reality. It is not a new technology in itself. It is similar to Ajax. It can be said that it is a technical architecture, so we would like to let Bian follow the architecture design. Let’s talk about the technical implementation of blockchain from the perspective of Sui Que. No matter what programming language you are good at, you can refer to this design to implement a blockchain product. At the same time, we will sort out the related knowledge maps and systems to help everyone study and research systematically.
In terms of architectural design, blockchain can be simply divided into three levels, the protocol layer, the sliding dust extension layer and the application layer. Among them, the protocol layer can be divided into the storage layer and the network layer, which are independent of each other but inseparable.
IV The organizational structure that makes up the basic computing functions of the blockchain
With the rapid development of the Internet, consumers’ awareness of blockchain technology and digital virtual currency has also increased. Constantly improving. Today, let’s take a look at the structures of the basic computing methods of blockchain technology. Let’s take a look at the specific situation in the following Java course.
The basic elements that make up computing technology are storage, processing and communication. Mainframes, PCs, mobile devices, and cloud services all exhibit these elements in their own way. There are also dedicated building blocks within each element to allocate resources.
This article focuses on the large framework of the blockchain: it introduces the modules of each computing element in the blockchain and some implementation cases of each module, preferring an overview rather than a detailed explanation.
The building blocks of blockchain
The following are the building blocks of each computing element in decentralized technology:
p>
Storage: token storage, database, file system/blob
Processing: stateful business logic, stateless business Logic, high-performance computing
Communication: a connected network of data, value and state
Storage
As basic computing elements, the storage part contains the following building blocks.
Token storage. Tokens are storage media of value (such as assets, securities, etc.), and the value can be bitcoins, airline miles, or the copyright of digital works. The main function of the token storage system is to issue and transfer tokens (there are many variations) while preventing events such as multiple payments from occurring.
Bitcoin and Zcash are two "pure" systems that only focus on the token itself. Ethereum began to use tokens for various services to realize its ideal of serving as a global computing center. These are examples where tokens are used as internal incentives to operate the entire network architecture.
There are also some tokens that are not internal tools used by the network to promote its own operation, but are used as incentives for higher-level networks, but their tokens are actually stored in in the underlying architecture. One example is an ERC20 token like Golem, which runs on the Ethereum network layer. Another example is Envoke’s IP authorization token, which runs on the IPDB network layer.
Database. Databases specialize in storing structured metadata, such as data tables (relational databases), document stores (such as JSON), key-value stores, time series or graph databases. Databases can quickly retrieve data using queries like SQL.
Traditional distributed (but centralized) databases such as MongoDB and Cassandra typically store hundreds of terabytes or even petabytes of data, with performance reaching millions of writes per second. .
Query languages like SQL are very powerful because they separate implementation from specifications, so that Fu Tanqing is not bound to a specific application. . SQL has been used as a standard for decades, so the same database system can be used in many different industries.
In other words, to discuss generality outside of Bitcoin, one does not necessarily have to talk about Turing completeness. You only need one database, which is both concise and easy to expand. There are times when Turing completeness is also useful, which we will discuss in detail in the "Decentralized Processing" section.
BigchainDB is decentralized database software and a specialized document storage system. It is based on MongoDB (or RethinkDB) and inherits the latter's query and expansion logic. But it also has the characteristics of blockchain, such as decentralized control, tamper resistance and token support. IPDB is a regulated public instance of BigchainDB.
In the field of blockchain, it can also be said that IOTA is a time series database.
File system/blob data storage. These systems store large files (movies, music, big data) in a hierarchical structure of directories and files.data set).
IPFS and Tahoe-LAFS are decentralized file systems that contain decentralized or centralized blob storage. FileCoin, Storj, Sia and Tieron are decentralized blob storage systems, as is the old and wonderful BitTorrent, although the latter uses a p2p system rather than a token. Ethereum Swarm, Dat, and Swarm-JS basically support the above two methods.
Data market. Such systems connect data owners (such as businesses) with data users (such as AI startups). They sit on top of databases and file systems, but they are still the core architecture because countless data-hungry applications (such as AI) rely on such services. Ocean is an example of a protocol and network upon which a data marketplace can be created. There are also application-specific data marketplaces: EnigmaCatalyst for crypto markets, Datum for private data, and DataBrokerDAO for IoT data streams.
Processing
The basic computational element of processing is discussed next.
"Smart contract" system usually refers to a system that processes data in a decentralized form [3]. It actually has two subsets with completely different properties: stateless (combined) business logic and stateful (sequential) business logic. There is a huge difference between stateless and stateful in terms of complexity, verifiability, etc. The three decentralized processing modules are high-performance computing (HPC).
Stateless (combined) business logic. This is arbitrary logic and does not retain state internally. In electrical engineering terms, it can be understood as a combinational digital logic circuit. This logic can be expressed as a truth table, a logic diagram, or code with conditional statements (a combination of if/then, and, or, not, etc.). Because they are stateless, it is easy to verify large stateless smart contracts, creating large provably secure systems. N inputs and one output require O(2^N) calculations to verify.
The Inter-Ledger Protocol (ILP) includes crypto-conditions (CC) protocols to clearly label combinational circuits. CC is easy to understand because it became an Internet standard through the IETF, while ILP is widely used in various centralized and decentralized payment networks (such as Ripple used by more than 75 banks). CC has many independently implemented versions, including JavaScript, Python, Java, etc. BigchainDB, Ripple and other systems also use CC to support combined business logic/smart contracts.
IV Laikelib underlying technology of Heshu Software blockchain technologyWhat is the technical architecture?
Whenever we mentioned decentralized blockchain application platforms before, we always thought of foreign products, such as Ethereum. But when we talk about this topic today, I will think of Heshu Software, a blockchain technology R&D company in Shanghai, China. Laikelib is a new generation of decentralized, independent innovation, based on the combination of main chain and side chain technology. A safe, efficient and fully shared underlying architecture platform for diversified blockchain application development. It helps developers quickly create decentralized applications. From a model perspective, it is similar to Ethereum, both are blockchain services, but the implementation mechanism is slightly different. The biggest feature of Ethereum is that it greatly expands the functions of this script engine and lifts the restrictions on stack memory, function call depth, and script length. However, a big disadvantage of this is that the application code itself and the data generated by the application exist in the same In the blockchain chain, it causes the rapid expansion of the chain. But unlike blockchain systems, its scalability is not achieved through transaction scripts but by adding side chains. The advantage of this is that it reduces the difficulty of contract programming, avoids blockchain expansion, and allows each application to customize personalized block parameters.
VI What does the architectural model of blockchain technology include
Jinwowo analyzes the architectural model of blockchain technology 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 etc.;
3. Consensus layer
The consensus layer mainly encapsulates various consensus algorithms of network nodes;
4. Incentive layer
The incentive layer integrates economic factors into the blockchain technology system It mainly includes the issuance mechanism and distribution mechanism of economic incentives;
5. Contract layer
The contract layer mainly encapsulates various scripts, algorithms and smart contracts, and is the basis of the programmable features of the blockchain;
6. Application layer
The application layer encapsulates various application scenarios and cases of the blockchain.
VII What is the model architecture of blockchain?
Blockchain technology is not a single innovative technology, but the result of integrated innovation of multiple technologies. Its essence is a weak center. , self-trusting underlying architecture technology. Compared with traditional Internet technology, its technical principles and model architecture are a major innovation. Here, we will analyze the basic technical model of blockchain.
Model diagram
The blockchain technology model includes data layer, network layer, consensus layer, incentive layer, contract layer and application layer from bottom to top. . Each layer has a core function, and different layers cooperate with each other to jointly build a decentralized value transmission system
The data layer is the lowest level interpretation architecture of the blockchain, which uses public and private keys. Combined asymmetric encryption technology uses hash functions to ensure that information is not tampered with, and also adopts a chain structure and timeTechnologies such as interstamp technology and Merkle trees process data blocks, linking new and old blocks to each other and verifying each other, which is the basis for the safe and stable operation of the blockchain.
The Xueshuo Innovation Blockchain Technology Workstation under Lianqiao Education Online is the only "blockchain technology" approved by the "Smart Learning Workshop 2020- Xueshuo Innovation Workstation" carried out by the School Planning and Construction Development Center of the Ministry of Education of China. Professional” pilot 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.