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

区块链和rpc框架的区别,区块链和rpc框架的关系

发布时间:2023-12-06-08:19:00 来源:网络 区块链知识 区块   框架   rpc

区块链和rpc框架的区别,区块链和rpc框架的关系


请查看相关英文文档

① Technical basis--JSON-RPC2.0

I have recently joined the craze of blockchain learning and started to learn some basic technologies. This article is translated from JSON-RPC 2.0 Specification. In fact, the protocol is very simple and does not need to be translated. It is mainly to record the learning process and deepen understanding.

JSON is a lightweight data exchange format. It can mark numbers, strings, sorted arrays, and key-value pairs.
JSON-RPC is a stateless, lightweight remote procedure call protocol. More than one data structure and its processing rules can fit this definition. Data is transmitted through socket, http, or other environments, and there is no certainty that it will be used within this process. It uses JSON to seat data format.
The design is also very simple.

Keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", " OPTIONAL" explanation can be found in RFC2119.
Due to the adoption of the JSON protocol, the data types that can be transmitted are also the same as JSON. JSON can represent four basic types, Strings, Numbers, Booleans, Null, and two structural types: Objects and Arrays. When we refer to "basic types", we refer to the four basic JSON types, and "structural types" refer to the above two JSON structure types. When referring to JSON types, the first letter is always capitalized, such as Object, Array, String, Number, Boolean, Null. The same goes for True and False.

The request object and response object defined by JSON-RPC 2.0 have compatibility issues with the existing JSON-RPC 1.0 client/server. The two versions are actually easy to distinguish. 2.0 defines a member called "jsonrpc" whose value is 2.0, while version 1.0 does not. The implementation of 2.0 often needs to be compatible with 1.0 objects, even when we are developing services other than point-to-point or that are obviously not 1.0.

An RPC call refers to sending a request object to the remote server. The request object includes the following members:
jsonrpc: used to declare the version of the JSON-RPC protocol, fixed to "2.0"
method: the method that needs to be called. Method names begin with the word rpc, followed by an expiration character. This field is stored on the rpc interaction method and its extensions, and cannot be used in any other sense.
params: structured value, used to store the parameters required for method response and cannot be omitted.
id: An identifier assigned by the client, which can contain strings, numbers, or be empty. If there is no id, it will be regarded as a broadcast notification. This value generally cannot be Null, and it cannot have decimals when it is a number. If the request contains this field, the server must return this field as it is when responding, which is used to associate the different environments of the following two objects:

When the id member is not sent in the request parameter, the request will Treated as notification. For notifications, the client does not care about the response object, because the server does not need to return the response object. To be precise, the server is not allowed to reply to a notification request, even if the request is one of the batch requests.
According to this definition, the notification request will not be confirmed because the client will not receive the response object. Furthermore, the client of the notification request cannot perceive errors, such as parameter errors/network errors, etc.

The parameters of the RPC call must be structured values ​​(objects or arrays). Objects can be traversed by name, while arrays can be traversed by position.
The traversal order of array parameters must be consistent with the server order.
The member values ​​of the object parameters must be consistent with what the server expects and must match exactly in case. Once a member is missing, an error will occur.

When an RPC request error occurs, the Response object responded by the server must contain error and contain the following members:
code: Number type, indicating the error type
message: String type An introductory sentence to describe the error
data: It can be a basic type or a structural type to represent additional information about the error, and can be defaulted. The specific value is customized by the server, such as error details, access restrictions, etc.
Error codes between -32768 and -32000 are reserved by the system, and the protocol is predefined for future use. The definition of error codes is similar to XML-RPC:
-32700: Parsing error, invalid JSON structure, the server made an error when parsing JSON
-32600: Invalid request, RThe request object is not a valid JSON request
-32601: Unknown method, the server does not define the method, or the method is unavailable
-32602: Parameter error
-32603: Network error
/> -32000--32099: Server error, reserved error codes for other server errors
Error codes outside the above range can be used during application development.

When sending multiple Request objects at the same time, the client can put all the requests into an array and send them together.
After the server receives the Request object array and processes it, it should return it in the form of an array, and the array contains the Response object of the response request. Each request corresponds to a response. If the request is a notification, the Response object is not included. When the server batches request tasks, it can process them in any order or in parallel.
When the server batches the request and it is not a legal request object array with a length of at least 1, the object responded by the server must be a single Response object. If the Response array does not contain a Response object, it cannot return an empty array, but should return nothing.

