Fabric blockchain transaction endorsement method and device, equipment and readable storage medium
By setting up a transaction endorsement method for initialization information in the Fabric blockchain, the shortcomings of transaction channel management are solved, effective control of the smart contract life cycle is achieved, and the transaction needs of corporate users are met.
Patent Information
- Application Number
- CN202210725843.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-23
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-06-23
AI Technical Summary
In existing technologies, when multiple enterprise users use the Fabric blockchain to conduct transaction business, they need to build and destroy transaction channels, and there is a lack of an effective smart contract lifecycle management mechanism.
This paper provides a transaction endorsement method for the Fabric blockchain. By setting initialization information in the transaction proposal of the client node, the initialization process of the smart contract in the endorsement node is controlled, including pre-execution of the transaction proposal, generation of endorsement results, monitoring of block broadcast information, and execution of the transaction proposal to initialize the smart contract when the block corresponding to the endorsement result is received.
It realizes the effective management of the life cycle of smart contracts in the Fabric blockchain, supports the establishment and destruction of transaction channels, and meets the transaction needs of enterprise users.
Smart Images

Figure CN115033921B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of blockchain, and particularly relates to a transaction endorsement method and device of Fabric blockchain, equipment and a readable storage medium. BACKGROUND
[0002] Hyperledger Fabric blockchain (hereinafter referred to as Fabric blockchain) is an enterprise-oriented consortium chain. The Fabric blockchain includes the following types of nodes: client nodes, peer nodes, orderer nodes, etc. The peer nodes include Endorsor nodes, Anchor nodes, Committer nodes, etc.
[0003] In the related art, when multiple enterprise users carry out transaction business by using the Fabric blockchain, a corresponding transaction channel needs to be constructed, and the corresponding transaction channel needs to be destroyed when the transaction business is completed. Therefore, the demand for the life cycle management of the smart contract in the Fabric blockchain arises. SUMMARY
[0004] The main purpose of the present application is to provide a transaction endorsement method, device, equipment and readable storage medium of Fabric blockchain, to manage the life cycle of the smart contract in the Fabric blockchain.
[0005] To achieve the above purpose, the present application provides a transaction endorsement method of Fabric blockchain, which is used for an endorsement node, and the method comprises the following steps:
[0006] When a transaction proposal sent by a client node is received, the transaction proposal is pre-executed to generate an endorsement result of the transaction proposal; wherein the transaction proposal comprises initialization information, and the initialization information is used to initialize a smart contract of the endorsement node;
[0007] The endorsement result is sent to the client node, and the broadcast information of a block corresponding to the endorsement result is monitored;
[0008] If a block corresponding to the endorsement result is received, the transaction proposal corresponding to the block is executed, and a smart contract is initialized according to the initialization information in the transaction proposal.
[0009] Optionally, the initialization information comprises an update state of the smart contract, and the update state comprises a normal state and a destruction state.
[0010] Optionally, the initialization smart contract step specifically comprises:
[0011] If the update state is the normal state, the smart contract state of the endorsing node is updated to the normal state to establish a transaction channel between the endorsing node and a corresponding commit node;
[0012] If the update state is the destroy state, the smart contract state of the endorsing node is updated to the destroy state to destroy the transaction channel between the endorsing node and a corresponding commit node.
[0013] To achieve the above object, the application further provides a transaction endorsement method of a Fabric blockchain, for a client node, comprising the following steps:
[0014] In response to a transaction request, a transaction proposal is sent to a target endorsing node; wherein the transaction proposal comprises initialization information, and the initialization information is used to initialize a smart contract of the endorsing node;
[0015] An endorsement result of pre-executing the transaction proposal by the target endorsing node is obtained;
[0016] A block corresponding to the endorsement result is broadcasted to the endorsing node to make the target endorsing node execute the transaction proposal and initialize the smart contract.
[0017] Optionally, the initialization information comprises an endorsement policy, and the target endorsing node is an endorsing node corresponding to a target transaction in the endorsement policy.
[0018] Optionally, the step of broadcasting the block corresponding to the endorsement result to the endorsing node comprises:
[0019] The endorsement result and signature information are sent to an ordering node to make the ordering node generate a block corresponding to the endorsement result, send the block to a managing node, and broadcast the block to the endorsing node;
[0020] The signature information comprises a first signature of the target endorsing node and a second signature of the client node.
[0021] To achieve the above object, the application further provides a transaction endorsement device of a Fabric blockchain, deployed in an endorsing node, comprising:
[0022] A proposal receiving module is configured to, when a transaction proposal sent by a client node is received, pre-execute the transaction proposal to generate an endorsement result of the transaction proposal; wherein the transaction proposal comprises initialization information, and the initialization information is used to initialize a smart contract of the endorsing node;
[0023] A monitoring module is configured to send the endorsement result to the client node and monitor broadcast information of a block corresponding to the endorsement result;
[0024] The proposal execution module is configured to execute the transaction proposal corresponding to the block when the block corresponding to the endorsement result is received, and initialize the smart contract according to the initialization information in the transaction proposal.
[0025] To achieve the above object, the application further provides a transaction endorsement device of a Fabric blockchain, which is deployed on a client node, and the device comprises:
[0026] The proposal sending module is configured to send a transaction proposal to a target endorsement node in response to a transaction request, wherein the transaction proposal comprises initialization information, and the initialization information is used to initialize a smart contract of the endorsement node.
[0027] The obtaining module is configured to obtain an endorsement result of pre-executing the transaction proposal by the target endorsement node.
[0028] The broadcasting module is configured to broadcast a block corresponding to the endorsement result to the endorsement nodes, so that the target endorsement node executes the transaction proposal and initializes the smart contract.
[0029] To achieve the above object, the application further provides a device comprising a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method according to any one of the above.
[0030] To achieve the above object, the application further provides a readable storage medium, which stores a computer program, and when the computer program is executed in a computer, the computer program makes the computer execute the method according to any one of the above.
[0031] The Fabric blockchain transaction endorsement method, device, equipment and readable storage medium provided by the embodiment of the application, the method comprises the following steps: when a transaction proposal sent by a client node is received, pre-executing the transaction proposal to generate an endorsement result of the transaction proposal; wherein the transaction proposal comprises initialization information, and the initialization information is used to initialize a smart contract of an endorsement node; the endorsement result is sent to the client node, and the broadcasting information of a block corresponding to the endorsement result is monitored; when the block corresponding to the endorsement result is received, the transaction proposal corresponding to the block is executed, and the smart contract is initialized according to the initialization information in the transaction proposal. The information for controlling the initialization of the smart contract in the endorsement node is arranged in the transaction proposal of the client node, so that the management of the life cycle of the smart contract in the Fabric blockchain is realized. BRIEF DESCRIPTION OF DRAWINGS
[0032] Figure 1 It is a structural schematic diagram of the Fabric blockchain transaction endorsement device in the embodiment of the application.
[0033] Figure 2A flowchart of a first embodiment of the transaction endorsement method of the Fabric blockchain of the present application.
[0034] Figure 3 A flowchart of a second embodiment of the transaction endorsement method of the Fabric blockchain of the present application.
[0035] Figure 4 A structural block diagram of a first embodiment of the transaction endorsement device of the Fabric blockchain of the present application.
[0036] Figure 5 A structural block diagram of a second embodiment of the transaction endorsement device of the Fabric blockchain of the present application.
[0037] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0038] It should be understood that the specific embodiments described herein are merely intended to explain the present application and are not intended to limit the present application.
[0039] At present, in the related art, when multiple enterprise users carry out transaction business by using the Fabric blockchain, it is necessary to construct a corresponding transaction channel, and when the transaction business is completed, it is necessary to destroy the corresponding transaction channel.
[0040] In order to meet the demand for the management of the life cycle of the smart contract in the Fabric blockchain, the present application provides various embodiments of the transaction endorsement method of the Fabric blockchain. The transaction endorsement method of the Fabric blockchain provided by the present application sets information for controlling the initialization of the smart contract in the endorsement node in the transaction proposal of the client node, so as to realize the management of the life cycle of the smart contract in the Fabric blockchain.
[0041] Reference Figure 1 , Figure 1 A structural diagram of the transaction endorsement device of the Fabric blockchain related to the embodiment scheme of the present application.
[0042] The device can be a server, a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a personal digital assistant (PDA), a tablet computer (PAD), a user equipment (UE) such as a user device, a handheld device, a vehicle-mounted device, a wearable device, a computing device or other processing device connected to a wireless modem, a mobile station (MS) and the like.
[0043] Generally, the device comprises at least one processor 301, a memory 302, and a transaction endorsement program of a Fabric blockchain stored on the memory and executable on the processor, the transaction endorsement program of the Fabric blockchain being configured to implement the steps of the transaction endorsement method of the Fabric blockchain as previously described.
[0044] The processor 301 can comprise one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 301 can be implemented in the form of at least one of a DSP (Digital Signal Processing), a FPGA (Field-Programmable Gate Array), a PLA (Programmable Logic Array). The processor 301 can also comprise a main processor and a coprocessor, the main processor being a processor for processing data in an awake state, also known as a CPU (Central Processing Unit), and the coprocessor being a low-power processor for processing data in a standby state. In some embodiments, the processor 301 can be integrated with a GPU (Graphics Processing Unit) for rendering and drawing the content to be displayed by the display screen. The processor 301 can further comprise an AI (Artificial Intelligence) processor for processing the transaction endorsement operation related to the Fabric blockchain, so that the transaction endorsement model of the Fabric blockchain can be autonomously trained and learned to improve efficiency and accuracy.
[0045] The memory 302 can comprise one or more computer-readable storage media, which can be non-transitory. The memory 302 can further comprise a high-speed random access memory, and a non-volatile memory such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 302 is used to store at least one instruction for being executed by the processor 301 to implement the transaction endorsement method of the Fabric blockchain provided by the method embodiments in the present application.
[0046] In some embodiments, the terminal can further optionally comprise a communication interface 303 and at least one peripheral device. The processor 301, the memory 302 and the communication interface 303 can be connected through a bus or a signal line. Each peripheral device can be connected to the communication interface 303 through a bus, a signal line or a circuit board. Specifically, the peripheral device comprises at least one of a radio frequency circuit 304, a display screen 305 and a power supply 306.
[0047] The communication interface 303 can be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 301 and the memory 302. The communication interface 303 is used to receive the mobile trajectories of a plurality of mobile terminals and other data uploaded by the user through the peripheral device. In some embodiments, the processor 301, the memory 302 and the communication interface 303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 301, the memory 302 and the communication interface 303 can be implemented on a separate chip or circuit board, and the present embodiment does not limit this.
[0048] The radio frequency circuit 304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 304 communicates with the communication network and other communication devices through electromagnetic signals, thereby obtaining the mobile trajectories of a plurality of mobile terminals and other data. The radio frequency circuit 304 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 304 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chip set, a user identity module card, and the like. The radio frequency circuit 304 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G and 5G), wireless local area networks and / or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 304 can also include NFC (Near Field Communication) related circuit, and the present application does not limit this.
[0049] The display screen 305 is configured to display a UI (User Interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display screen 305 is a touch display screen, the display screen 305 is further configured to capture touch signals on or above the surface of the display screen 305. The touch signals can be input to the processor 301 as control signals for processing. In this case, the display screen 305 can also be configured to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 305 can be one, front panel of the electronic device; in other embodiments, the display screen 305 can be at least two, respectively arranged on different surfaces of the electronic device or in a folding design; in still other embodiments, the display screen 305 can be a flexible display screen arranged on a curved surface or a folding surface of the electronic device. Even, the display screen 305 can also be arranged in an irregular shape other than a rectangle, i.e., a notched screen. The display screen 305 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc.
[0050] The power supply 306 is configured to supply power to various components in the electronic device. The power supply 306 can be AC power, DC power, disposable batteries, or rechargeable batteries. When the power supply 306 includes rechargeable batteries, the rechargeable batteries can support wired charging or wireless charging. The rechargeable batteries can also be configured to support fast charging technology.
[0051] Those skilled in the art can understand that the structure shown in the above embodiments is not a limitation on the device, and the device can include more or fewer components than those shown, or combine certain components, or arrange different components. Figure 1 The structure shown in the above embodiments is not a limitation on the device, and the device can include more or fewer components than those shown, or combine certain components, or arrange different components.
[0052] The embodiment of the present application provides a transaction endorsement method of a Fabric blockchain. Figure 2 , Figure 2 The embodiment of the present application provides a transaction endorsement method of a Fabric blockchain.
[0053] In the embodiment, the transaction endorsement method of the Fabric blockchain is used for an endorsement node, and includes the following steps:
[0054] In step S100, when a transaction proposal sent by a client node is received, the transaction proposal is pre-executed to generate an endorsement result of the transaction proposal; wherein the transaction proposal includes initialization information, and the initialization information is used to initialize a smart contract of the endorsement node.
[0055] It is easy to understand that, generally, multiple channels can be set in the Fabirc blockchain, each channel has its own closed ledger data and chain code, that is, the smart contract in the Fabric blockchain, through the smart contract in the Fabric blockchain, the transaction endorsement process of the corresponding node user in the channel can be realized, thereby, the Fabirc blockchain is endowed with the characteristics suitable for building alliance chain in complex enterprises and between enterprises.
[0056] In actual application, at least two node users in the alliance chain have the demand of separately constructing and destroying the channel in some transaction business, and thus the management of the smart contract life cycle in the Fabric blockchain is needed.
[0057] In the embodiment, the endorsement node receives the transaction proposal sent by the client node, pre-executes the transaction proposal, calls the smart contract to complete the business calculation (but does not update the state), and completes the endorsement.
[0058] It should be noted that the transaction proposal records initialization information, which is used to initialize the smart contract of the endorsement node when the endorsement node receives the block corresponding to the endorsement result.
[0059] Step S200, send the endorsement result to the client node, and monitor the broadcast information of the block corresponding to the endorsement result.
[0060] Specifically, after the endorsement node completes the endorsement, the endorsement result is sent to the client node, and then the ordering node in the Fabirc blockchain sorts, packages and sends the endorsement result into a block to the management node, and the management node broadcasts the block to each endorsement node.
[0061] Therefore, after the endorsement node sends the endorsement result to the client node, the broadcast information of the block corresponding to the endorsement result can be monitored, and then the process of transaction proposal and smart contract initialization is executed according to the monitoring result.
[0062] Step S300, if the block corresponding to the endorsement result is received, execute the transaction proposal corresponding to the block, and initialize the smart contract according to the initialization information in the transaction proposal.
[0063] Specifically, when the block corresponding to the endorsement result is received, the transaction proposal is executed, and the smart contract is initialized.
[0064] In the embodiment, the initialization information includes the update state of the smart contract, and the update state includes a normal state and a destruction state.
[0065] Further, if the update state is the normal state, the smart contract state of the endorsement node is updated to the normal state to establish a transaction channel between the endorsement node and the corresponding commit node; if the update state is the destroy state, the smart contract state of the endorsement node is updated to the destroy state to destroy the transaction channel between the endorsement node and the corresponding commit node.
[0066] It should be noted that in the Fabric blockchain, the node configured with the smart contract is referred to as an endorsement node, and the node without the smart contract is referred to as a commit node; wherein the commit node is only used to maintain the ledger.
[0067] It is easy to understand that after the transaction channel between the endorsement node and the corresponding commit node is established, if multiple client nodes need to record transaction data, the client nodes can transmit business transaction on-chain data to the commit node through the transaction channel, and then the commit node adds a block to the ledger data; if the transaction is over, the multiple client nodes can destroy the transaction channel between the endorsement node and the corresponding commit node by updating the smart contract state to the destroy state.
[0068] In the preferred embodiment, the update state further includes a freeze state. Correspondingly, if the update state is the freeze state, the smart contract state of the endorsement node is updated to the freeze state, that is, the transaction channel between the endorsement node and the corresponding commit node is temporarily interrupted, at this time, any client node cannot add a new block to the ledger data through the commit node.
[0069] It should be noted that after receiving the block, the commit node verifies the execution state of each transaction in the block, marks the execution state of each transaction in the block, and then adds the block to the ledger data of the node (i.e., commits the block). Wherein, the commit node corresponding to each endorsement node locally includes the ledger data of the channel.
[0070] In this embodiment, a transaction endorsement method for the Fabric blockchain of the endorsement node is provided, which sets information for controlling the initialization of the smart contract in the endorsement node in the transaction proposal of the client node, so as to realize the management of the life cycle of the smart contract in the Fabric blockchain.
[0071] For ease of understanding, reference is made to Figure 3 , Figure 3 The flowchart of the second embodiment of the transaction endorsement method for the Fabric blockchain of the present application is shown. Based on the first embodiment of the transaction endorsement method for the Fabric blockchain as shown in Figure 2 , the second embodiment of the transaction endorsement method for the Fabric blockchain is proposed for the client node, which is specifically as follows:
[0072] Step S400, in response to the transaction request, sending a transaction proposal to the target endorsement node; wherein the transaction proposal comprises initialization information, and the initialization information is used to initialize the smart contract of the endorsement node.
[0073] Specifically, the client node can send a transaction proposal to the target endorsement node when receiving a transaction request, so that the target endorsement node pre-executes the transaction proposal and completes the endorsement process. The transaction proposal sent to the target endorsement node includes initialization information, which is used to initialize the smart contract of the endorsement node.
[0074] It is easy to understand that after the transaction proposal sent by the client node reaches the endorsement node, the endorsement node will first verify the client's signature to ensure that the client's identity has the right to execute this transaction, then execute the smart contract mentioned in the transaction proposal, and generate an endorsement result, i.e. an endorsement response.
[0075] It should be noted that this endorsement response usually contains a read set, a write set, and a signature of the node for this transaction. Unlike the Ethereum system consortium chain, the endorsement phase in the Fabric blockchain only simulates transactions and does not actually update the transaction results.
[0076] Step S500, obtaining the endorsement result of the target endorsement node pre-executing the transaction proposal.
[0077] Specifically, after the target endorsement node executes the transaction proposal, it will feedback the endorsement result of pre-executing the transaction proposal to the client node. The client node obtains the endorsement result and the first signature of the target endorsement node.
[0078] After that, the client sends the pre-execution result and the signature received from each endorsement node to the ordering node, thereby executing the subsequent transaction endorsement process.
[0079] Step S600, broadcasting the block corresponding to the endorsement result to the endorsement node, so that the target endorsement node executes the transaction proposal and initializes the smart contract.
[0080] Specifically, the endorsement result and the signature information are sent to the ordering node, so that the ordering node generates a block corresponding to the endorsement result, sends the block to the management node, and broadcasts it to the endorsement node.
[0081] The signature information includes the first signature of the target endorsement node and the second signature of the client node.
[0082] It should be noted that the initialization information includes an endorsement policy, and the target endorsement node is the endorsement node corresponding to the target transaction in the endorsement policy.
[0083] As can be easily understood, the Fabric blockchain allows users to customize the policy of chain code execution, that is, an endorsement policy, which defines which nodes need to reach an agreement on the transaction result before the transaction is added to the ledger, and then when the endorsement result block corresponding to the transaction proposal with initialization information is sent to the management node, the management node sends the block to each node of the channel through the Gossip network, and the node verifies each transaction in the block to determine whether it is valid: valid will update the state, invalid will be marked as invalid and will not update the state.
[0084] In the embodiment, a transaction endorsement device for a Fabric blockchain of a client node is provided, which sends a transaction proposal to a target endorsement node, broadcasts a block corresponding to an endorsement result of a pre-executed transaction proposal to the endorsement node after obtaining the endorsement result, and then initializes a smart contract, executes the transaction proposal, and realizes management of a lifecycle of the smart contract in the Fabric blockchain.
[0085] Reference Figure 4 , Figure 4 Fig. 1 is a structural block diagram of a first embodiment of the transaction endorsement device for the Fabric blockchain of the present application.
[0086] As Figure 4 shown, the transaction endorsement device for the Fabric blockchain of the embodiment of the present application is deployed on an endorsement node and includes:
[0087] A proposal receiving module 10 is configured to pre-execute a transaction proposal when the transaction proposal sent by a client node is received, and generate an endorsement result of the transaction proposal; wherein the transaction proposal includes initialization information, and the initialization information is used to initialize a smart contract of the endorsement node.
[0088] A monitoring module 20 is configured to send the endorsement result to the client node and monitor broadcast information of a block corresponding to the endorsement result.
[0089] A proposal execution module 30 is configured to execute a transaction proposal corresponding to a block if the block is received, and initialize a smart contract according to initialization information in the transaction proposal.
[0090] As an implementation manner, in the proposal receiving module 10 and the proposal execution module 30, the initialization information includes an update state of the smart contract, and the update state includes a normal state and a destroyed state.
[0091] As an implementation form, the proposal execution module 30 is further configured to update the smart contract state of the endorsing node to the normal state to establish a transaction channel between the corresponding submitting node of the endorsing node if the update state is the normal state, and update the smart contract state of the endorsing node to the destroyed state to destroy the transaction channel between the corresponding submitting node of the endorsing node if the update state is the destroyed state.
[0092] The transaction endorsement device of the Fabric blockchain provided by the embodiment can realize the management of the life cycle of the smart contract in the Fabric blockchain by setting information for controlling the initialization of the smart contract in the endorsing node in the transaction proposal of the client node.
[0093] Based on the first embodiment of the transaction endorsement device of the Fabric blockchain, the second embodiment of the transaction endorsement device of the Fabric blockchain is provided.
[0094] Reference Figure 5 , Figure 5 The structure block diagram of the second embodiment of the transaction endorsement device of the Fabric blockchain is shown in the figure.
[0095] As Figure 5 shown, the transaction endorsement device of the Fabric blockchain provided by the embodiment is deployed in a client node and includes:
[0096] The proposal sending module 40 is configured to send a transaction proposal to a target endorsing node in response to a transaction request, wherein the transaction proposal includes initialization information, and the initialization information is used to initialize a smart contract of the endorsing node.
[0097] The obtaining module 50 is configured to obtain an endorsement result of pre-executing the transaction proposal by the target endorsing node.
[0098] The broadcasting module 60 is configured to broadcast a block corresponding to the endorsement result to the endorsing node, so that the target endorsing node executes the transaction proposal and initializes the smart contract.
[0099] As an implementation form, the initialization information in the proposal sending module 40 includes an endorsement policy, and the target endorsing node is an endorsing node corresponding to a target transaction in the endorsement policy.
[0100] As an implementation form, the broadcasting module 60 is further configured to send the endorsement result and signature information to a sorting node, so that the sorting node generates a block corresponding to the endorsement result, sends the block to a management node, and broadcasts the block to the endorsing node, wherein the signature information includes a first signature of the target endorsing node and a second signature of the client node.
[0101] The transaction endorsement device of the Fabric blockchain provided by the embodiment sends a transaction proposal to a target endorsement node, broadcasts a block corresponding to an endorsement result to the endorsement node after obtaining the endorsement result of pre-executing the transaction proposal, and then initializes a smart contract, executes the transaction proposal, and realizes management of a lifecycle of the smart contract in the Fabric blockchain.
[0102] Other embodiments or specific implementations of the transaction endorsement device of the Fabric blockchain can refer to the above-mentioned method embodiments, and will not be described here.
[0103] In addition, the embodiment of the application also provides a storage medium, and the storage medium stores a transaction endorsement program of the Fabric blockchain. When the transaction endorsement program of the Fabric blockchain is executed by a processor, the steps of the transaction endorsement method of the Fabric blockchain described above are realized. Therefore, this will not be described here. In addition, the beneficial effects of using the same method will not be described here. For technical details not disclosed in the computer-readable storage medium embodiments involved in the present application, please refer to the description of the method embodiments of the present application. For example, the program instructions can be deployed to be executed on one computing device, or on multiple computing devices located in one place, or on multiple computing devices distributed in multiple places and interconnected through a communication network.
[0104] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. The above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the above-mentioned method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0105] In addition, it should be noted that the above-described device embodiments are only schematic, and the units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e., they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment. In addition, the device embodiments provided by the application in the drawings show that the connection relationship between the modules indicates that there is a communication connection between them, which can be realized as one or more communication buses or signal lines. Those skilled in the art can understand and implement it without creative labor.
[0106] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software necessary general hardware, of course, can also be implemented by special hardware including special integrated circuit, special CPU, special memory, special component and the like. Generally, the functions completed by the computer program can be easily realized by the corresponding hardware, and the specific hardware structure for realizing the same function can also be various, such as analog circuit, digital circuit or special circuit and the like. However, for the present application, the software program implementation is a better embodiment. Based on such understanding, the technical solutions of the present application or the part of the prior art can be embodied in the form of software product, which is stored in a readable storage medium, such as a floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc., including a plurality of instructions for making a computer device (which can be a personal computer, a server, or a network device, etc.) execute the method described in various embodiments of the present application.
Claims
1. A transaction endorsement method for Fabric blockchain, characterized in that: For endorsing a node, the method comprises the following steps: Upon receiving a transaction proposal sent by a client node, pre-execute the transaction proposal and generate an endorsement result for the transaction proposal; wherein the transaction proposal includes initialization information, which is used to initialize the smart contract of the endorsing node; the initialization information includes the update status of the smart contract, which includes a normal state and a destroyed state; Sending the endorsement result to the client node, and monitoring the broadcast information of the block corresponding to the endorsement result; If a block corresponding to the endorsement result is received, the transaction proposal corresponding to the block is executed, and the smart contract is initialized according to the initialization information in the transaction proposal. The steps of initializing the smart contract specifically include: If the update status is normal, the smart contract status of the endorsement node is updated to normal to establish a transaction channel between the endorsement node and the corresponding submission node; If the updated status is the destroyed status, the smart contract status of the endorsement node is updated to the destroyed status to destroy the transaction channel between the endorsement node and the corresponding submission node.
2. A transaction endorsement device for Fabric blockchain, characterized in that: Deployed on an endorsing node, the device includes: A proposal receiving module is configured to, upon receiving a transaction proposal sent by a client node, pre-execute the transaction proposal and generate an endorsement result for the transaction proposal; wherein the transaction proposal includes initialization information, which is used to initialize the smart contract of the endorsing node; the initialization information includes an update status of the smart contract, which includes a normal state and a destroyed state; A monitoring module, configured to send the endorsement result to the client node and monitor the broadcast information of the block corresponding to the endorsement result; The proposal execution module is used to execute the transaction proposal corresponding to the block upon receiving the block corresponding to the endorsement result, and initialize the smart contract according to the initialization information in the transaction proposal; the steps of initializing the smart contract specifically include: If the update status is normal, the smart contract status of the endorsement node is updated to normal to establish a transaction channel between the endorsement node and the corresponding submission node; If the updated status is the destroyed status, the smart contract status of the endorsement node is updated to the destroyed status to destroy the transaction channel between the endorsement node and the corresponding submission node.
3. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 2 is implemented.
4. A readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 2.
Citation Information
Patent Citations
Block chain consensus method, client, endorsement node and sorting node
CN111629039A
Iron and steel supply chain product traceability system based on block chain technology
CN112347194A