Blockchain-based process management method, blockchain node, and server
Patent Information
- Application Number
- CN202310906992.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-21
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-07-21
AI Technical Summary
[0023]本说明书第六方面提供一种区块链节点,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现第一方面所述的方法。
Smart Images

Figure CN116957313B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification belong to the field of blockchain technology, and in particular relate to a blockchain-based process management method, blockchain node, and server. Background Technology
[0002] Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. In a blockchain system, data blocks are sequentially linked together to form a chain-like data structure, and a distributed ledger is cryptographically guaranteed to be immutable and unforgeable. Due to its decentralized, immutable, and autonomous characteristics, blockchain is receiving increasing attention and application. Summary of the Invention
[0003] The purpose of this invention is to provide a blockchain-based process management solution that simplifies the data structure of process status and improves the efficiency of putting process status on the blockchain.
[0004] The first aspect of this specification provides a blockchain-based process management method, executed by blockchain nodes, including:
[0005] The first transaction is received from the first server. The first transaction invokes a contract. The contract state stores the first main process state of the main process of the target object and the first sub-process state of the sub-process. The sub-process corresponds to the current first state value of the first main process state. The first server stores the second sub-process state of the sub-process. The first transaction includes the current second state value of the second sub-process state.
[0006] Based on the first transaction, the first sub-process state is updated to the second state value in the contract state, and information indicating that the update is complete is returned to the first server, so that the second server can obtain the information and update the second main process state of the main process from the first state value to the third state value in response to the information.
[0007] The second transaction is received from the second server, the second transaction invokes the contract, and the second transaction includes the current third state value of the second main process state;
[0008] According to the second transaction, if it is determined that the current second state value of the first sub-process state stored in the contract state is a preset state value, the first main process state is updated to the third state value.
[0009] The second aspect of this specification provides a blockchain-based process management method, executed by a server. The server stores a second main process state of a target object's main process and a second sub-process state of a sub-process. The sub-process corresponds to a current first state value of the second main process state, and the current state value of the second sub-process state is a second state value. The method includes:
[0010] Receive first information from the blockchain system indicating that the first subprocess state of the subprocess stored in the contract state of the contract is updated to the second state value;
[0011] Based on the first information, if the second state value is determined to be a preset state value, the state value of the second main process state is updated from the first state value to the third state value.
[0012] The second transaction is sent to the blockchain system. The second transaction invokes the contract. The second transaction includes the current third state value of the second main process state, which is used to update the first main process state of the main process stored in the contract state to the third state value.
[0013] A third aspect of this specification provides a blockchain node, including:
[0014] A receiving unit is configured to receive a first transaction from a first server. The first transaction invokes a contract. The contract state stores a first main process state of the main process of the target object and a first sub-process state of the sub-process. The sub-process corresponds to the current first state value of the first main process state. The first server stores a second sub-process state of the sub-process. The first transaction includes the current second state value of the second sub-process state.
[0015] An update unit is configured to update the first sub-process state to the second state value in the contract state according to the first transaction, and return information to the first server to indicate that the update is complete, so that the second server can obtain the information and update the second main process state of the main process from the first state value to the third state value in response to the information.
[0016] The receiving unit is further configured to: receive a second transaction from the second server, the second transaction invoking the contract, the second transaction including the current third state value of the second main process state;
[0017] The update unit is further configured to: update the first main process state to the third state value according to the second transaction, provided that the current second state value of the first sub-process state stored in the contract state is a preset state value.
[0018] A fourth aspect of this specification provides a server that stores a second main process state of a main process of a target object and a second sub-process state of a sub-process, wherein the sub-process corresponds to a current first state value of the second main process state, and the current state value of the second sub-process state is a second state value. The server includes:
[0019] A receiving unit is configured to receive from the blockchain system first information indicating that the first subprocess state of the subprocess stored in the contract state of the contract has been updated to the second state value;
[0020] The update unit is used to update the state value of the second main process state from the first state value to the third state value based on the first information and when the second state value is determined to be a preset state value.
[0021] A sending unit is used to send a second transaction to the blockchain system. The second transaction invokes the contract. The second transaction includes the current third state value of the second main process state. The unit is used to update the first main process state of the main process stored in the contract state to the third state value.
[0022] The fifth aspect of this specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the methods described in the first or second aspect.
[0023] A sixth aspect of this specification provides a blockchain node, including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method described in the first aspect.
[0024] The seventh aspect of this specification provides a blockchain node, including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method described in the second aspect.
[0025] The process management scheme provided in the embodiments of this specification decouples a portion of the state at different levels or in different dimensions of the process from the state of the main process state machine, thereby reducing the complexity of the state of the main process state machine. This simplifies the code of the contract used to put the state on the blockchain, making it easier to put the process state on the blockchain. Attached Figure Description
[0026] To more clearly illustrate the technical solutions of the embodiments in this specification, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 A blockchain architecture diagram in one embodiment is shown;
[0028] Figure 2 This is a schematic diagram of a business scenario provided in the embodiments of this specification;
[0029] Figure 3 This is a flowchart of the process management method in the embodiments of this specification;
[0030] Figure 4 This is a schematic diagram of the order process state machine in the embodiments of this specification;
[0031] Figure 5 This is a flowchart of a process management method in another embodiment of this specification;
[0032] Figure 6 This is a schematic diagram of the order process state machine in another embodiment of this specification;
[0033] Figure 7 This is a flowchart of a process management method in another embodiment of this specification;
[0034] Figure 8 This is a schematic diagram of the order process state machine in another embodiment of this specification;
[0035] Figure 9 This is an architecture diagram of a blockchain node in one of the embodiments of this specification;
[0036] Figure 10 This is an architecture diagram of a server as described in one of the embodiments of this specification. Detailed Implementation
[0037] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0038] Figure 1 A blockchain architecture diagram from one embodiment is shown. Figure 1 In the blockchain architecture diagram shown, blockchain 100, for example, contains 6 nodes: nodes 1 through 6. The lines between nodes schematically represent P2P (Peer-to-Peer) connections. These nodes can store the entire ledger, that is, the state of all blocks and all accounts. Each node in the blockchain can produce the same state in the blockchain by executing the same transaction, and each node in the blockchain can store the same state database. This can be understood as... Figure 1 Although the example shows a blockchain with 6 nodes, this specification's embodiments are not limited to this and may include other numbers of nodes. Specifically, the nodes in the blockchain can satisfy the Byzantine Fault Tolerance (BFT) requirement. The Byzantine Fault Tolerance requirement can be understood as the existence of Byzantine nodes within the blockchain, while the blockchain does not exhibit Byzantine behavior externally. Generally, some Byzantine Fault Tolerance algorithms require a number of nodes greater than 3f+1, where f is the number of Byzantine nodes, such as the Practical Byzantine Fault Tolerance (PBFT) algorithm.
[0039] In the blockchain field, a transaction refers to a unit of task executed and recorded within the blockchain. A transaction typically includes a From field, a To field, and a Data field. Specifically, in the case of a transfer transaction, the From field represents the account address initiating the transaction (i.e., initiating a transfer task to another account), the To field represents the account address receiving the transaction (i.e., receiving the transfer), and the Data field includes the transfer amount. In the case of a transaction calling a smart contract on the blockchain, the From field represents the account address initiating the transaction, the To field represents the account address of the contract called by the transaction, and the Data field includes the function name in the called contract and the parameters passed to that function, which is used to retrieve and execute the function's code from the blockchain during transaction execution.
[0040] Blockchain provides the functionality of smart contracts. A smart contract on the blockchain is a contract that can be triggered and executed by transactions within the blockchain system. Smart contracts can be defined in the form of code. Calling a smart contract on the blockchain involves initiating a transaction pointing to the smart contract's address, causing each node in the blockchain to run the smart contract code in a distributed manner. It should be noted that besides users creating smart contracts, the system can also set smart contracts in the genesis block. These contracts are generally called genesis contracts. Typically, genesis contracts can set some blockchain data structures, parameters, attributes, and methods. Furthermore, accounts with system administrator privileges can create or modify system-level contracts (referred to as system contracts). These system contracts can be used to add data structures for different business operations to the blockchain.
[0041] In a contract deployment scenario, for example, Bob sends a transaction containing information about creating a smart contract (i.e., deploying the contract) to a server such as... Figure 1 In the blockchain shown, the `data` field of the transaction includes the code (such as bytecode or machine code) of the contract to be created, and the `to` field of the transaction is empty, indicating that the transaction is used to deploy the contract. After the nodes reach an agreement through the consensus mechanism, the contract address "0x6f8ae93…" is determined. Each node adds a contract account corresponding to the contract address of the smart contract to the state database, allocates state storage corresponding to the contract account, and saves the contract code in the contract's state storage, thus the contract is successfully created.
[0042] In scenarios where contracts are invoked, for example, Bob sends a transaction to invoke a smart contract, such as... Figure 1 In the blockchain shown, the `from` field of this transaction is the address of the account of the transaction initiator (i.e., Bob), the `to` field "0x6f8ae93…" represents the address of the smart contract being invoked, and the `data` field of the transaction includes the method and parameters for invoking the smart contract. After consensus is reached on this transaction in the blockchain, each node in the blockchain can execute the transaction, thereby executing the contract separately, and updating the state database based on the execution of the contract.
[0043] In complex business processes such as cross-border trade, the numerous states and intricate procedures result in a highly complex state machine that is difficult to maintain. This makes it challenging to put the complex business process data on the blockchain, thus limiting the application of blockchain technology in such business.
[0044] In the embodiments described in this specification, by decoupling complex business processes in multiple layers and dimensions, the complexity of the state machine of the business process is reduced, thereby simplifying the code of the contract used to put business process data on the chain, reducing the difficulty of putting business process data on the chain, and improving the efficiency of putting business process data on the chain.
[0045] Figure 2 This is a schematic diagram illustrating a business scenario provided for an embodiment of this specification. For example... Figure 2 As shown, blockchain 100 pre-deploys a smart contract (hereinafter referred to as contract C1) for process management. This smart contract is established based on the multi-layered and multi-dimensional business process architecture of the embodiments in this specification. Platform server 10, for example, is used to provide a cross-border trade platform. Platform server 10 can store the process states of different levels and dimensions of the order's main process, sub-processes, change processes, and on-chain processes. Platform server 10 can update the state of the process by sending a transaction to the blockchain to invoke the smart contract, storing the state update in the smart contract's contract state, and promoting the progress of the corresponding level and dimension of the process after the state is on-chain. At the same time, bank server 20 and logistics server 30 participating in the cross-border trade platform can store the sub-processes corresponding to the order locally, and update the state of the sub-processes by sending a transaction to the blockchain 100 to invoke the smart contract, storing the state update in the sub-processes in the smart contract's contract state.
[0046] The following describes the blockchain-based process management scheme in the embodiments of this specification.
[0047] Figure 3 This is a flowchart of the process management method in the embodiments of this specification. Figure 3 The server shown corresponds to the platform server. The process of updating the process status is described below using the platform server as an example. It can be understood that the embodiments in this specification are not limited to this. For example, as mentioned above, the status of the corresponding sub-process can be uploaded to the blockchain through bank servers and logistics servers, etc., so as to promote the subsequent processes of the main process and sub-process in the platform server.
[0048] refer to Figure 3 First, in step S301, the server sends transaction Tx1 to the blockchain system. Transaction Tx1 calls the aforementioned contract C1 to update the state value of subprocess state s1 based on the state value of subprocess state s2.
[0049] Figure 4 This is a schematic diagram of the order process state machine in the embodiments of this specification. The state machine may include a main process state machine and sub-process state machines. It can be maintained in the platform server as follows: Figure 4The diagram shows the order flow state machine, where, for example, variable m2 represents the state changes of the main order flow, and variable s2 represents the state changes of the sub-order flows. Figure 4 As shown, this subprocess corresponds to the state value of variable m2 in the main process, which is "pending shipment". In other words, when the value of variable m2 changes to "pending shipment", the server allows the establishment of a state machine for the subprocess corresponding to the main process. This subprocess state machine is used, for example, to indicate the status of the customs declaration process.
[0050] At the same time, the contract state of contract C1 in the blockchain can also maintain something like this. Figure 4 The state machine for the order process is shown. Specifically, the contract state of contract C1 stores the values of variables m1 and s1, where variable m1 represents the state change of the main order process and variable s1 represents the state change of the sub-order process.
[0051] like Figure 4 As shown in the main process state machine, after the server determines that the buyer has initiated an order based on the buyer's actions, the server sets the value of variable m2 to "buyer initiated an order" and sends a transaction to the blockchain calling contract C1 to update the value of variable m1 in the contract state to "buyer initiated an order". The server can allow further updates to the main process state machine only after confirming that the value of variable m1 in the blockchain has been updated to "buyer initiated an order" to ensure the consistency of on-chain and off-chain states (this part will be referred to below). Figure 7 and Figure 8 (Detailed description). The server can then set the value of variable m2 to "Pending seller confirmation of order" and update the value of variable m1 in the blockchain according to the current state value of variable m2. After determining that the seller has confirmed the order based on the seller's actions, the server can set the value of variable m2 to "Pending shipment" or "Pending payment" depending on the different types of payment methods. Common payment methods include payment after delivery, payment before delivery, and deposit before shipment.
[0052] Assuming the server sets the value of variable m2 to "pending shipment" for this order, similarly, the server updates the value of variable m1 in the blockchain to "pending shipment" based on the value of variable m2. Then, based on the trade type corresponding to the order, the server can select the corresponding shipping sub-process. The trade type includes, for example, domestic trade, cross-border trade, and market procurement. For example, if the trade type of this order is cross-border trade, the shipping sub-process can be as follows: Figure 4The diagram shows the various states during the customs declaration process. Specifically, after the server determines that the value of variable m1 in the blockchain has been updated to "Pending Shipment," it can create a variable s2 corresponding to "Pending Shipment," and set the value of variable s2 to "Pending Upload of Customs Declaration" according to the sub-process corresponding to the trade type of the order. At the same time, the platform server updates the state value of variable s1 in the blockchain based on this state value of variable s2.
[0053] The platform server can send a transaction to the blockchain system to create variable s1 in the contract state of contract C1 in the blockchain based on the initial state value of variable s2, such that the initial state value of variable s1 is equal to the initial state value of variable s2, and that variable s1 corresponds to variable s2. This transaction may include the trade type of the order. When the blockchain node executes the transaction, it verifies whether the initial state value of the sub-process corresponding to the trade type is the initial state value of variable s2. If the verification is successful, the value of variable s1 is stored as the initial state value of variable s2.
[0054] In response to the sub-process status, the seller can upload a customs declaration to customs and other relevant documents to the platform server. These documents may include information such as the order number. After confirming that the seller has uploaded the customs declaration based on the document information, the platform server updates the value of variable s2 to "Pending Approval." Simultaneously, the platform server sends a transaction to the blockchain to update the status value of variable s1 to "Pending Approval." The platform server then determines whether "Pending Approval" is a preset status (i.e., "Customs Clearance") to determine if the sub-process has ended. If "Pending Approval" is not a preset status, the sub-process continues.
[0055] After the platform server confirms that customs has approved the customs declaration based on the seller's actions, it updates the value of variable s2 to "cleared and released". Then, the platform server generates transaction Tx1, which calls contract C1. Transaction Tx1 includes the order number, the document indicating approval, and the state value of sub-process state s2 (i.e., variable s2). Transaction Tx1 is then sent to the blockchain system to update the state value of sub-process state s1 (i.e., variable s1) based on the state value of sub-process state s2.
[0056] In other words, by setting sub-process state machines for the state values in the main process, a general main process state machine can be used to represent the main process of multiple types of orders (e.g., multiple trade types), while different sub-process state machines represent the specific sub-process states of each type of order, thus simplifying the design of the state machine for multiple order types. Simultaneously, by decoupling a portion of the state in the entire process from the state of the main process state machine based on the sub-process state machine, the complexity of the main process state machine is reduced, thereby simplifying the code of contract C1 and making it easier to put the process state on the blockchain.
[0057] Furthermore, it is understood that although the embodiments in this specification describe the platform server uploading the state value of sub-process state s2 to the blockchain system, in actual practice, for example, a customs server may also upload the state value of sub-process state s2 to the blockchain system. The customs server will also update the state value of sub-process state s2 to the platform server simultaneously, thereby ensuring consistency between the state of the sub-process in the platform server and the state of the sub-process in the blockchain system. Additionally, although the embodiments in this specification use an order process as an example, these embodiments are not limited to this; for example, they can be used for any business process that includes complex process states.
[0058] In step S303, the blockchain system updates the state value of subprocess state s1 according to transaction Tx1.
[0059] After reaching a consensus on transaction Tx1, each consensus node in the blockchain system executes transaction Tx1. When executing transaction Tx1, the blockchain node executes contract C1, checks whether the status of the document confirmation sub-process used to indicate approval can be updated to "clearance". If it is confirmed that it can be updated, it retrieves variable s1 based on the order number and variable s2, and updates the value of variable s1 to "clearance".
[0060] In step S305, the blockchain system returns information to the platform server indicating that the update of the value of variable s2 is complete.
[0061] Specifically, a specific blockchain node can return a receipt to the platform server, which includes information indicating that the value of variable s2 has been updated.
[0062] In step S307, the platform server determines whether the current state value of subprocess state s2 is a preset state value.
[0063] The platform server, based on the preset platform program, determines whether the value of variable s2 is the preset "clearance". If it is, then execution is performed. Figure 3 If not, proceed with step S309 in the above process, and if not, continue executing the subprocess as described above.
[0064] In step S309, the platform server updates the status value of the main process status m2.
[0065] Once the platform server determines that variable s2 is "cleared and released", it ends the push on the sub-process and triggers a change to variable m2, that is, it updates the value of variable m2 from "pending shipment" to "shipment completed", thereby returning to the main process and pushing the main process forward.
[0066] In step S311, the platform server sends transaction Tx2 to the blockchain system to update the state value of the main process state m1 based on the state value of the main process state m2.
[0067] After updating the value of variable m2, the platform server generates transaction Tx2, which calls contract C1 and includes the order number, the state value of variable m2, etc. The platform server then sends transaction Tx2 to the blockchain system for updating the state value of the main process state m1 based on the state value of variable m2.
[0068] In step S313, the blockchain system updates the state value of the main process state m1 when it determines that the subprocess state s1 is a preset state value.
[0069] After consensus is reached on transaction Tx2 in the blockchain system, transaction Tx2 is executed. After executing transaction Tx2, the blockchain node first obtains the variable s1 corresponding to the current value of variable m1 "shipment on delivery", verifies whether the value of variable s1 is the preset value "customs clearance", and after confirming that the value of variable s1 is "customs clearance", it updates the value of variable m1 to "shipment completed" according to the value of variable m2.
[0070] In one implementation, transaction Tx2 also includes the payment type of the order, as described above, which can be a payment-after-delivery type, a payment-after-delivery type, etc. During the execution of contract C1, the blockchain node determines which state value to update the variable m1 to based on the payment type of the order. For example, refer to... Figure 4 If it's a prepayment, post-delivery transaction, the value of variable m1 is updated to "delivery completed"; if it's a delivery first, post-payment transaction, the value of variable m1 is updated to "pending payment". Then, the blockchain node can verify the state value of variable m2 in transaction Tx2 based on this determined state value. If the verification is successful, the state value of variable m1 is updated to the state value of variable m2.
[0071] In step S315, the blockchain system returns information to the platform server indicating that the update of the state value of variable m1 is complete.
[0072] After receiving the information returned by the blockchain system, the platform server can update the value of the main process state m2 to the next state value (e.g., "pending delivery") to drive the main process forward.
[0073] In the embodiments of this specification, in addition to representing the sub-process state values associated with specific state values of the main process state through a sub-process state machine based on each stage of the main process, a bypass process state machine is also used to represent the state values of processes belonging to different dimensions from the main process. This means that these processes are decoupled from the main process as bypass processes, thereby further reducing the complexity of the main process. The bypass processes include, for example, change processes and on-chain processes, which are described separately below.
[0074] Figure 5 This is a flowchart of a process management method in another embodiment of this specification.
[0075] like Figure 5 As shown, in step S501, the platform server responds to the change request by setting the main process state m2 to non-updatable and storing the initial state value of the changed process state c2.
[0076] Figure 6 This is a schematic diagram of the order flow state machine according to another embodiment of this specification. Figure 6 As shown in the diagram, assuming the main order process reaches the "Pending Shipment" state (at this time, the state value of variable m2 is "Pending Shipment"), the seller initiates a request to modify the shipping address. This modification request includes, for example, the order number and the modified shipping address. Upon receiving this modification request, the platform server, in response, sets the main process state m2 to non-updatable, i.e., locks variable m2, preventing the platform server from updating the state value of variable m2, thus blocking the main process. If the main process state m2 has a sub-process corresponding to the "Pending Shipment" state (e.g., ...), the seller may also request a modification request to modify the shipping address. Figure 4 In the case of the subprocess shown, the variable s2 corresponding to the subprocess is set to non-updatable.
[0077] Next, the platform server creates a variable c2 corresponding to the change process, which serves as the change process state machine. The value of variable c2 is set to, for example, "content scanning in progress," and this initial state value of variable c2 is stored. At the same time, the platform server scans the modification request to determine whether the modification request complies with the regulations.
[0078] In step S503, the platform server sends transaction Tx3 to the blockchain system to store the state value of the change process state c1 based on the initial state value of the change process state c2.
[0079] After setting the value of variable c2 to "content scanning in progress," the platform server generates transaction Tx3. Transaction Tx3 invokes contract C1 and includes, for example, the order number and the initial state value of variable c2. Transaction Tx3 may also include information indicating the change process corresponding to variable c2 and the current state value of variable m2, which corresponds to variable c2. The platform server then sends transaction Tx3 to the blockchain system.
[0080] In step S505, the blockchain system sets the main process state m1 to be non-updatable based on transaction Tx3 and stores the initial state value of the change process state c1.
[0081] After the blockchain system reaches a consensus on the received transaction Tx3, each blockchain node executes transaction Tx3. During the execution of transaction Tx3, each blockchain node determines that variable c2 corresponds to a change process based on transaction Tx3. Therefore, it sets the main process state m1 to be non-updatable and creates a variable c1 in the contract state of contract C1, corresponding to the state value "pending shipment" of variable m1. It stores the correspondence between variables c1 and c2 and sets the value of variable c1 to the initial state value of variable c2 in transaction Tx3, such as "content scanning in progress".
[0082] In step S507, the blockchain system returns information to the platform server indicating that the status value storage of the change process status c1 is complete.
[0083] In step S509, the platform server updates the status value of change process status c2 in response to the progress of the change process.
[0084] refer to Figure 6 Once the platform server confirms that the scan for the change request is complete and the scan results meet the requirements, it can update the value of variable c2 to "Change Confirmation in Progress" to advance the change process. After the buyer checks the change process status on the platform server and finds it updated to "Change Confirmation in Progress," they can obtain the seller's change request and, if the change is permitted, confirm it.
[0085] After updating the value of variable c2, the platform server sends a transaction to the blockchain system to update the value of variable c1 in the blockchain system. When the blockchain system executes this transaction, it updates the value of variable c1 to "Change Confirmation in Progress," then determines whether the current value of variable c1 is a preset value (e.g., "Modification Confirmed"). If not, the execution of the transaction ends, and information indicating that variable c1 has been updated is returned to the regular platform server.
[0086] After receiving confirmation from the buyer regarding their change request, the platform server updates the value of variable c2 to "Modification Confirmed".
[0087] In step S511, the platform server sends transaction Tx4 to the blockchain system to update the status value of change process status c1 based on the status value of change process status c2.
[0088] After updating the value of variable c2 to "Modification Confirmed", the platform server generates transaction Tx4, which includes the order number and the current state value of variable c2, and sends transaction Tx4 to the blockchain system.
[0089] In step S513, the blockchain system updates the status value of the change process status c1 according to transaction Tx4. If the change process status c1 is the preset status value, the main process status m1 is set to be updatable.
[0090] When executing transaction Tx4, the blockchain system updates the value of variable c1 to the current state value of variable c2 (i.e., "modification confirmed") based on the correspondence between variables c1 and c2, and confirms whether the current state value of variable c1 is the preset value (i.e., "modification confirmed"). If the current state value of variable c1 is confirmed to be the preset value, variable m1 is restored to be updatable.
[0091] In step S515, the blockchain system returns information to the platform server indicating that the update of the change process status c1 is complete.
[0092] In step S517, when the platform server changes the process state c2 to a preset state value, it sets the main process state m to be updatable.
[0093] After confirming that the blockchain system has updated the state value of variable c1, the platform server checks whether the current state value of variable c2 is the preset value (i.e., "modification confirmed"). If the current state value of variable c2 is confirmed to be the preset value, variable m2 is restored to be updatable. This cancels the blockade on the main process and allows it to continue.
[0094] It is understood that although the embodiments in this specification describe that the platform server sets the main process state m2 to updatable only after determining that the value of variable c1 in the blockchain has been updated, this specification is not limited to this. For example, the platform server may set the main process state m2 to updatable after updating variable c2 and determining that the state value of variable c2 is a preset state value, and then send transaction Tx4 to the blockchain to update the value of variable c1 in the blockchain and trigger the setting of variable m1 to updatable.
[0095] In the embodiment described in this specification, the update process is decoupled from the main process, thereby reducing the number of states in the main process's state machine, reducing the complexity of the contract code, and reducing the difficulty of putting the process state on the blockchain.
[0096] Figure 7 This is a flowchart of a process management method in another embodiment of this specification.
[0097] like Figure 7 As shown, in step S701, the platform server updates the state value of process state t2, sets process state t2 to be non-updatable, and stores the initial state value of the on-chain process state.
[0098] The process state t2 can correspond to any of the main process, sub-process, and change process mentioned above. That is, during any of the main process, sub-process, and change process, when it is necessary to add the process state t2 value to the blockchain, the process is blocked. After the process state is added to the blockchain, the block is released. The following description uses the main process as an example.
[0099] Figure 8 This is a schematic diagram of an order process state machine in another embodiment of this specification, wherein the process state machine includes, for example, a main process state machine and an on-chain process state machine.
[0100] After updating the main process status m2 to "Pending Shipment", the platform server sets the variable m2 to be non-updatable to block the main process. Then, the platform server creates an on-chain variable corresponding to the current status value of the process status m2 to indicate the on-chain process status, and sets the initial status value of the on-chain variable to "On-chain".
[0101] In step S703, the platform server sends a transaction to the blockchain system to update the state value of process state t1 based on the state value of process state t2.
[0102] The platform server generates a transaction Tx5, which includes the order number and the current state value of variable m2. Transaction Tx5 may also include document information. The platform server then sends the transaction Tx5 to the blockchain system for updating the state value of variable m1 based on the value of variable m2.
[0103] In step S705, the blockchain system stores the state value of process state t1.
[0104] After receiving transaction Tx5, the blockchain system obtains the variable m1 corresponding to the order number based on transaction Tx5 and updates the value of variable m1 to "pending shipment".
[0105] In step S707, the blockchain system returns information to the platform server indicating that the process status t1 update is complete.
[0106] Specifically, the blockchain system returns information to the platform server indicating that the update of the indicator variable m1 is complete.
[0107] In step S709, the platform server responds to the information from the blockchain system, updates the status value of the on-chain process status, and sets the process status t2 to be updatable.
[0108] After confirming that the updated state value of variable m2 has been uploaded to the blockchain, the platform server updates the value of the uploaded variable to "upload complete" and sets variable m2 to be updatable, thereby driving the main process forward.
[0109] In the embodiment of this specification, the on-chain process is decoupled from the main process, thereby reducing the number of states in the main process's state machine. Furthermore, the on-chain-related states of the process state machine can be removed from the contract code, reducing the complexity of the contract code and lowering the difficulty of on-chaining the process states.
[0110] In the embodiments described in this specification, the platform server can store documents, information, etc., into the blockchain through individual storage transactions. In this case, the platform server can perform storage in a non-blocking manner. That is, after sending the storage transaction to the blockchain system, the platform server does not need to wait for the execution result of the transaction and can continue the process. In addition, some state changes in the platform server require interaction with the user. The platform server can change the interaction with the user from asynchronous to synchronous, so that the user waits synchronously for the on-chain result.
[0111] Figure 9 This is an architecture diagram of a blockchain node according to an embodiment of this specification. The blockchain node is used to perform actions such as... Figure 3 , Figure 5 or Figure 7 The method shown includes:
[0112] The receiving unit 91 is used to receive a first transaction from a first server. The first transaction invokes a contract. The contract state stores a first main process state of the main process of the target object and a first sub-process state of the sub-process. The sub-process corresponds to the current first state value of the first main process state. The first server stores a second sub-process state of the sub-process. The first transaction includes the current second state value of the second sub-process state.
[0113] The update unit 92 is configured to update the first sub-process state to the second state value in the contract state according to the first transaction, and return information to the first server to indicate that the update is complete, so that the second server can obtain the information and update the second main process state of the main process from the first state value to the third state value in response to the information.
[0114] The receiving unit 91 is further configured to: receive a second transaction from the second server, the second transaction invoking the contract, the second transaction including the current third state value of the second main process state;
[0115] The update unit 92 is further configured to: update the first main process state to the third state value according to the second transaction, provided that the current second state value of the first sub-process state stored in the contract state is a preset state value.
[0116] Figure 10 This is an architecture diagram of a server in one embodiment of this specification. The server stores a second main process state of the main process of the target object and a second sub-process state of the sub-process. The sub-process corresponds to the current first state value of the second main process state, and the current state value of the second sub-process state is the second state value. The server is used to execute, for example... Figure 3 , Figure 5 or Figure 7 The method shown includes:
[0117] Receiving unit 101 is configured to receive from the blockchain system first information indicating that the first subprocess state of the subprocess stored in the contract state of the contract is updated to the second state value;
[0118] The update unit 102 is used to update the state value of the second main process state from the first state value to the third state value based on the first information, when the second state value is determined to be a preset state value.
[0119] Sending unit 103 is used to send a second transaction to the blockchain system. The second transaction calls the contract. The second transaction includes the current third state value of the second main process state. It is used to update the first main process state of the main process stored in the contract state to the third state value.
[0120] This specification also provides a computer-readable storage medium storing a computer program thereon, which, when executed in a computer, causes the computer to perform actions such as... Figure 3 , Figure 5 or Figure 7 The method shown.
[0121] This specification also provides a blockchain node, including a memory and a processor. The memory stores executable code, and when the processor executes the executable code, it implements... Figure 3 , Figure 5 or Figure 7 The method shown.
[0122] The seventh aspect of this specification provides a blockchain node, including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method described in the second aspect.
[0123] This specification also provides a computer-readable storage medium storing a computer program thereon, which, when executed in a computer, causes the computer to perform actions such as... Figures 3-5 The method shown in any of the accompanying figures.
[0124] This specification also provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements, as described above. Figures 3-5 The method shown in any of the accompanying figures.
[0125] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0126] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0127] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude the possibility that, with the future development of computer technology, the computer implementing the functions of the above embodiments can be, for example, a personal computer, a laptop computer, an in-vehicle human-machine interaction device, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0128] While one or more embodiments of this specification provide the operational steps of the methods described in the embodiments or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive means. The order of steps listed in the embodiments is merely one possible order of execution among many steps and does not represent the only possible order. In actual device or end product execution, the methods shown in the embodiments or drawings may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even a distributed data processing environment). The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitations, the presence of other identical or equivalent elements in the process, method, product, or apparatus that includes the elements is not excluded. For example, the use of terms such as "first," "second," etc., is to denote names and does not indicate any particular order.
[0129] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, when implementing one or more of these specifications, the functions of each module can be implemented in one or more software and / or hardware components, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.
[0130] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0131] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0132] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0133] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0134] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0135] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0136] Those skilled in the art will understand that one or more embodiments of this specification can be provided as a method, system, or computer program product. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0137] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can reside in local and remote computer storage media, including storage devices.
[0138] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, system embodiments are basically similar to method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. In the description of this specification, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this specification. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described can be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0139] The above description is merely an embodiment of one or more embodiments of this specification and is not intended to limit the scope of this specification. Various modifications and variations can be made to the one or more embodiments of this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims.
Claims
1. A blockchain-based process management method, executed by blockchain nodes, comprising: The first transaction is received from the first server. The first transaction invokes a contract. The contract state stores the first main process state of the main process of the target object and the first sub-process state of the sub-process. The sub-process corresponds to the current first state value of the first main process state. The first server stores the second sub-process state of the sub-process. The first transaction includes the current second state value of the second sub-process state. Based on the first transaction, the first sub-process state is updated to the second state value in the contract state, and information indicating that the update is complete is returned to the first server, so that the second server can obtain the information and update the second main process state of the main process from the first state value to the third state value in response to the information. The second transaction is received from the second server, the second transaction invokes the contract, and the second transaction includes the current third state value of the second main process state; According to the second transaction, if it is determined that the current second state value of the first sub-process state stored in the contract state is a preset state value, the first main process state is updated to the third state value.
2. The method according to claim 1, further comprising: If it is determined that the current state value of the first sub-process state stored in the contract state is not a preset state value, the state value of the first main process state shall remain unchanged.
3. The method according to claim 1 or 2, wherein the sub-process is any one of the following: payment sub-process, logistics sub-process, customs declaration sub-process.
4. The method according to claim 1, wherein the second transaction further includes a first type of the target object, and the step of updating the first main process state to the third state value when the current second state value of the first sub-process state stored in the contract state is determined to be a preset state value includes: In the case where the current second state value of the first sub-process state stored in the contract state is determined to be a preset state value, the third state value is verified according to the first type of the target object. If the verification is successful, the first main process state is updated to the third state value.
5. The method according to claim 1, wherein the second transaction further includes a second type of the target object, and the step of updating the first sub-process state to the second state value in the contract state according to the first transaction includes: According to the sub-process corresponding to the second type, the second status value is verified. If the verification is successful, the first sub-process status is updated to the second status value in the contract status.
6. The method according to claim 1, further comprising: The third transaction is received from the second server. The third transaction invokes the contract and includes an initial state value of the second change process state, which is the state of the change process of the target object stored in the second server corresponding to the third state value. According to the third transaction, the first main process state is set to be non-updatable, the initial state value of the first change process state is stored in the contract state, such that the initial state value of the first change process state is equal to the initial state value of the second change process state, and information indicating that the storage of the first change process state is completed is returned to the second server.
7. The method according to claim 6, further comprising: The fourth transaction is received from the second server, which invokes the contract and includes the fourth state value of the second change process state; Based on the fourth transaction, the status value of the first change process status is updated to the fourth status value; If the fourth state value is determined to be a preset state, the first main process state is set to updatable, and information indicating that the update of the first change process state is completed is returned to the second server.
8. The method according to claim 1, wherein updating the first sub-process state to the second state value in the contract state according to the first transaction comprises: Based on the first transaction, the pre-stored documents associated with the sub-process are retrieved from the blockchain, and the documents are verified. If the verification is successful, the first sub-process status is updated to the second status value in the contract status.
9. A blockchain-based process management method, executed by a server, wherein the server stores a second main process state of a target object's main process and a second sub-process state of a sub-process, wherein the sub-process corresponds to a current first state value of the second main process state, and the current state value of the second sub-process state is a second state value, the method comprising: Receive first information from the blockchain system indicating that the first subprocess state of the subprocess stored in the contract state of the contract is updated to the second state value; Based on the first information, if the second state value is determined to be a preset state value, the state value of the second main process state is updated from the first state value to the third state value. The second transaction is sent to the blockchain system. The second transaction invokes the contract. The second transaction includes the current third state value of the second main process state, which is used to update the first main process state of the main process stored in the contract state to the third state value.
10. The method according to claim 9, wherein before receiving the first information, the method further comprises: The first transaction is sent to the blockchain system. The first transaction invokes the contract. The first transaction includes the second state value of the second sub-process state, which is used to update the first sub-process state stored in the contract state to the second state value.
11. The method of claim 9, further comprising: In response to the user's change request, the second main process state is set to non-updatable, and the initial state value of the second change process state corresponding to the third state value is stored. The third transaction is sent to the blockchain system. The third transaction invokes the contract, including the initial state value of the second change process state, and is used to store the initial state value of the first change process state of the change process in the contract state.
12. The method of claim 11, further comprising: Receive second information from the blockchain system indicating that the storage of the status value of the first change process status is complete; After receiving the second information, the status value of the second change process is updated to the fourth status value according to the progress of the change process. If the fourth state value is determined to be a preset state value, the second main process state is set to be updatable.
13. The method of claim 12, further comprising: After updating the status value of the second change process state to the fourth status value, the fourth transaction is sent to the blockchain system. The fourth transaction invokes the contract, including the fourth status value of the second change process state, to update the first change process state to the fourth status value.
14. The method of claim 9, further comprising: After updating the state value of the second main process state from the first state value to the third state value, the second main process state is set to be non-updatable, and the initial state value of the on-chain process state of the on-chain process corresponding to the third state value is stored. After receiving information from the blockchain system indicating that the first main process state stored in the contract state should be updated to the third state value, the on-chain process state is updated to a state value indicating that the on-chain process is complete, and the second main process state is set to be updatable.
15. The method of claim 9, further comprising: The fifth transaction is sent to the blockchain system, and the fifth transaction invokes the contract, including the document of the target object, to store the document in the contract state.
16. A blockchain node, comprising: A receiving unit is configured to receive a first transaction from a first server. The first transaction invokes a contract. The contract state stores a first main process state of the main process of the target object and a first sub-process state of the sub-process. The sub-process corresponds to the current first state value of the first main process state. The first server stores a second sub-process state of the sub-process. The first transaction includes the current second state value of the second sub-process state. An update unit is configured to update the first subprocess state to the second state value in the contract state according to the first transaction, and return information to the first server to indicate that the update is complete, so that the second server can obtain the information and update the second main process state of the main process from the first state value to the third state value in response to the information. The receiving unit is further configured to: receive a second transaction from the second server, the second transaction invoking the contract, the second transaction including the current third state value of the second main process state; The update unit is further configured to: update the first main process state to the third state value according to the second transaction, provided that the current second state value of the first sub-process state stored in the contract state is a preset state value.
17. A server, the server storing a second main process state of a main process of a target object and a second sub-process state of a sub-process, the sub-process corresponding to a current first state value of the second main process state, the current state value of the second sub-process state being a second state value, the server comprising: A receiving unit is configured to receive from the blockchain system first information indicating that the first subprocess state of the subprocess stored in the contract state of the contract has been updated to the second state value; The update unit is used to update the state value of the second main process state from the first state value to the third state value based on the first information and when the second state value is determined to be a preset state value. A sending unit is used to send a second transaction to the blockchain system. The second transaction invokes the contract. The second transaction includes the current third state value of the second main process state. The unit is used to update the first main process state of the main process stored in the contract state to the third state value.
18. A blockchain node comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-8.
Citation Information
Patent Citations
1.5-layer block chain and operation method and device thereof, and readable storage medium
CN114866478A
Business process execution engine based on block chain
CN115759955A