--> {"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1}
<- - {"jsonrpc": "2.0", "result": 19, "id": 1}

--> {"jsonrpc": "2.0", "method": "subtract", "params": [23, 42], "id": 2}<-- {"jsonrpc": "2.0", "result": -19, "id": 2}

- -> {"jsonrpc": "2.0", "method": "subtract", "params": {"subtrahend": 23, "minuend": 42}, "id": 3}<-- {"jsonrpc": "2.0" , "result": 19, "id": 3}--> {"jsonrpc": "2.0", "method": "subtract", "params": {"minuend": 42, "subtrahend": 23} , "id": 4}<-- {"jsonrpc": "2.0", "result": 19, "id": 4}

--> {"jsonrpc": "2.0" , "method": "update", "params": [1,2,3,4,5]}
--> {"jsonrpc": "2.0", "method": "foobar"}< br />
--> {"jsonrpc": "2.0", "method": "foobar", "id": "1"}
<-- {"jsonrpc": "2.0" , "error": {"code": -32601, "message": "Method not found"}, "id": "1"}

--> {"jsonrpc": "2.0", "method": "foobar, "params": " bar", "baz]
<-- {"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null}

--> {"jsonrpc": "2.0", "method": 1, "params": "bar"}
<-- {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}

--> [ {"jsonrpc": "2.0", " method": "sum", "params": [1,2,4], "id": "1"}, {"jsonrpc": "2.0", "method"]<-- {"jsonrpc": " 2.0", "error": {"code": -32700, "message":"Parse error"}, "id": null}

--> []<-- {"jsonrpc": "2.0", "error": {"code": -32600, " message": "Invalid Request"}, "id": null}

--> [1]
<-- [ {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}]

--> [1,2,3]
<-- [ {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}, {"jsonrpc": "2.0", "error ": {"code": -32600, "message": "Invalid Request"}, "id": null}, {"jsonrpc": "2.0", "error": {"code": -32600, "message ": "Invalid Request"}, "id": null}]

--> [
{"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"},
{"jsonrpc": "2.0", " method": "notify_hello", "params": [7]},
{"jsonrpc": "2.0", "method": "subtract", "params": [42,23], "id" : "2"},
{"foo": "boo"},
{"jsonrpc": "2.0", "method": "foo.get", "params": {"name ": "myself"}, "id": "5"},
{"jsonrpc": "2.0", "method": "get_data", "id": "9"}
]
<-- [
{"jsonrpc": "2.0", "result": 7, "id": "1"},
{"jsonrpc": "2.0", " result": 19, "id": "2"},
{"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null},
{"jsonrpc": "2.0", " error": {"code": -32601, "message": "Method not found"}, "id": "5"},
{"jsonrpc": "2.0", "result": [" hello", 5], "id": "9"}
]

--> [
{"jsonrpc": "2.0", "method": "notify_sum ", "params": [1,2,4]},
{"jsonrpc": "2.0", "method": "notify_hello", "params": [7]}
]< br /> <-- //Nothing is returned for all notification batches

Method names starting with rpc are system extension methods and cannot be used in other situations. Each system extension is defined in an associated declaration. System expansion is optional.

1) How to write a specification, or what parts a specification consists of. This specification is a good template
2) How to achieve forward and backward compatibility. The compatibility method of jsonrpc is very simple, just extend a jsonrpc version number in the request header. If it is a good design, this field should be added in 1.0.
3) Rigor. For example, we cannot simply use Null as the id parameter to represent notifications. If the server fails to parse the id, it will also return the Null id. It is impossible to distinguish between the two situations.
4) Batch processing. A good design must consider multi-tasking batch processing. When designing batch processing, you need to consider data parsing. The server may process out of sequence and may process concurrently. You need to consider the possibility of processing different requests at different times. Impact
5) Give examples. It is somewhat similar to the design of test cases, covering as comprehensively as possible

JSON-RPC 2.0 Specification

② Horizontal comparison of various blockchain architectures

