In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article shares with you the content of a sample analysis of the endorsement process of Fabric transactions. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
One of the key differences between Hyperledger Fabric and many other block chains is the transaction execution process of the Fabric block chain: Fabric transactions need to be endorsed by nodes first, and then the transactions are sorted, and finally the books are updated with orderly transactions. This paper will introduce the working principle of the three-step transaction model of execution-sort-verification adopted by Hyperledger Fabric, and the beneficial effect of introducing endorsement on the performance of Hyperledger Fabric block chain.
1. The life cycle of transactions: Hyperledger Fabric vs. Other block chains
In other blockchain platforms, the transaction lifecycle basically consists of the following links:
Sort: transactions are added to the ledger in an orderly manner, and then spread to all nodes
Execution: transactions are executed sequentially on all nodes and the books are updated
In order to keep all nodes in a consistent state, the transaction must be executed with certainty, that is, no matter when and where, the same transaction must produce the same result. This requirement places strong constraints on smart contracts, and is one of the reasons why smart contracts usually need to be developed using domain specific language (DSL), so using a general development language such as Java or Go is basically impossible to guarantee certainty.
In Hyperledger Fabric, the announcement cycle for a deal is different:
Execution: transactions (through smart contracts) are executed in any order, even in parallel
Sort: when a sufficient number of nodes agree on the result of the transaction, the transaction is added to the ledger and spread to all nodes.
Verification: each node validates and executes transactions sequentially, thus updating the account book
The first thing to note is that the execution of the transaction and the actual update of the account book are split into two links, and this split brings some useful effects:
All nodes need to update the ledger, so all nodes need to perform verification steps. But not all nodes need to execute smart contracts. Hyperledger Fabric uses an endorsement strategy to define which nodes need to perform transactions. This means that the specified chain code (smart contract) does not have to be open to all nodes-those nodes that are not in the endorsement policy do not need access to the chain code.
Transactions can be executed before they are sorted. This node can execute transactions in parallel, thus improving the throughput of the system.
In Fabric's three-step transaction model, the chain code execution result is explicitly agreed before the transaction is added to the account book, while the two-step transaction model of other block chains uses deterministic chain codes, which implies that the nodes agree on the execution results of the intelligent contract. Explicit agreement allows Fabric to use non-deterministic chain codes, which is why we can use Go, Java, and Node.js to write Fabric chain codes.
2. Hyperledger Fabric's transaction endorsement strategy
Hyperledger Fabric allows users to define their own policies for chain code execution. These endorsement strategies define which nodes need to agree on the outcome of the transaction before it is added to the book. Fabric provides a small DSL to define endorsement policies. Here are some examples of endorsement strategies:
Nodes A, B, C and F all need to endorse transactions of type T
Most nodes in the channel must endorse transactions of type U
At least 3 nodes in A, B, C, D, E, F, G must endorse transactions of type V
The endorsement policy does not guarantee that the correct chain code is installed on the correct node. However, similar mechanisms do exist for endorsing and installing chain codes, which we will cover in subsequent tutorials.
3. The implementation mechanism of Hypereledger Fabric transaction endorsement
So far, we have loosely used the term transaction. In the sort-execution model, chain code execution and ledger updates are combined into one transaction. In Fabric, the two concepts are separate, so the transaction itself is split.
Fabric starts with a deal offer (Transaction Proposal). This is a packet used to trigger chain code execution. The deal offer is sent to the node used for endorsement. The endorsement node executes the chain code and generates an actual ledger transaction if successful. Endorse the node to sign the proposal and return the response to the deal proposal, which is the execution step in the execute-sort-verify model.
Once the creator of the deal proposal receives enough signatures to satisfy the endorsement policy, it can submit the transaction (and the signature) to add to the ledger, which is the sorting step.
4. Conclusion
Hyperledger Fabric adopts a novel idea in blockchain trading, which separates the execution of intelligent contracts from the update of accounts so that it can improve transaction throughput, support more fine-grained privacy control, and achieve more flexible and powerful intelligent contracts. A key factor in the realization of these features is the explicit endorsement of the transaction before it is added to the book.
Thank you for reading! This is the end of the article on "sample analysis of the endorsement process of Fabric transactions". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.