Each blockchain Horizontal comparison of architecture
I often hear people talking about blockchain. Since the birth of Bitcoin in 2009, various blockchain systems or blockchain-based applications have been continuously developed and applied to In a large number of scenarios, blockchain technology itself is constantly changing and improving.
Blockchain is also called a distributed ledger, which corresponds to a centralized ledger, such as a bank. Different from centralized ledgers, distributed ledgers rely on redundant storage of ledger data in all participating nodes to ensure the security of the ledger. Simply put, blockchain uses three underlying technologies: peer-to-peer network technology, cryptography technology, and distributed consensus algorithms. Usually, the blockchain system also “comes with a free feature” called a smart contract. Although smart contracts are not a necessary part of the blockchain system, due to the decentralized nature of the blockchain, it can provide a trusted computing environment for smart contracts.
In order to adapt to the needs of different scenarios, blockchain systems often need to undergo various transformations during actual application to meet specific business requirements, such as identity authentication, consensus mechanism, key management, transaction frequency, Response time, privacy protection, regulatory requirements, etc. Companies that actually apply blockchain systems often do not have the ability to carry out such transformations, so some frameworks for customizing dedicated blockchain systems have gradually appeared on the market. Using these frameworks, it is easy to customize products suitable for enterprises. Blockchain system for your own business.
This article will conduct a horizontal comparison of several typical blockchain frameworks currently on the market to see what characteristics they have and what are the differences between them. In order to keep the comparison fair, this article will only discuss open source blockchain frameworks.
A brief introduction to each blockchain architecture
1. Bitcoin
Bitcoin originated from an article named Satoshi Nakamoto published in 2008 For "Bitcoin: A Peer-to-Peer Electronic Cash System"system), which describes an electronic currency he calls "Bitcoin" and its algorithm. In the following years, Bitcoin continued to grow and mature, and its underlying technology was gradually recognized and abstracted by people. This is blockchain technology. As the originator of blockchain, Bitcoin plays an important role in the blockchain family. The number of altcoins developed based on Bitcoin technology is as countless as the stars in the sky.
It can be learned from the paper that Satoshi Nakamoto’s purpose of designing Bitcoin is to realize an electronic cash system completely based on a peer-to-peer network, so that online payments can be directly initiated by one party and paid to another party, with an intermediate No need to go through any intermediaries. In summary, he hopes that the design of Bitcoin can achieve the following goals:
● Issue currency without the need for a central authority
● Make payments without the need for intermediaries
● Maintain user trust Anonymity
● Transactions cannot be reversed
From the perspective of an electronic cash system, the above goals have been basically achieved in Bitcoin, but there are still some technical problems that need to be solved, such as scalability attacks , block capacity limit, block fork, scalability, etc.
In terms of application scenarios, a large number of digital currency projects are currently designed based on the Bitcoin architecture. In addition, there are some more practical application cases, such as colored coins, t?, etc.
Colored coins (coloredcoins), by carefully tracking the ins and outs of some specific Bitcoins, they can be distinguished from other Bitcoins. These specific Bitcoins are called colored coins. They have some special properties and thus have a value that is independent of the face value of Bitcoin. Using this characteristic of colored coins, developers can create other digital assets on the Bitcoin network. Colored coins are Bitcoins themselves, require no third parties for storage and transfer, and can leverage the already existing foundation of Bitcoin.
t? is an application of Bitcoin blockchain in the financial field. It is a blockchain-based private and public equity trading platform launched by the American online retailer Overstock.
2. Ethereum
The goal of Ethereum is to provide a blockchain with a Turing-complete language. With this language, contracts can be created to write arbitrary state transition functions. Users only need to simply By implementing logic with just a few lines of code, you can create a blockchain-based application and apply it to scenarios other than currency.
The design philosophy of Ethereum is not to directly "support" any application, but the Turing-complete programming language means that in theory any contract logic and any type of application can be created. In summary, in addition to the design goals of Bitcoin, Ethereum also needs to achieve the following goals:
● Turing-complete contract language
● Built-in persistent state storage
At present, there are hundreds of contract projects based on Ethereum, and the more famous ones include Augur, TheDAO, Digix, FirstBlood, etc.
Augur is a decentralized prediction market platform based on Ethereum blockchain technology. Users can use digital currency to make predictions and bets, relying on the wisdom of the crowd to predict the outcome of events, which can effectively eliminate counterparty risks and server centralization risks.
Limited by space limitations, we will not introduce more projects based on the Ethereum smart contract platform. There are also many blockchain projects that have been modified based on Ethereum code, but almost all of them are closed source projects and can only be inferred based on some public features, so they will not be discussed in this article.
3. Fabric
Fabric is a blockchain framework developed by IBM and DAH, and is one of the project members of Hyperledger. It functions similarly to Ethereum and is also a distributed smart contract platform. But unlike Ethereum and Bitcoin, it is a framework from the beginning, not a public chain, and there is no built-in token.
Hyperledger is an open source project launched by the Linux Foundation in 2015 to promote blockchain technology and standards. Its members include: ABN AMRO, Accenture and more than a dozen different interests. As an entity, the goal is to allow members to work together to build an open platform to meet various user cases from multiple different industries and simplify business processes.
As a blockchain framework, Fabric adopts a loosely coupled design to modularize components such as consensus mechanism and identity verification so that they can be easily replaced with custom modules during the application process. In addition, Fabric also uses container technology to run smart contract code (chaincode) in docker, so that smart contracts can be written in almost any high-level language.
The following are some design goals of Fabric:
● Modular design, components can be replaced
● Smart contracts running on docker
There are already many developers using Fabric architecture for development During the implementation of proof-of-concept (POC) projects, there are many attempts by some financial institutions. However, because the project has just started, there is no mature application yet.
4. DNA
DNA (Distributed Networks Architecture) is a blockchain architecture developed by "Distributed Technology", a blockchain startup company headquartered in Shanghai. It can support public chains at the same time. , alliance chain, private chain and other different application types and scenarios, and quickly integrate with business systems.
With Ethereum and FabricThe difference is that DNA supports a variety of digital assets at the bottom of the system. Users can create their own asset types directly on the chain and use smart contracts to control its issuance logic. For most blockchain application scenarios, digital assets are indispensable, and developing a set of transfer and issuance logic based on smart contracts for each digital asset is very wasteful and inefficient. Therefore, it is very necessary for the bottom layer of the blockchain to provide direct digital asset functions. For those application scenarios that do not require digital assets at all, arbitrary custom logic can also be written based on the smart contract architecture provided by DNA.
DNA’s design goals include the following:
● Underlying support for multiple digital assets
● Turing-complete smart contracts and state persistence
● Cross-chain interoperability Safety
● Transaction finality
Currently, many financial institutions have adopted DNA architecture to develop blockchain proof-of-concept products. In addition, there are some blockchain projects that have been implemented, such as Xiaoyi Blockchain, Fachain, etc.
Antshares is a public chain positioned at the digitization of assets. It digitizes assets and rights in the physical world and uses a decentralized network protocol to conduct registration, issuance, transfer transactions, clearing and delivery and other financial services through a peer-to-peer network. . It adopts a community development model and is architecturally consistent with DNA, allowing cross-chain interoperability with any DNA-based blockchain system.
FaChain is the world's first large-scale commercial legal evidence storage blockchain. It is an evidence recording and preservation system based on DNA blockchain technology and is established and operated by multiple institutions. The system has no central control point, and once the data is entered, it cannot be tampered with by a single agency or node, thus meeting the requirements for judicial evidence storage.
5. Corda
Corda was developed by R3CEV, a New York-based blockchain startup. The R3 blockchain alliance initiated by it has so far attracted the participation of dozens of giant banks. These include Wells Fargo, Bank of America, Bank of New York Mellon, Citibank, Commerzbank, Deutsche Bank, HSBC, Mitsubishi UFJ Financial Group, Morgan Stanley, National Australia Bank, Royal Bank of Canada, Sweden's Nordisk Bank ( SEB), Société Générale, etc.
It can also be seen from the composition of R3 members that Corda is a blockchain architecture specifically used for bank and inter-bank business. Although R3 itself claims that Corda is not a blockchain, judging from various characteristics, it has some characteristics of a blockchain.
Technical comparison
1. Digital assets
Next, we will make a series of technical comparisons of these blockchain frameworks mentioned above, and introduce their differences from multiple dimensions. with similarities.

Blockchain’s built-in tokens are often an economic incentive model and a means to prevent spam transactions. Bitcoin is born with and has only one built-in token, so all "transactions" in the Bitcoin system are essentially transfer behaviors, unless additional digital assets are added to Bitcoin through an external protocol layer.
Ethereum and DNA have built-in tokens. In addition to the above-mentioned economic incentives and preventing spam transactions, their role is to provide a charging channel for the built-in functions of the system. For example, Ethereum's smart contract operation requires GAS, and DNA's digital asset creation also requires a certain amount of tokens.
Ethereum and Fabric do not have built-in support for multiple digital assets, but implement corresponding functions through smart contracts. The advantage of this approach is that the system design can be very simple, and the behavior of the assets can be specified arbitrarily, with a high degree of freedom. However, such a design will also bring a series of negative impacts. For example, all asset creators have to write repeated business logic themselves, and users cannot operate their assets in a unified way.
In contrast, DNA and Corda adopt a method of supporting multiple digital assets at the bottom level, allowing asset creators to easily create their own asset types, and users can also manage all in the same client. assets. For business scenarios with more complex logic, they can also use smart contracts to enhance the functions of assets, or create a business logic that has nothing to do with assets.
2. Account system

UTXO (Unspent Transaction Output) is a mechanism: each digital currency will be registered under the ownership of an account. A digital currency has two status, that is, either it has not been spent or it has been spent. When you need to use a digital currency, mark its status as spent, create a new digital currency of the same amount, and register its ownership under a new account. In this process, the digital currency marked as spent is called the input of the transaction, and the new digital currency created is called the output of the transaction. In a transaction, it can contain multiple inputs and multiple output, but the sum of the inputs and the sum of the outputs must be equal. To calculate the balance of an account, just add the denominations of all digital currencies registered under the account.
Bitcoin and Corda adopt an account mechanism such as UTXO, while Ethereum adopts a more intuitive balance mechanism: each account has a status, and the status directly records the current balance of the account and the logic of the transfer. It means subtracting a part of the balance from one account and adding the corresponding balance to another account. The subtracted part and the added part must be equal. DNA is compatible with both modes in terms of account mechanism.
Then UTXO mode and balance mode,What are the advantages and disadvantages? The biggest benefit of UTXO is that UTXO-based transactions can be verified in parallel and ordered arbitrarily, because all UTXOs are not related to each other. This is very helpful to the future scalability of the blockchain, and the balance-based design There is no such advantage; on the contrary, the advantage of balance design is that the design idea is very simple and intuitive, which facilitates program implementation. Especially in smart contracts, it is very difficult to deal with the status of UTXO. This is also the reason why Ethereum, with smart contracts as its main function, chooses the balance design, while digital asset-centric architectures such as Bitcoin, OnchainDNA, and Corda prefer UTXO designs.
As for identity authentication, Bitcoin and Ethereum basically have no identity authentication design. The reason is very simple, because the design ideas of both of them emphasize privacy and anonymity and oppose supervision and centralization, and identity authentication is inevitable. Introduce some centers or weakened central institutions. Fabric, DNA and Corda all chose to use digital certificates to authenticate user identities because all three have design goals of being applied to existing financial systems, and financial systems must consider compliance and accept supervision. In addition, Existing financial systems have adopted digital certificate solutions on a large scale, so that they can be quickly integrated with blockchain systems.

③ What are the course introductions to the blockchain technology architecture?

Currently, there are a wide range of blockchain training courses on the market, and the course content and teaching formats are also diverse.

Blockchain

1. Introduction to programming basics

Computer software and hardware basics, character sets and character encoding, HTML+CSS (including HTML5+CSS3), ECMA + BOM + DOM, jQuery, node.js, Ajax and Express

2. Go programming language

Go basic syntax, process control, functions and Data, error handling, Go object-oriented programming, Go concurrent programming, Go network programming, Go security programming, Go advanced programming (goroutine, channel), database MySQL, LevelDB

3, blockchain 1.0— —Bitcoin

Bitcoin principles, Bitcoin system architecture, cryptographic algorithms (implemented in Go language), consensus algorithms (implemented in Go language), Bitcoin transaction principles and transaction scripts, Bitcoin RPC programming (node .js implementation), Bitcoin source code analysis

4. Blockchain 2.0 - Ethereum

The working principle and infrastructure of Ethereum, the basic concepts of Ethereum (accounts, transactions , Gas), Ethereum wallet Mist and Metamask, Ethereum transactions, ERC20 standard Token development and deployment, Ethereum development IDE——remix-ide, smart contracts and Solidity, Solidity deployment, backup and invocation, framework technology: truffle and web3, DApp development practice, Geth

5, Blockchain 3.0 - Fabric of Hyperledger

Introduction to the Hyperledger project, Fabric deployment and use, Fabric configuration management, Fabric architecture design, Fabric CA application and configuration, and practical application development.

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.

④ Blockchain technology concept

Blockchain technology concept

Blockchain technology concept, nowadays, blockchain has become the concern of most people In the field of blockchain, many companies have already studied this technology in depth, but there are still people who don’t know much about it. Below I will share an article about the concept of blockchain technology.

Blockchain technology concept 1

Basic concepts and working principles of blockchain

1. Basic concepts

Blockchain is a distributed data storage, point-to-point New application models of computer technologies such as transmission, consensus mechanisms, and encryption algorithms. The so-called consensus mechanism is a mathematical algorithm that establishes trust and obtains rights and interests between different nodes in the blockchain system.

Blockchain is an important concept of Bitcoin. It is essentially a decentralized database and serves as the underlying technology of Bitcoin. The blockchain is a series of data blocks generated using cryptographic methods. Each data block contains information about a Bitcoin network transaction, which is used to verify the validity of the information, prevent counterfeiting, and generate the next block.

In a narrow sense, blockchain is a chained data structure that combines data blocks in a sequential manner in chronological order, and is cryptographically guaranteed to be non-tamperable and non-tamperable. Fake distributed ledger.

Broadly speaking, blockchain technology uses block chain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, and uses cryptography to ensure data transmission and access. It is a new distributed infrastructure and computing method that uses smart contracts composed of automated script codes to program and operate data securely.

2. Working principle

The blockchain system consists of data layer, network layer, consensus layer, incentive layer, contract layer and application layer. Among them, the data layer encapsulates the underlying dataBasic data and basic algorithms such as blocks and related data encryption and timestamps; the network layer includes distributed networking mechanisms, data dissemination mechanisms and data verification mechanisms; the consensus layer mainly encapsulates various consensus algorithms of network nodes; the incentive layer Integrate economic factors into the blockchain technology system, mainly including the issuance mechanism and distribution mechanism of economic incentives; the contract layer mainly encapsulates various scripts, algorithms and smart contracts, which is the basis of the programmable features of the blockchain; the application layer It encapsulates various application scenarios and cases of blockchain. In this model, the chain block structure based on timestamps, the consensus mechanism of distributed nodes, economic incentives based on consensus computing power, and flexible programmable smart contracts are the most representative innovations of blockchain technology.

Blockchain mainly solves the trust and security issues of transactions, so it proposes four technological innovations to address this issue:

1. Distributed The ledger means that transaction accounting is completed by multiple nodes distributed in different places, and each node records a complete account, so they can all participate in supervising the legality of the transaction and can also jointly testify for it.

Different from traditional distributed storage, the uniqueness of blockchain distributed storage is mainly reflected in two aspects: First, each node of the blockchain stores complete data according to the block chain structure. For data, traditional distributed storage generally divides the data into multiple parts for storage according to certain rules. Second, the storage of each node in the blockchain is independent and of equal status, relying on the consensus mechanism to ensure storage consistency, while traditional distributed storage generally synchronizes data to other backup nodes through the central node. [8]

No node can record ledger data independently, thus avoiding the possibility of a single bookkeeper being controlled or bribed to record false accounts. Also because there are enough accounting nodes, theoretically speaking, the accounts will not be lost unless all nodes are destroyed, thereby ensuring the security of the accounting data.

2. Asymmetric encryption and authorization technology. Transaction information stored on the blockchain is public, but account identity information is highly encrypted and can only be accessed with authorization from the data owner. , thus ensuring data security and personal privacy.

3. The consensus mechanism is how all accounting nodes reach a consensus to determine the validity of a record. This is both a means of identification and a means of preventing tampering. Blockchain proposes four different consensus mechanisms, which are suitable for different application scenarios and strike a balance between efficiency and security.

The consensus mechanism of the blockchain has the characteristics of "the minority obeys the majority" and "everyone is equal". "The minority obeys the majority" does not entirely refer to the number of nodes, but can also be the computing power and the number of shares. Or other characteristic quantities that the computer can compare. "Everyone is equal" means that when a node meets the conditions, all nodes have the right to give priority to the consensus result, which will be directly recognized by other nodes and may eventually become the final consensus result.. Taking Bitcoin as an example, it uses proof of work. Only when more than 51% of the accounting nodes in the entire network are controlled, it is possible to forge a non-existent record. When there are enough nodes joining the blockchain, this is basically impossible, thus eliminating the possibility of fraud.

4. Smart contracts. Smart contracts are based on these trustworthy and non-tamperable data. Some predefined rules and terms can be automatically executed. Take insurance as an example. If everyone's information, including medical information and risk occurrence information, is true and trustworthy, it will be easy to implement automated claims settlement in some standardized insurance products.

3. Others

The Internet exchanges information, and the blockchain exchanges value. Human history and the history of the Internet can be understood in eight words: if they are divided for a long time, they must be combined. For a long time, they must be combined. In the era of long-term separation, all network information is scattered on the Internet. It is very difficult for everyone to mine information. At this time, platforms such as Google and Facebook will appear. , the only thing it does is recombine all our information. In the Internet era, what the monopoly giants reorganize is information, rather than generating their own information. The information generated is entirely our own. Once the information is reorganized, a new monopoly giant will emerge, so it will be an era of long-lasting separation. Now, due to the emergence of blockchain technology, it has entered an era of integration and division. It is a new multi-centralization. After the new multi-centralization, new value will be generated. These data will be in our own hands, and personal data will generate value. It belongs to oneself. This is the most exciting era of this era.

What is the value of blockchain? A low-cost mechanism to establish trust, establish data rights, and resolve data property rights.

At present, blockchain technology continues to develop, including the current development of single chains to multi-chains, and the technology can be further expanded. I think there may still be disruptions in the future, especially in transactions and other aspects. , especially many disruptive scenarios for existing industries.

The essence of blockchain is to establish trusted information exchange on untrustworthy networks.

One Belt, One Road + One Chain. The bigger thing about blockchain is not to create trust, but to allow trust to be transmitted losslessly, reducing the friction cost of society as a whole, thereby improving the overall efficiency.

Now the blockchain itself is still in its initial stage, so it includes the information transmission and encryption of the blockchain. Quantum encryption and other encryption appear in this process, which actually attacks the encryption algorithm used by the blockchain itself. This phenomenon also occurs from time to time. Including blockchain is also a recognition of assets, a recognition of digital assets, but now many of us use cryptographic algorithms, or as the key for us to decrypt, but if you forget the password, it is very likely that your current assets will be lost. If you lose them, you won't be able to get back your original assets. Therefore, there are still some hidden dangers in asset management, including information transmission and some security aspects. whenHowever, from a technical perspective, the processing speed of our blockchain itself, or its scalability, is because from the perspective of the working mechanism, the entire ledger must be copied to all participants, so in the blockchain Its operational efficiency and scalability are still relatively limited. We feel that these still need further development in terms of technology.

The underlying technologies of the blockchain platform also form blockchain wallets, blockchain browsers, node elections, mining machines, mining pools, development components, development modules, technical communities and project communities. and a series of ecosystems. The perfection of these ecosystems directly determines the efficiency and effectiveness of the underlying platform of the blockchain.

4. Mundell’s Impossible Triangle

It is impossible to achieve the ultimate in decentralization, efficiency, and security at the same time.

Blockchain technology concept 2

The essence of blockchain is a distributed accounting technology, as opposed to centralized accounting technology, which is widely used in our current lives. exist. Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.

Blockchain is an important concept of Bitcoin. It is essentially a decentralized database. At the same time, as the underlying technology of Bitcoin, it is a series of related cryptographic methods. Each data block contains a batch of Bitcoin network transaction information, which is used to verify the validity and anti-counterfeiting of the information and generate the next block.

In a narrow sense, blockchain is a chained data structure that combines data blocks in a sequential manner in chronological order, and is cryptographically guaranteed to be non-tamperable and non-tamperable. Fake distributed ledger.

Broadly speaking, blockchain technology uses block chain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, and uses cryptography to ensure data transmission and access. It is a new distributed infrastructure and computing method that uses smart contracts composed of automated script codes to program and operate data securely.

The popular understanding of blockchain technology is: connecting the front, back, left and right blocks of "things" into a chain using one technology, but each block The original data of the block cannot be tampered with. It is a "linked module" technology in the field of Internet of Things that allows participants to trust. The application of blockchain technology is inseparable from the Internet and the Internet of Things. It is based on the integration and interaction of the two, but allows participants to remain independent, decentralized, and work together. With this set of value chain co-construction and sharing, technology.

Characteristics of blockchain: decentralization, openness, autonomy, information cannot be tampered with, and anonymity.

Blockchain is a network that can deliver value. The demand for a network that can deliver value is pushingAn important reason for the emergence of blockchain technology. Blockchain emerged driven by the need to protect information with ownership or other value. Through public and private key cryptography, distributed storage and other technical means, blockchain ensures on the one hand the efficient transmission of valuable information, and on the other hand ensures that this information will not be easily copied and tampered with during the transmission process.

Understand the connotation of blockchain from the inevitability of its birth. Blockchain is a distributed accounting technology that solves the shortcomings of centralized accounting and solves the problem of distributed consistency. It is also The connected Internet is upgraded to a value network that ensures the safe and efficient transmission of valuable information.

Blockchain Technology Concept 3

Blockchain: Blockchain is like a globally unique account book, or database, which records the history of all transactions in the network.

Ethereum Virtual Machine (EVM): It allows you to write more powerful programs on Ethereum and script programs on Bitcoin. It is also sometimes used to refer to the Ethereum blockchain, which is responsible for executing smart contracts and everything.

Node: You can run a node to read and write to the Ethereum blockchain, that is, using the Ethereum Virtual Machine. Full nodes require downloading the entire blockchain. Light nodes are still under development.

Miner: Mining, that is, the node that processes blocks on the blockchain. You can see some of the currently active Ethereum miners on this page: stats.ethdev.com.

Proof of Work: Miners are always competing to solve some mathematical problem. The first one to solve the problem (calculate the next block) will be rewarded with Ether coins. All nodes then update their own blockchain. All miners who want to figure out the next block have an incentive to stay in sync with other nodes and maintain the same blockchain, so the entire network can always reach consensus. (Note: Ethereum is planning to move to a proof-of-stake system (POS) without miners, but that is outside the scope of this article.)

Ethereum: Abbreviation ETH. A true digital currency that you can buy and use. Here is a chart from one of the exchanges where Ethereum can be traded. At the time of writing, 1 Ether is worth 65 cents.

Gas: Executing programs and saving data on Ethereum consumes a certain amount of Ethereum. Gas is converted from Ethereum. This mechanism is used to ensure efficiency.

DApp: The Ethereum community calls applications based on smart contracts decentralized applications (Decentralized App). The goal of DApp is (or should be) to have a friendly interface for your smart contracts, plus some extras, such as IPFS, a decentralized network that can store and read data, not from the Ethereum team but in a similar spirit ). DApp can run on a centralized server that can interact with Ethereum nodes, or it can run on any Ethereum equal node. (Take a minute to think about this: Unlike ordinary websites, DApps cannot run on ordinary servers. They need to submit transactions to the blockchain and read important data from the blockchain rather than a centralized database. Compared to typical users When logging into the system, the user may be represented as a wallet address and other user data is stored locally. Many things will be structured differently from current web applications.)

Ethereum client, smart contract language

p>

Writing and deploying smart contracts does not require you to run an Ethereum node. Browser-based IDEs and APIs are listed below. But if you are just learning, you should still run an Ethereum node to understand the basic components, and running a node is not difficult.

Clients available for running Ethereum nodes

Ethereum has many client implementations in different languages, that is, multiple methods of interacting with the Ethereum network, , including C++, Go, Python, Java, Haskell, etc. Why do we need so many implementations? Different implementations can meet different needs. For example, the goal of Haskell implementation is to be mathematically verifiable, to make Ethereum more secure, and to enrich the entire ecosystem.

At the time of writing this article, I am using the client geth (go-ethereum) implemented in the Go language. At other times, I also use a tool called testrpc, which uses the Python client pyethereum. Later examples will use these tools.

About mining: Mining is fun, a bit like caring for your houseplant, but also a way to learn about the entire system. Although the current price of Ethereum may not even cover the electricity bill, who knows in the future. People are creating many cool DApps that may make Ethereum more and more popular.

Interactive console: Once the client is running, you can synchronize the blockchain, create a wallet, and send and receive Ethereum. One way to use geth is through the Javascript console. In addition, you can use cURL-like commands to interact with the client through JSON RPC. The goal of this article is to take you through the process of DApp development, so I won’t go into details about this. But we should remember that these command line tools are useful for debugging, configuring nodes, and using wallets.

Running the node on the test network: If you run the geth client on the official network, it will take quite a while to download the entire blockchain and synchronize with the network. You can determine if synchronization has occurred by comparing the last block number printed in the node logs with the latest block listed on stats.ethdev.com. ) Another problem is that running smart contracts on the official network requires real Ethereum. Running the node on the test network does not have this problem. At this time, there is no need to synchronize the entireFor a blockchain, just create your own private chain, which saves time for development.

Testrpc: Use geth to create a test network. Another faster way to create a test network is to use testrpc. Testrpc can help you create a bunch of test accounts with funds at startup. It also runs faster and is therefore better suited for development and testing. You can start with testrpc, and then as the contract slowly takes shape, move to the test network created by geth - the startup method is very simple, you only need to specify a networkid: geth --networkid "12345". Here is the code repository for testrpc, we will talk about it again below.

Next, let’s talk about the available programming languages, and then we can start the real programming. Solidity is the programming language used to write smart contracts.

There are several languages ​​to choose from when writing smart contracts: Solidity, which is somewhat similar to Javascript, has a file extension of .sol. Serpent, which is similar to Python, has a file name ending in .se. There is also a Lisp-like LLL. Serpent has been popular for a while, but now the most popular and stable one is Solidity, so just use Solidity. I heard you like Python? Use Solidity.

solc compiler: After writing the smart contract with Solidity, you need to use solc to compile it. It is a component from a C++ client implementation. Again, different implementations complement each other. Here is how to install it. If you don't want to install solc, you can also use a browser-based compiler, such as Solidity real-time compiler or Cosmo. The programming sections below will assume you have solc installed.

web3.js API. After the Solidity contract is compiled and sent to the network, you can use Ethereum's web3.js JavaScript API to call it and build web applications that can interact with it.

⑤ Introduction to Quorum (1): Overview of the overall structure of Quorum

In one sentence, it is the enterprise-level Ethereum model. Different from the traditional Ethereum model, since Quorum is an enterprise-level application, the entry threshold, consensus processing and transaction security mechanism must be different from the traditional public chain model. Later, we will also introduce Quorum’s structural model and core functional features in detail from the following aspects.

Quorum itself supports two transaction states

The core difference between the two transactions is whether the content is encrypted. In order to distinguish between the two types of transactions, QuorumA special value is set in the signature of each transaction. When the value in the signature is 27 or 28, it means that it is a public transaction. If it is 37 or 38, it is a private transaction. The contents of private transactions will be encrypted, and only nodes with decryption capabilities can obtain the specific transaction contents.

So in the end, each node will have two sets of ledgers: one is the public ledger that is the same for everyone, and the other is its own private ledger stored locally.

Therefore, Quorum’s ledger status change mechanism allows calls in the following situations

s represents the transaction initiator, (X) represents private, and X represents public

The above formula can be translated as:

Quorum does not allow calls in the following two situations

Quorum’s specific status verification (world status) can call the RPC method eth_storageRoot(address[, blockNumber ]) -> hash

The core of Quorum is divided into two major blocks: Node nodes and privacy management.

The Quorum node itself is a lightweight version of Geth. By continuing to use Geth, we can leverage the original R&D advantages of the Ethereum community, so Quorum will be updated with future Geth version updates.

The Quorum node has made some changes based on Geth:

Constellation and Tessera (hereinafter referred to as C&T) are a secure information transmission model implemented in Java and Haskell. Their functions are like It is a message transfer agent (MTA, Message Transfer Agent) in the network. All message transmissions are encrypted through the session information key

C&T is actually a common component used to implement personal message encryption in multi-party participating networks. It is common in many applications and is not a proprietary technology in the blockchain field (note by the author, in fact, the blockchain itself is a hodgepodge of various technologies. It is difficult for us to find a technology specifically and say it is the blockchain). C&T mainly consists of two sub-modules:

The transaction management module is mainly responsible for the privacy of transactions, including storing private transaction data, controlling access to private transactions, and exchanging private transaction payloads with other participants' transaction managers. Transaction Manager itself does not involve any private keys and the use of private keys. All digital encryption module functions are completed by The Enclave.

Transaction Manager belongs toFor static/Restful modules, they can be loaded very easily.

Distributed ledger protocols usually involve transaction verification, participant authorization, historical information storage (through hash chain), etc. In order to achieve performance expansion and parallel operation in encryption, all public and private key generation and data encryption/decryption are completed by the Enclave module.

⑥ What technology is blockchain and what impact does it have on our lives and society?

What is blockchain technology?

Before discussing how to apply blockchain in daily life, let us first talk about what blockchain is and how does it work?

Blockchain is an open distributed database, essentially a computer file used to store information (data).

Blockchain gets its name from its structural features: files are made up of blocks of data, each block is linked to the previous block, forming a chain, and each block contains data such as transaction records and A record of when the block was edited or created, the information (data) is timestamped, which is where the blockchain comes from.

Crucially, unlike centralized databases owned by companies or government agencies, blockchain is not controlled by any one person or entity and the data is fully replicated (distributed) across multiple computers .

Because it is a decentralized way of storing and accessing data, this makes it incredibly secure. Because unlike centralized databases, attackers do not have a single entry point, data security is more guaranteed.

In addition to the two major features of decentralization and security, the features that make blockchain a leading technology that distinguishes it from other technologies are:

Immutability: Once on the blockchain, no information can be changed, not even administrators can modify this information. It gives blockchain the advantage of being easily auditable.

Accessible: Information can be easily accessed by all nodes in the network.

No third parties: Blockchain facilitates peer-to-peer transactions, so whether you are trading or exchanging funds, there is no need for approval from a third party. Blockchain itself is a platform.

The impact of blockchain technology?

1. The open and non-tamperable attributes of blockchain technology provide the possibility for a decentralized trust mechanism and have the potential to change the financial infrastructure. Various financial assets, such as equity, bonds, Bills, warehouse receipts, fund shares, etc. can be integrated into the blockchain ledger and become digital assets on the chain, which can be stored, transferred, and traded on the blockchain. It has broad application prospects in the financial field. For example, it has typical applications in cross-border payments, insurance claims, securities transactions, bills, etc.

2. The current IoT ecosystem relies on a centralized network management architecture. All devices are connected throughConnect via cloud server. As the scale of the network expands, the infrastructure and maintenance costs of centralized cloud servers, large servers and network equipment will incur high costs.

In the decentralized Internet of Things, blockchain is a framework that promotes transaction processing and collaboration between interacting devices. Each device on the network can serve as an independent, micro-business entity. run.

3. Public services are factors that promote economic growth and social progress. The supply of public services will have an important impact on various subjects and systems, culture, attitudes, behaviors, etc. in the process of political, economic, and social development. Influence. Traditional notarization relies on the government, but limited data dimensions and unestablished historical data information links often prevent governments and schools from obtaining complete and effective information. Blockchain can be used to create digital proofs that cannot be tampered with. New certification mechanisms can be established in the fields of digital copyright, intellectual property, certificates and public welfare to improve the management level of public services.

⑦ What framework is used to develop blockchain Substrate

Blockchain development is very complicated. It involves complex technologies (including advanced cryptography and distributed network communications) that you must master in order to provide a secure platform for applications to run and users to trust. There are also thorny issues to resolve around scale, governance, interoperability and scalability. This complexity creates a high barrier for developers to overcome. With this in mind, the first question to answer is: What do you want to build?

Substrate is not perfectly suitable for every use case, application or project. However, if you want to build a blockchain, Substrate may be a perfect choice.

Substrate is a software development kit (SDK) designed to provide you with the basic components of all blockchains, allowing you to focus on crafting the logic that makes your chain unique and innovative. Unlike other distributed ledger platforms, Substrate is.

Most blockchain platforms have very tightly coupled, unanimous subsystems that are difficult to decouple. There are also risks on a chain based on a fork of another blockchain, where these very obvious couplings can fundamentally break the blockchain system itself.

Substrate is a fully modular blockchain framework that lets you compose a well-defined Chains of decoupled components.

With Substrate, you can deploy a blockchain designed and built for your specifications, but also able to evolve with your changing needs.

All Substrate architecture and tools are provided under an open source license. Substrate frameworkThe core components use open protocols such as libp2p and jsonRPC, while empowering you to decide how much you want to customize the blockchain architecture. Substrate also has a large, active, and helpful community of developers contributing to the ecosystem. Contributions from the community enhance the capabilities available, allowing you to incorporate them into your own blockchain as it evolves.

Most blockchain platforms offer limited capabilities to interact with other blockchain networks. All Substrate-based blockchains can interoperate with other blockchains through Cross-Consensus Messaging (XCM). Substrate can be used to create a chain as a standalone network (single chain), or tightly coupled with a relay chain to share its security, as a quasi-chain.

Substrate is built to be scalable, composable, and adaptable. The state transition logic--Substrate runtime--is an independent WebAssembly object. Nodes can be given the ability to completely change the runtime itself under certain conditions, inducing runtime upgrades network-wide. Therefore, "forkless" upgrades are possible because in most cases nodes do not need to take any action to use this new runtime. Over time, the network's runtime protocols can evolve seamlessly, perhaps radically, with the needs of its users.

⑧ What are the blockchain technology frameworks

The current mainstream blockchain architecture contains six levels: network layer, data layer, consensus layer, incentive layer, 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. Among them, data blocks and chain structures can be used as scalable solutions for blockchain technology.Improvement directions when researching the data layer.
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.

博客主人唯心底涂
男,单身,无聊上班族,闲着没事喜欢研究股票,无时无刻分享股票入门基础知识,资深技术宅。
  • 36904 文章总数
  • 3637265访问次数
  • 3078建站天数