Resource allocation method and apparatus, computer readable medium, and electronic device
By generating and verifying multi-signature smart contracts in the blockchain network, the credibility problem of fund allocation in online transactions is solved, reliable resource allocation between the trading platform and the trading entities is realized, and the transparency and accuracy of transactions are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2021-09-22
- Publication Date
- 2026-05-29
AI Technical Summary
There is a problem of poor credibility in existing online transactions, especially in the process of fund allocation, where platforms that rely on a single entity may lead to a crisis of trust and settlement errors.
By sending a contract template into the blockchain network, the transaction platform nodes fill in the content and sign it to generate a one-party signed smart contract. The transaction entity nodes verify and sign it to form a multi-signature smart contract. Finally, the resource allocation node verifies the signature and then allocates the resources.
It improves the reliability and credibility of online transactions, avoids the trust crisis caused by relying on a single entity, and ensures the accuracy and transparency of fund allocation.
Smart Images

Figure CN115879934B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of blockchain technology, specifically relating to a resource allocation method, a resource allocation device, a computer-readable medium, and an electronic device. Background Technology
[0002] With the development of computer and network technologies, users can conduct online transactions and payments without leaving home using online trading and payment platforms. The overall transaction process involves multiple parties, including buyers, sellers, online marketplaces, and payment institutions. Typically, one or more of these parties need to be selected as trusted entities, and the transaction is conducted based on their instructions. For example, after receiving payment from a buyer, the payment institution will rely on the settlement method provided by the online marketplace to settle fees between the various parties. This method cannot prevent settlement errors or malicious fraud, resulting in relatively low credibility of online transactions. Summary of the Invention
[0003] The purpose of this application is to provide a resource allocation method, resource allocation device, computer-readable medium, and electronic device, which at least to some extent overcomes the technical problem of poor credibility of online transactions in related technologies.
[0004] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0005] According to one aspect of the embodiments of this application, a resource allocation method is provided. The method includes: sending a contract template for agreeing on resource allocation rules to a transaction platform node in a blockchain network, so that the transaction platform node performs content filling and signing processing on the contract template to obtain a unilaterally signed smart contract carrying the digital signature of the transaction platform node; sending the unilaterally signed smart contract to a transaction entity node in the blockchain network, so that the transaction entity node performs content verification and signing processing on the unilaterally signed smart contract to obtain a multi-signature smart contract carrying the digital signature of the transaction platform and the digital signature of the transaction entity; performing signature verification on the multi-signature smart contract, and allocating resources to the transaction platform node and the transaction entity node according to the verified multi-signature smart contract.
[0006] According to one aspect of the embodiments of this application, a resource allocation apparatus is provided, comprising: a first signature module configured to send a contract template for agreeing on resource allocation rules to a transaction platform node in a blockchain network, so that the transaction platform node performs content filling and signature processing on the contract template to obtain a unilaterally signed smart contract carrying the digital signature of the transaction platform node; a second signature module configured to send the unilaterally signed smart contract to a transaction entity node in the blockchain network, so that the transaction entity node performs content verification and signature processing on the unilaterally signed smart contract to obtain a multi-signature smart contract carrying the digital signature of the transaction platform and the digital signature of the transaction entity; and an allocation module configured to perform signature verification on the multi-signature smart contract and allocate resources to the transaction platform node and the transaction entity node according to the verified multi-signature smart contract.
[0007] In some embodiments of this application, based on the above technical solutions, the allocation module includes: a first signature separation module, configured to separate the signatures of the multi-signature smart contract to obtain contract content and the digital signatures of the transaction platform node and the transaction subject node attached to the contract content; a first digest extraction module, configured to extract a digest from the contract content using a hash algorithm to obtain a contract digest; a first signature decryption module, configured to decrypt the digital signature of the transaction platform node using the public key of the transaction platform node to obtain a first digest plaintext to be verified; a second signature decryption module, configured to decrypt the digital signature of the transaction subject node using the public key of the transaction subject node to obtain a second digest plaintext to be verified; and a digest verification module, configured to perform consistency verification on the contract digest, the first digest plaintext, and the second digest plaintext.
[0008] In some embodiments of this application, based on the above technical solutions, the allocation module further includes: a first detection module configured to detect resource allocation instructions transmitted on the blockchain network; a first parsing module configured to parse the resource allocation instructions to obtain the message transmission source and message transmission target of the resource allocation instructions; a contract invocation module configured to invoke a verified multi-signature smart contract bound to the trading platform node and the trading entity node if the message transmission source is the trading platform node and the message transmission target is the resource allocation node; and a resource allocation module configured to allocate resources to the trading platform node and the trading entity node according to the invocation result of the multi-signature smart contract.
[0009] In some embodiments of this application, based on the above technical solutions, the first signature module includes: a second detection module configured to detect contract signing requests transmitted on the blockchain network; a second parsing module configured to parse the contract signing request to obtain the message transmission source and message transmission target of the contract signing request; and a contract sending module configured to send a contract template for agreeing on resource allocation rules to the trading platform node if the message transmission source is a trading platform node and the message transmission target is a resource allocation node.
[0010] In some embodiments of this application, based on the above technical solutions, the contract sending module includes: a first address acquisition module, configured to acquire the node address of the trading platform node; a first message encapsulation module, configured to encapsulate a contract template for agreeing on resource allocation rules according to the node address of the trading platform node, to obtain a contract establishment message with the trading platform node as the message transmission target, the contract establishment message being used to instruct the trading platform node to establish a smart contract corresponding to the contract template; and a first message broadcasting module, configured to broadcast the contract establishment message on the blockchain network to send the contract template carried by the contract establishment message to the trading platform node.
[0011] In some embodiments of this application, based on the above technical solutions, the contract sending module includes: a template broadcasting module, configured to broadcast a contract template for agreeing on resource allocation rules on a blockchain network, so as to write the contract template into the blocks to be added to the blockchain on each blockchain node on the blockchain network; a template authentication module, configured to broadcast a block to be added to the blockchain network carrying the contract template when the block generation conditions are met, so that each blockchain node on the blockchain network can perform consensus authentication on the block to be added to the blockchain, and perform on-chain processing on the block to be added to the blockchain after the authentication is passed; and a height sending module, configured to send the block height of the target block where the contract template is located to the trading platform node, so that the trading platform node can query the contract template in the target block.
[0012] In some embodiments of this application, based on the above technical solutions, the contract sending module includes: an address and public key acquisition module, configured to acquire the node address and node public key of the trading platform node; a template encryption module, configured to encrypt a contract template used to agree on resource allocation rules according to the node public key to obtain an encrypted contract template; and an encryption sending module, configured to send the encrypted contract template to the trading platform node according to the node address, so that the trading platform node can decrypt the encrypted contract template using a node private key that matches the node public key to obtain the contract template.
[0013] In some embodiments of this application, based on the above technical solutions, the resource allocation device further includes: a result broadcasting module, configured to broadcast the verification result of the multi-signature smart contract on the blockchain network to save the verification result of the multi-signature smart contract to the contract buffer pool of the blockchain node; a data lookup module, configured to look up process data related to the establishment process of the multi-signature smart contract in the contract buffer pool; a first writing module, configured to associate the verification result of the multi-signature smart contract with the process data and then write it into the block to be uploaded to the blockchain; and a block broadcasting module, configured to broadcast the block to be uploaded to the blockchain network when the block generation conditions are met, so that the blockchain nodes on the blockchain network can perform consensus authentication on the block to be uploaded to the blockchain, and upload the block to the blockchain after the authentication is passed.
[0014] In some embodiments of this application, based on the above technical solutions, the resource allocation device further includes: a duration acquisition module, configured to acquire the buffer duration of each process data in the contract buffer pool; and a second writing module, configured to write the process data into the block to be added to the chain if the buffer duration of the process data is greater than the duration threshold.
[0015] In some embodiments of this application, based on the above technical solutions, the first signature module further includes: a first field recognition module, configured to perform field recognition on the contract template to obtain the fields to be filled in the contract template; a first field matching module, configured to obtain the resource allocation parameters agreed upon by the trading platform node and the trading entity node, and perform matching detection between the resource allocation parameters and the fields to be filled; a parameter writing module, configured to write the resource allocation parameters into the fields to be filled when the resource allocation parameters are successfully matched with the fields to be filled; and a unilateral signature module, configured to perform signature processing on the contract template filled with resource allocation parameters to obtain a unilaterally signed smart contract carrying the digital signature of the trading platform node.
[0016] In some embodiments of this application, based on the above technical solutions, the unilateral signature module includes: a second digest extraction module, configured to extract a digest from a contract template filled with resource allocation parameters using a hash algorithm to obtain a contract digest; a first digest encryption module, configured to encrypt the contract digest according to the private key of the trading platform node to obtain the digital signature of the trading platform node; and a unilateral signature appending module, configured to append the digital signature of the trading platform node to the contract template to obtain a unilaterally signed smart contract carrying the digital signature of the trading platform node.
[0017] In some embodiments of this application, based on the above technical solutions, the second signature module includes: a second address acquisition module, configured to acquire the node address of the transaction subject node in the blockchain network; a second message encapsulation module, configured to encapsulate the unilateral signature smart contract according to the node address of the transaction subject node, to obtain a contract signature message with the transaction subject node as the message transmission target, the contract signature message being used to instruct the transaction subject node to perform signature processing on the unilateral signature smart contract; and a second message broadcasting module, configured to broadcast the contract signature message on the blockchain network to send the unilateral signature smart contract carried by the contract signature message to the transaction subject node.
[0018] In some embodiments of this application, based on the above technical solutions, the second signature module further includes: a second field recognition module, configured to perform field recognition on the unilateral signature smart contract to obtain the filled fields in the contract template; a second field matching module, configured to obtain the resource allocation parameters agreed upon by the trading platform node and the trading entity node, and perform matching detection between the resource allocation parameters and the filled fields; a parameter verification module, configured to perform consistency verification on the field content of the resource allocation parameters and the filled fields when the resource allocation parameters and the filled fields are successfully matched; and a multi-signature module, configured to perform signature processing on the unilateral signature smart contract when the consistency verification result is a successful verification, to obtain a multi-signature smart contract carrying the digital signature of the trading platform and the digital signature of the trading entity.
[0019] In some embodiments of this application, based on the above technical solutions, the multi-signature module includes: a second signature separation module, configured to separate the signature of the single-signature smart contract to obtain contract content and the digital signature of the trading platform attached to the contract content; a third digest extraction module, configured to extract a digest from the contract content using a hash algorithm to obtain a contract digest; a second digest encryption module, configured to encrypt the contract digest according to the private key of the trading entity node to obtain the digital signature of the trading entity node; and a multi-signature attachment module, configured to attach the digital signature of the trading platform node and the digital signature of the trading entity node to the contract content to obtain a multi-signature smart contract carrying the digital signature of the trading platform node and the digital signature of the trading entity node.
[0020] According to one aspect of the embodiments of this application, a computer-readable medium is provided, on which a computer program is stored, which, when executed by a processor, implements the resource allocation method as described in the above technical solutions.
[0021] According to one aspect of the embodiments of this application, an electronic device is provided, the electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform a resource allocation method as described above by executing the executable instructions.
[0022] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the resource allocation method as described in the above technical solutions.
[0023] In the technical solution provided in this application embodiment, a contract template is provided by a resource allocation node. The transaction platform node fills in and signs the contract template to obtain a unilaterally signed smart contract. Then, the transaction entity node verifies the content of the unilaterally signed smart contract and signs it to obtain a multi-signature smart contract. Finally, the resource allocation node verifies the signature of the multi-signature smart contract and uses the verified multi-signature smart contract to allocate resources to the transaction platform node and the transaction entity node. This resource allocation method can improve the reliability and credibility of online transactions and avoid the trust crisis caused by relying on a single object.
[0024] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0026] Figure 1 A schematic diagram of the composition of the blockchain system in an embodiment of this application is shown.
[0027] Figure 2 The structure of a blockchain maintained on a blockchain network is shown.
[0028] Figure 3 The network architecture of a blockchain network applying the technical solution of this application is illustrated schematically.
[0029] Figure 4 A flowchart illustrating the steps of a resource allocation method in one embodiment of this application is shown schematically.
[0030] Figure 5 The flowchart illustrating the steps of saving contract formation data on the blockchain in one embodiment of this application is shown in the illustration.
[0031] Figure 6 The diagram illustrates the interactive flowchart of generating a unilaterally signed smart contract based on a contract template in one embodiment of this application.
[0032] Figure 7 The diagram illustrates an interactive flowchart of generating a multi-signature smart contract based on a unilateral signature smart contract in one embodiment of this application.
[0033] Figure 8 The diagram illustrates an interactive flowchart of resource allocation based on a multi-signature smart contract in one embodiment of this application.
[0034] Figure 9 The diagram illustrates an interactive flowchart of an embodiment of this application in a network transaction application scenario.
[0035] Figure 10 A schematic block diagram of the resource allocation device provided in the embodiments of this application is shown.
[0036] Figure 11 A schematic diagram of a computer system architecture suitable for implementing the embodiments of this application is shown. Detailed Implementation
[0037] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0038] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0039] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0040] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0041] Online transactions typically take place through online trading platforms. Sellers on these platforms must register and apply for payment collection qualifications with a third-party payment institution through the platform to receive payments. When a transaction occurs, the buyer on the platform pays the seller through the payment service provided by the third-party payment institution. As the provider of the transaction scenario, the platform needs to earn a fee from the transaction. At this point, the platform needs to call the third-party payment institution's revenue sharing interface and, according to the agreement between the platform and the seller, transfer a portion of the transaction funds to the platform's profit account opened with the third-party payment institution. Only then can the remaining funds be transferred to the seller's available balance account. From this process, the platform has a certain degree of control over the funds received by the seller. The seller can only receive the actual usable funds after the platform completes the revenue sharing process. During this process, the third-party payment institution completely relies on the platform's revenue sharing instructions. If the platform makes a mistake or issues a malicious revenue sharing instruction, the funds received by the seller will not be calculated according to the agreement between the seller and the platform, and the third-party payment institution will find it difficult to confirm and intercept such abnormal behavior. This leads to problems such as poor accuracy and reliability in fund allocation in online transactions.
[0042] To address the issue of abnormal revenue sharing instructions in the aforementioned revenue sharing process, this application provides a blockchain-based multi-signature revenue sharing contract generation scheme. The revenue sharing contract refers to a fund sharing agreement signed by a third-party payment institution, a merchant, and the platform, specifying the timing, maximum amount, maximum proportion, and other revenue sharing-related matters. The third-party payment institution completes the revenue sharing task based on the contract and the platform's specific revenue sharing instructions.
[0043] In the technical solution provided in this application embodiment, a third-party payment institution is included when the platform and the seller enter into a revenue-sharing agreement. This allows the third-party payment institution to verify that the platform's revenue-sharing instructions satisfy the agreement, and that the agreement has been signed and confirmed by both the platform and the seller. Furthermore, by storing the process and result data of the revenue-sharing agreement on a blockchain, the secure storage and immutability of the blockchain effectively guarantee the validity of the revenue-sharing agreement data.
[0044] The technical solutions provided in this application relate to online payment, transfer, and other transaction scenarios based on blockchain technology. A blockchain is a shared digital ledger with a chained-block data structure, built through transparent and trustworthy rules in a peer-to-peer network environment. This structure is designed to prevent forgery, tampering, and traceability. The chained-block data structure stores transactions occurring over a period of time in blocks, and uses cryptographic algorithms to link these blocks chronologically. The ledger is distributed to all member nodes in the network, and the historical record of asset transactions between peer nodes is permanently recorded in the sequential chain of blocks linked by hash cryptographic algorithms. All confirmed and verified transactions are linked from the beginning of the chain to the latest block, hence the name blockchain. A blockchain can serve as a single source of truth, and members of a blockchain network can only view transactions relevant to them.
[0045] Figure 1 A schematic diagram of the blockchain system composition in this embodiment is shown. The blockchain system 100 may include at least one client 110 and a blockchain network 120. The blockchain network 120 includes at least one blockchain node 121. The client 110 may be various electronic devices such as smartphones, tablets, laptops, desktop computers, smart wearable devices, smart in-vehicle devices, smart payment terminals, and facial recognition terminals. By installing the corresponding client application, it can provide blockchain data services to users. The blockchain node 121 may be a terminal device or a server. For example, the blockchain node 121 may be an independent physical server, a server cluster composed of multiple physical servers, or a cloud server providing cloud computing services.
[0046] In blockchain network 120, each blockchain node 121 receives input information during normal operation and maintains shared data within the blockchain network based on the received input information. To ensure information interoperability, information connections can exist between the various blockchain nodes 121, allowing them to transmit information to each other. For example, when any blockchain node 121 in blockchain network 120 receives input information and broadcasts it within the blockchain network 120, other node devices in blockchain network 120 can obtain the input information according to a consensus algorithm and store it as shared data.
[0047] Each blockchain node 121 in the blockchain network 120 has a corresponding node identifier. Each blockchain node 121 can also store the node identifiers of other blockchain nodes in the same blockchain network, so that the generated block can be broadcast to other nodes in the blockchain network 120 based on their node identifiers. Each blockchain node 121 can maintain a node identifier list as shown in Table 1, storing the node name and node identifier in this list. The node identifier can be an IP (Internet Protocol) address or any other information that can be used to identify the node. Table 1 shows a node identifier list using IP addresses as an example.
[0048] Table 1
[0049]
[0050] Figure 2 This illustrates the structural composition of a blockchain maintained on a blockchain network. For example... Figure 2 As shown, a blockchain consists of multiple sequentially linked blocks. Whenever new data needs to be written to the blockchain, this data is aggregated into a newly generated block. This newly generated block is then linked to the end of the blockchain. A consensus algorithm ensures that the blocks added on each node device 121 are identical. The block body of each block records the data of the current block, while its block header stores the hash value of the preceding block. If the transaction data in the preceding block changes, the hash value of the current block will also change accordingly. Therefore, data uploaded to the blockchain network is difficult to tamper with, improving the reliability of shared data.
[0051] The following detailed description of the resource allocation method, resource allocation device, computer-readable medium, and electronic device provided in this application, in conjunction with specific embodiments, provides a detailed explanation of these technical solutions.
[0052] Figure 3The network architecture of a blockchain network applying the technical solution of this application is illustrated schematically. For example... Figure 3 As shown, in application scenarios that realize online transactions and online payments, the transaction entity node 310, the transaction platform node 320, and the resource allocation node 330 located in the blockchain network jointly maintain one or more blockchains 340.
[0053] Transaction entity node 310 is a blockchain node that provides transaction services to users. For example, it can be a merchant or individual seller who conducts online transactions with users.
[0054] Transaction platform node 320 is a blockchain node that provides transaction scenarios for online transactions. For example, it can be an e-commerce website, an online mall, or various business platforms that provide online transaction services.
[0055] Resource allocation node 330 is a blockchain node that provides fund management and allocation services for network transactions, such as a third-party payment institution.
[0056] When a user conducts a network transaction with the transaction entity node 310, they can pay transaction funds to the transaction entity node 310 through an account opened on the resource allocation node 330. The transaction platform node 320, as the provider of the transaction scenario, needs to deduct a certain amount of funds from these transaction funds as a platform service fee. To achieve reliable fund allocation between the transaction entity node 310 and the transaction platform node 320, a corresponding smart contract (such as a revenue-sharing contract) can be established based on the blockchain network for fund allocation. When a network transaction occurs, the resource allocation node 330 can allocate funds to various objects in the transaction scenario according to the smart contract.
[0057] To ensure the validity and credibility of the contract, the process data and result data of the contract can be stored on the blockchain 340. Decentralized contract signing and data storage can effectively avoid trust crises.
[0058] Figure 4 The flowchart illustrating the steps of a resource allocation method in one embodiment of this application is shown schematically. This resource allocation method can be performed by… Figure 1 The client 110 or blockchain node 121 shown executes the method. This embodiment specifically uses the resource allocation method executed by resource allocation node 330 as an example for illustration. Figure 4 As shown, the resource allocation method mainly includes the following steps S410 to S430.
[0059] Step S410: Send the contract template used to agree on the resource allocation rules to the transaction platform node in the blockchain network, so that the transaction platform node can fill in the content and sign the contract template to obtain a unilaterally signed smart contract carrying the digital signature of the transaction platform node.
[0060] In a blockchain network, the resource allocation node first sends a contract template to the trading platform node. This contract template defines the resource allocation rules for allocating resources to both the trading platform node and the trading entity nodes. The contract template can be a pre-configured template on the resource allocation node based on the agreement between the trading platform node and the resource allocation node. When a contract signing request arises, the resource allocation node sends it to the trading platform node. In this embodiment, the resource allocation nodes and the trading platform nodes can be configured with the same or different contract templates.
[0061] In one embodiment of this application, the resource allocation node can transmit the contract template to the trading platform node based on the peer-to-peer data transmission address. In this embodiment, the resource allocation node can obtain the trading platform node's node address and public key. Using the trading platform node's public key, the resource allocation node can encrypt the contract template used to agree on resource allocation rules to obtain an encrypted contract template. Based on the trading platform node's node address, the encrypted contract template can be sent to the trading platform node. The trading platform node then decrypts the encrypted contract template using its private key, which matches its public key, to obtain the final contract template.
[0062] In one embodiment of this application, the resource allocation node can broadcast the contract template on the blockchain network, enabling the transaction platform node to obtain the contract template by detecting the broadcast message.
[0063] In one embodiment of this application, the resource allocation node can store the latest contract template on the blockchain. When a contract creation requirement arises, the transaction platform node can query block data from the blockchain to obtain the corresponding contract template. In this embodiment, the resource allocation node can broadcast the contract template used to agree on resource allocation rules on the blockchain network to write the contract template into the pending-on-chain blocks of various blockchain nodes on the blockchain network. When the block generation conditions are met, the pending-on-chain block carrying the contract template is broadcast on the blockchain network so that various blockchain nodes on the blockchain network can perform consensus authentication of the pending-on-chain block, and after successful authentication, the pending-on-chain block is processed. The block height of the target block where the contract template is located is sent to the transaction platform node so that the transaction platform node can query the contract template in the target block.
[0064] The contract template includes pre-agreed terms and conditions, as well as additional data to be filled in based on actual transaction needs. Once the trading platform node obtains the contract template, it can populate the remaining data to create a complete smart contract. This data may include, for example, the trading accounts and contact information of each party involved in the transaction.
[0065] After the contract template is populated with content, the trading platform node can sign it to obtain a unilaterally signed smart contract carrying the trading platform node's digital signature. A digital signature is a string of numbers that only the sender of the information can generate and that cannot be forged by others. This string of numbers serves as valid proof of the authenticity of the information sent by the sender. By signing the completed contract template, the trading platform node can ensure the validity of the smart contract's origin and content.
[0066] Step S420: Send the unilaterally signed smart contract to the transaction entity node in the blockchain network so that the transaction entity node can perform content verification and signature processing on the unilaterally signed smart contract to obtain a multi-signature smart contract carrying the digital signature of the transaction platform and the digital signature of the transaction entity.
[0067] After a one-sided signed smart contract is generated by the signing process on the trading platform node, the one-sided signed smart contract can be sent to the corresponding trading entity node. This allows the trading entity node to verify the contract content of the one-sided signed smart contract and further attach the digital signature of the trading entity node to the one-sided signed smart contract to obtain a multi-signature smart contract carrying the signatures of both parties.
[0068] In one embodiment of this application, the transaction platform node can return the unilaterally signed smart contract obtained after completing content filling and signature processing to the resource allocation node, and then the resource allocation node can send the unilaterally signed smart contract to the transaction subject node.
[0069] In one embodiment of this application, the transaction platform node can transmit a unilaterally signed smart contract to the transaction subject node according to the communication address of the peer-to-peer data transmission.
[0070] In one embodiment of this application, a transaction platform node can broadcast a unilaterally signed smart contract on the blockchain network, enabling transaction entity nodes to obtain the unilaterally signed smart contract by detecting the broadcast message.
[0071] In one embodiment of this application, the transaction platform node can store the unilaterally signed smart contract on the blockchain, so that the transaction subject node can obtain the corresponding unilaterally signed smart contract by querying the block data on the blockchain.
[0072] After obtaining a unilaterally signed smart contract, the participating nodes can verify its content to determine its accuracy. For example, they can verify whether the data filled in by the trading platform nodes conforms to the agreement between the two parties. Furthermore, before verifying the content of the unilaterally signed smart contract, the participating nodes can first verify its signature to confirm its validity and that it has not been tampered with during transmission.
[0073] Step S430: Verify the signature of the multi-signature smart contract and allocate resources to the trading platform node and the trading entity node based on the verified multi-signature smart contract.
[0074] After the resource allocation node obtains a multi-signature smart contract that has been jointly signed by the trading platform node and the trading entity node, it can verify the digital signature carried on the contract to confirm that the source of the multi-signature smart contract is valid and that it has not been tampered with during the multi-party transmission and signing process.
[0075] In one embodiment of this application, the transaction subject node can transmit a multi-signature smart contract to the resource allocation node based on the communication address of the resource allocation node through peer-to-peer data transmission.
[0076] In one embodiment of this application, the transaction subject node can broadcast the multi-signature smart contract on the blockchain network, so that the resource allocation node can obtain the multi-signature smart contract by detecting the broadcast message.
[0077] In one embodiment of this application, the transaction subject node can store the multi-signature smart contract on the blockchain, so that the resource allocation node can obtain the corresponding multi-signature smart contract by querying block data on the blockchain.
[0078] Once the resource allocation node verifies the accuracy of the multi-signature smart contract, it can allocate resources to the trading platform node and the trading entity node based on the contract's stipulations. For example, if the multi-signature smart contract specifies a certain ratio for resource allocation between the trading platform node and the trading entity node, the resource allocation node can divide the resources to be allocated according to this ratio and transfer the divided resources to the corresponding trading platform node and trading entity node. Alternatively, if the multi-signature smart contract stipulates that the trading platform node charges a specified service fee for each transaction, the resource allocation node can extract a specified amount of resources from the unallocated resources and transfer it to the trading platform node, while transferring the remaining resources to the trading entity node.
[0079] In the resource allocation method provided in this application embodiment, a resource allocation node provides a contract template. The transaction platform node fills in the content and signs the contract template to obtain a unilaterally signed smart contract. Then, the transaction entity node verifies the content of the unilaterally signed smart contract and signs it to obtain a multi-signature smart contract. Finally, the resource allocation node verifies the signature of the multi-signature smart contract and uses the verified multi-signature smart contract to allocate resources to the transaction platform node and the transaction entity node. This resource allocation method can improve the reliability and credibility of online transactions and avoid the trust crisis caused by relying on a single object.
[0080] In one embodiment of this application, after the resource allocation node completes the verification of the multi-signature smart contract, it can save the verification result of the contract and the process data of the contract signing on the blockchain. Figure 5 The flowchart illustrating the steps of saving contract formation data on-chain in one embodiment of this application is shown schematically. Figure 5 As shown, the method for storing contract signing data on the blockchain may include the following steps S510 to S540.
[0081] Step S510: Broadcast the verification result of the multi-signature smart contract on the blockchain network to save the verification result of the multi-signature smart contract to the contract buffer pool of the blockchain node.
[0082] Each blockchain node in a blockchain network can maintain its own contract buffer pool to store data related to the contract formation process that is broadcast on the blockchain network and is awaiting to be uploaded to the chain. After a resource allocation node completes the verification of a multi-signature smart contract, it can save the verification result in its own maintained contract buffer pool and broadcast the verification result on the blockchain network. When other blockchain nodes receive the broadcast message, they can also save the verification result in their own maintained contract buffer pools, waiting to be uploaded to the chain.
[0083] Step S520: Locate the process data related to the creation process of the multi-signature smart contract in the contract buffer pool.
[0084] The creation of a multi-signature smart contract generates corresponding process data. This process data may include, for example, the original contract template, the unilaterally signed smart contract obtained after being filled and signed by the transaction platform nodes, and request and response messages generated during contract transmission between resource allocation nodes, transaction platform nodes, and transaction subject nodes. During the creation process, each blockchain node stores the process data broadcast on the blockchain network in a contract buffer pool. After the verification result of the multi-signature smart contract is saved to the contract buffer pool, the process data corresponding to that multi-signature smart contract can be found in the contract buffer pool.
[0085] In one embodiment of this application, a unique contract identifier (e.g., contract number) can be assigned to a contract establishment request, and all process data generated during the contract establishment process will carry this contract identifier. In the contract buffer pool, process data associated with a multi-signature smart contract can be identified by querying for the same contract identifier.
[0086] Step S530: After associating the verification result of the multi-signature smart contract with the process data, write it into the block to be added to the chain.
[0087] Based on the query results in the contract buffer pool, the verification results of the multi-signature smart contract and its related process data can be correlated, and the correlated data can be written into the block to be added to the blockchain. After the data is written into the block to be added to the blockchain, it can be removed from the contract buffer pool. Data that has not been written into the block to be added to the blockchain will continue to be stored in the contract buffer pool, waiting for a suitable time to be added to the blockchain.
[0088] In one embodiment of this application, the buffer duration of each process data in the contract buffer pool can be obtained; if the buffer duration of the process data exceeds a duration threshold, the process data is written into the block to be added to the chain. To avoid the contract establishment time span being too long due to network latency or data loss, this embodiment of the application can record the buffer duration of each process data in the contract buffer pool. When the buffer duration exceeds the set duration threshold, even if the verification result of the corresponding multi-signature smart contract is not obtained, the process data can be directly written into the block to be added to the chain so that it can be added to the chain when a new block is generated.
[0089] Step S540: When the block generation conditions are met, broadcast the block to be added to the blockchain network so that the blockchain nodes on the blockchain network can perform consensus authentication of the block to be added to the blockchain, and after the authentication is passed, process the block to be added to the blockchain.
[0090] Block generation conditions can include time-based conditions or data volume conditions. Time-based conditions mean that a block is generated at set intervals. When the set interval has elapsed since the previous block was generated, the block to be added to the chain is broadcast, and a new block is generated based on the consensus authentication result. Data volume conditions mean that each block contains a fixed amount of block data. When the data in the block to be added to the chain reaches a specified amount, it is broadcast, and a new block is generated based on the consensus authentication result.
[0091] The following section provides a detailed explanation of each method step of the resource allocation method in the embodiments of this application, taking into account specific application scenarios.
[0092] Figure 6 The diagram illustrates an interactive flowchart of generating a unilaterally signed smart contract based on a contract template in one embodiment of this application. Figure 6 As shown, the method for generating a unilaterally signed smart contract based on data interaction between the resource allocation node and the transaction platform node includes the following steps S601 to S608.
[0093] Step S601: The transaction platform node broadcasts the contract signing request on the blockchain network.
[0094] When a transaction request is generated on the trading platform, a contract signing request can be generated through the trading platform node and broadcast on the blockchain network, so that other blockchain nodes in the blockchain network can receive and save the contract signing request.
[0095] Step S602: The resource allocation node detects the contract signing request transmitted on the blockchain network.
[0096] Resource allocation nodes can detect broadcast messages transmitted on the blockchain network and identify the message type of each broadcast message to determine whether the broadcast message is a contract signing request or other message.
[0097] Step S603: Parse the contract establishment request to obtain the message transmission source and message transmission target of the contract establishment request.
[0098] When a trading platform node sends a contract establishment request via broadcast message, it can encapsulate the message transmission source and destination within the broadcast message. When a resource allocation node detects the contract establishment request, it can parse and process the request to obtain the message transmission source and destination information.
[0099] Step S604: If the message transmission source is the trading platform node and the message transmission target is the resource allocation node, then the contract template used to agree on the resource allocation rules will be sent to the trading platform node.
[0100] Once it is determined that the message transmission source for the contract establishment request is the trading platform node and the message transmission destination is the resource allocation node, the resource allocation node can respond to the trading platform node's request by sending the contract template used to stipulate the resource allocation rules to the trading platform node. If the message transmission source is not the trading platform node or the message transmission destination is not the resource allocation node, it indicates that the contract establishment request is not a valid request. The resource allocation node can either abandon responding to it or broadcast a message on the blockchain network indicating that the source of the contract establishment request is incorrect.
[0101] In one embodiment of this application, the resource allocation node can obtain the node address of the trading platform node and transmit data to the trading platform node in a peer-to-peer manner based on the node address of the trading platform node, thereby directly sending the contract template to the trading platform node.
[0102] In one embodiment of this application, the resource allocation node can also encapsulate the contract template used to agree on resource allocation rules according to the node address of the trading platform node, and obtain a contract establishment message with the trading platform node as the message transmission target. The contract establishment message is used to instruct the trading platform node to establish a smart contract corresponding to the contract template. Then, the contract establishment message is broadcast on the blockchain network to send the contract template carried by the contract establishment message to the trading platform node.
[0103] In one embodiment of this application, a transaction platform node can detect broadcast messages transmitted on the blockchain network to obtain a contract template issued by a resource allocation node.
[0104] Step S605: The trading platform node performs field recognition on the contract template to obtain the fields to be filled in the contract template.
[0105] The fields to be filled include at least one of the following: contract trigger condition, resource allocation quantity threshold, or resource allocation ratio threshold. The contract trigger condition is used to determine the trigger conditions for executing the smart contract; the resource allocation quantity threshold is used to determine the range of resource quantity to be allocated to the trading platform node or trading entity node; and the resource allocation ratio threshold is used to determine the range of resource allocation ratio to be allocated to the trading platform node or trading entity node.
[0106] Step S606: Obtain the resource allocation parameters agreed upon by the trading platform node and the trading entity node, and perform a matching check between the resource allocation parameters and the fields to be filled.
[0107] When merchants join an online trading platform, they can agree on resource allocation parameters. For example, they can agree that the online trading platform will charge a service fee based on a certain quantity or percentage, or they can agree on the timing and conditions for paying the service fee to the online trading platform.
[0108] By matching the obtained resource allocation parameters with the fields to be filled in the contract template, the matching relationship between each parameter and each field can be determined, thereby determining how to fill the parameters in the contract template.
[0109] Step S607: When the resource allocation parameter matches the field to be filled successfully, write the resource allocation parameter into the field to be filled.
[0110] The trading platform node can match each resource allocation parameter with each field to be filled. When a resource allocation parameter matches any field to be filled, the resource allocation parameter can be written into the corresponding field to be filled.
[0111] Step S608: Sign the contract template filled with resource allocation parameters to obtain a unilaterally signed smart contract carrying the digital signature of the trading platform node.
[0112] In one embodiment of this application, the method for a trading platform node to sign a contract template filled with resource allocation parameters may include: extracting a digest from the contract template filled with resource allocation parameters using a hash algorithm to obtain a contract digest; encrypting the contract digest using the trading platform node's private key to obtain the trading platform node's digital signature; and attaching the trading platform node's digital signature to the contract template to obtain a unilaterally signed smart contract carrying the trading platform node's digital signature.
[0113] Figure 7 The diagram illustrates an interactive flowchart of generating a multi-signature smart contract based on a single-signature smart contract in one embodiment of this application. Figure 7 As shown, the method for generating multi-signature smart contracts based on data interaction between trading platform nodes and trading entity nodes includes the following steps S701 to S707.
[0114] Step S701: The transaction platform node obtains the node address of the transaction entity node in the blockchain network.
[0115] Step S702: Based on the node address of the transaction subject node, encapsulate the unilateral signature smart contract to obtain a contract signature message with the transaction subject node as the message transmission target. The contract signature message is used to instruct the transaction subject node to sign the unilateral signature smart contract.
[0116] Step S703: Broadcast the contract signing message on the blockchain network to send the unilaterally signed smart contract carried by the contract signing message to the transaction entity node.
[0117] Step S704: The transaction entity node performs field recognition on the unilaterally signed smart contract to obtain the filled fields in the contract template.
[0118] Step S705: Obtain the resource allocation parameters agreed upon by the trading platform node and the trading entity node, and perform a matching check between the resource allocation parameters and the already filled fields.
[0119] Step S706: When the resource allocation parameters match the populated fields successfully, perform a consistency check on the field content of the resource allocation parameters and the populated fields.
[0120] Step S707: When the consistency verification result is that the verification is successful, the single-signature smart contract is signed to obtain a multi-signature smart contract carrying the digital signature of the trading platform node and the digital signature of the trading entity node.
[0121] In one embodiment of this application, the method for a transaction entity node to sign a unilaterally signed smart contract may include: separating the signature of the unilaterally signed smart contract to obtain the contract content and the digital signature of the transaction platform attached to the contract content; extracting a digest from the contract content using a hash algorithm to obtain a contract digest; encrypting the contract digest using the private key of the transaction entity node to obtain the digital signature of the transaction entity node; and attaching the digital signature of the transaction platform node and the digital signature of the transaction entity node to the contract content to obtain a multi-signature smart contract carrying the digital signatures of the transaction platform node and the transaction entity node.
[0122] Figure 8 The diagram illustrates an interaction flowchart of resource allocation based on a multi-signature smart contract in one embodiment of this application. Figure 8 As shown, the method for completing resource allocation based on data interaction between the trading platform node, the trading entity node, and the resource allocation node includes the following steps S801 to S808.
[0123] Step S801: The transaction entity node obtains the node address of the resource allocation node in the blockchain network.
[0124] Step S802: Based on the node address of the resource allocation node, encapsulate the multi-signature smart contract to obtain a contract binding message with the resource allocation node as the message transmission target. The contract binding message is used to instruct the resource allocation node to perform binding processing on the multi-signature smart contract.
[0125] Step S803: Broadcast the contract binding message on the blockchain network to send the multi-signature smart contract carried by the contract binding message to the resource allocation node.
[0126] Step S804: The resource allocation node performs signature verification and content accuracy verification on the multi-signature smart contract.
[0127] The resource allocation node performs signature separation on the multi-signature smart contract, obtaining the contract content along with the digital signatures of the trading platform node and the trading entity node attached to the contract content. A hash algorithm is used to extract a digest from the contract content, yielding the contract digest. The digital signature of the trading platform node is decrypted using its public key, resulting in the first digest plaintext to be verified. The digital signature of the trading entity node is then decrypted using its public key, yielding the second digest plaintext to be verified. A consistency check is performed on the contract digest, the first digest plaintext, and the second digest plaintext. If the check passes, the accuracy of the contract content is verified.
[0128] Step S805: The transaction platform node broadcasts a resource allocation instruction on the blockchain network according to the transaction requirements. The resource allocation instruction is used to instruct the resource allocation node to allocate resources.
[0129] Step S806: The resource allocation node invokes the multi-signature smart contract according to the resource allocation instruction.
[0130] The resource allocation node detects resource allocation instructions transmitted on the blockchain network; it parses the instructions to determine the message source and destination. If the message source is a transaction platform node and the destination is the resource allocation node, it invokes the verified multi-signature smart contract bound to both the transaction platform node and the transaction entity node.
[0131] Step S807: Allocate resources to the trading platform node based on the invocation result of the multi-signature smart contract.
[0132] Step S808: Allocate resources to the transaction entity node based on the invocation result of the multi-signature smart contract.
[0133] Figure 9 The diagram illustrates an interaction flowchart of an embodiment of this application in a network transaction application scenario. Figure 9 As shown, in this application scenario, the transaction platform node is an e-commerce platform, the transaction entity node is the merchant registered on the e-commerce platform, and the resource allocation node is a third-party payment institution that provides fund management and online payment services for the e-commerce platform and merchants. The method for allocating funds between the e-commerce platform and merchants based on this application scenario can include the following steps S901 to S908.
[0134] Step S901: The e-commerce platform obtains the revenue sharing contract template provided by the third-party payment institution, fills in the contract data items, and signs it with the e-commerce platform's private key to form a revenue sharing contract carrying a unilateral signature.
[0135] Step S902: The e-commerce platform broadcasts the revenue sharing contract on the blockchain network, specifying that the recipient is a merchant registered on the e-commerce platform.
[0136] Step S903: The merchant receives the blockchain-cleared revenue sharing contract.
[0137] Step S904: The merchant verifies the platform signature in the revenue sharing agreement and checks whether the contract data items meet the agreement between the two parties. If they do, proceed to step S905.
[0138] Step S905: The merchant signs the revenue sharing contract data items with the merchant's private key and attaches them to the revenue sharing contract to obtain a revenue sharing contract with multiple signatures.
[0139] Step S906: The merchant broadcasts the revenue sharing contract on the blockchain network, specifying that the recipient is a third-party payment institution.
[0140] Step S907: The third-party payment institution receives the blockchain-cleared settlement contract data.
[0141] Step S908: The third-party payment institution verifies the platform signature and seller signature in the revenue sharing contract. After verifying the signatures, it further verifies the accuracy of the contract data items. After verifying the data items, it binds the revenue sharing contract to the seller. Subsequently, when receiving revenue sharing instructions from the e-commerce platform, the institution verifies the legality of the platform's revenue sharing instructions based on this revenue sharing contract.
[0142] This application scenario utilizes blockchain technology to transmit revenue-sharing contracts, requiring both the e-commerce platform and the merchant to sign the revenue-sharing data items. This ensures that subsequent revenue-sharing instructions issued by the e-commerce platform to the third-party payment institution comply with the agreement reached between the e-commerce platform and the merchant. This prevents the misappropriation or misuse of funds owed to merchants due to errors or anomalies on the e-commerce platform.
[0143] It should be noted that although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0144] The following describes an apparatus embodiment of this application, which can be used to execute the resource allocation method in the above embodiments of this application. Figure 10 A schematic block diagram of the resource allocation apparatus provided in an embodiment of this application is shown. Figure 10As shown, the resource allocation device 1000 includes: a first signature module 1010, configured to send a contract template for agreeing on resource allocation rules to a transaction platform node in the blockchain network, so that the transaction platform node fills in the content and signs the contract template to obtain a unilaterally signed smart contract carrying the digital signature of the transaction platform node; a second signature module 1020, configured to send the unilaterally signed smart contract to a transaction entity node in the blockchain network, so that the transaction entity node verifies the content and signs the unilaterally signed smart contract to obtain a multi-signature smart contract carrying the digital signature of the transaction platform and the digital signature of the transaction entity; and an allocation module 1030, configured to verify the signature of the multi-signature smart contract and allocate resources to the transaction platform node and the transaction entity node according to the verified multi-signature smart contract.
[0145] In some embodiments of this application, based on the above embodiments, the allocation module 1030 includes: a first signature separation module, configured to perform signature separation on the multi-signature smart contract to obtain contract content and the digital signature of the transaction platform node and the digital signature of the transaction subject node attached to the contract content; a first digest extraction module, configured to extract a digest from the contract content using a hash algorithm to obtain a contract digest; a first signature decryption module, configured to decrypt the digital signature of the transaction platform node according to the public key of the transaction platform node to obtain a first digest plaintext to be verified; a second signature decryption module, configured to decrypt the digital signature of the transaction subject node according to the public key of the transaction subject node to obtain a second digest plaintext to be verified; and a digest verification module, configured to perform consistency verification on the contract digest, the first digest plaintext, and the second digest plaintext.
[0146] In some embodiments of this application, based on the above embodiments, the allocation module 1030 further includes: a first detection module configured to detect resource allocation instructions transmitted on the blockchain network; a first parsing module configured to parse the resource allocation instructions to obtain the message transmission source and message transmission target of the resource allocation instructions; a contract invocation module configured to invoke a verified multi-signature smart contract bound to the trading platform node and the trading entity node if the message transmission source is the trading platform node and the message transmission target is the resource allocation node; and a resource allocation module configured to allocate resources to the trading platform node and the trading entity node according to the invocation result of the multi-signature smart contract.
[0147] In some embodiments of this application, based on the above embodiments, the first signature module 1010 includes: a second detection module configured to detect contract signing requests transmitted on the blockchain network; a second parsing module configured to parse the contract signing request to obtain the message transmission source and message transmission target of the contract signing request; and a contract sending module configured to send a contract template for agreeing on resource allocation rules to the trading platform node if the message transmission source is a trading platform node and the message transmission target is a resource allocation node.
[0148] In some embodiments of this application, based on the above embodiments, the contract sending module includes: a first address acquisition module, configured to acquire the node address of the trading platform node; a first message encapsulation module, configured to encapsulate a contract template for agreeing on resource allocation rules according to the node address of the trading platform node, to obtain a contract establishment message with the trading platform node as the message transmission target, the contract establishment message being used to instruct the trading platform node to establish a smart contract corresponding to the contract template; and a first message broadcasting module, configured to broadcast the contract establishment message on the blockchain network to send the contract template carried by the contract establishment message to the trading platform node.
[0149] In some embodiments of this application, based on the above embodiments, the contract sending module includes: a template broadcasting module, configured to broadcast a contract template for agreeing on resource allocation rules on a blockchain network, so as to write the contract template into the blocks to be added to the blockchain on each blockchain node on the blockchain network; a template authentication module, configured to broadcast a block to be added to the blockchain network carrying the contract template when the block generation conditions are met, so that each blockchain node on the blockchain network can perform consensus authentication on the block to be added to the blockchain, and perform on-chain processing on the block to be added to the blockchain after the authentication is passed; and a height sending module, configured to send the block height of the target block where the contract template is located to the trading platform node, so that the trading platform node can query the contract template in the target block.
[0150] In some embodiments of this application, based on the above embodiments, the contract sending module includes: an address and public key acquisition module, configured to acquire the node address and node public key of the trading platform node; a template encryption module, configured to encrypt a contract template used to agree on resource allocation rules according to the node public key to obtain an encrypted contract template; and an encryption sending module, configured to send the encrypted contract template to the trading platform node according to the node address, so that the trading platform node decrypts the encrypted contract template using a node private key that matches the node public key to obtain the contract template.
[0151] In some embodiments of this application, based on the above embodiments, the resource allocation device 1000 further includes: a result broadcasting module, configured to broadcast the verification result of the multi-signature smart contract on the blockchain network to save the verification result of the multi-signature smart contract to the contract buffer pool of the blockchain node; a data lookup module, configured to look up process data related to the establishment process of the multi-signature smart contract in the contract buffer pool; a first writing module, configured to associate the verification result of the multi-signature smart contract with the process data and then write it into the block to be added to the chain; and a block broadcasting module, configured to broadcast the block to be added to the chain on the blockchain network when the block generation conditions are met, so that the blockchain nodes on the blockchain network can perform consensus authentication on the block to be added to the chain, and after the authentication is passed, perform the on-chain processing on the block to be added to the chain.
[0152] In some embodiments of this application, based on the above embodiments, the resource allocation device further includes: a duration acquisition module, configured to acquire the buffer duration of each process data in the contract buffer pool; and a second writing module, configured to write the process data into the block to be added to the chain if the buffer duration of the process data is greater than the duration threshold.
[0153] In some embodiments of this application, based on the above embodiments, the first signature module 1010 further includes: a first field recognition module, configured to perform field recognition on the contract template to obtain the field to be filled in the contract template; a first field matching module, configured to obtain the resource allocation parameters agreed upon by the trading platform node and the trading entity node, and perform matching detection between the resource allocation parameters and the field to be filled; a parameter writing module, configured to write the resource allocation parameters into the field to be filled when the resource allocation parameters are successfully matched with the field to be filled; and a unilateral signature module, configured to perform signature processing on the contract template filled with resource allocation parameters to obtain a unilaterally signed smart contract carrying the digital signature of the trading platform node.
[0154] In some embodiments of this application, based on the above embodiments, the unilateral signature module includes: a second digest extraction module, configured to extract a digest from a contract template filled with resource allocation parameters using a hash algorithm to obtain a contract digest; a first digest encryption module, configured to encrypt the contract digest according to the private key of the trading platform node to obtain the digital signature of the trading platform node; and a unilateral signature appending module, configured to append the digital signature of the trading platform node to the contract template to obtain a unilaterally signed smart contract carrying the digital signature of the trading platform node.
[0155] In some embodiments of this application, based on the above embodiments, the second signature module 1020 includes: a second address acquisition module, configured to acquire the node address of the transaction subject node in the blockchain network; a second message encapsulation module, configured to encapsulate the unilateral signature smart contract according to the node address of the transaction subject node, to obtain a contract signature message with the transaction subject node as the message transmission target, the contract signature message being used to instruct the transaction subject node to perform signature processing on the unilateral signature smart contract; and a second message broadcasting module, configured to broadcast the contract signature message on the blockchain network to send the unilateral signature smart contract carried by the contract signature message to the transaction subject node.
[0156] In some embodiments of this application, based on the above embodiments, the second signature module 1020 further includes: a second field identification module, configured to identify fields in the unilateral signature smart contract to obtain the filled fields in the contract template; a second field matching module, configured to obtain the resource allocation parameters agreed upon by the trading platform node and the trading entity node, and perform matching detection between the resource allocation parameters and the filled fields; a parameter verification module, configured to perform consistency verification on the field content of the resource allocation parameters and the filled fields when the resource allocation parameters and the filled fields are successfully matched; and a multi-signature module, configured to perform signature processing on the unilateral signature smart contract when the consistency verification result is a pass, to obtain a multi-signature smart contract carrying the digital signature of the trading platform and the digital signature of the trading entity.
[0157] In some embodiments of this application, based on the above embodiments, the multi-signature module includes: a second signature separation module, configured to separate the signature of the single-signature smart contract to obtain contract content and the digital signature of the trading platform attached to the contract content; a third digest extraction module, configured to extract a digest from the contract content using a hash algorithm to obtain a contract digest; a second digest encryption module, configured to encrypt the contract digest according to the private key of the trading entity node to obtain the digital signature of the trading entity node; and a multi-signature attachment module, configured to attach the digital signature of the trading platform node and the digital signature of the trading entity node to the contract content to obtain a multi-signature smart contract carrying the digital signature of the trading platform node and the digital signature of the trading entity node.
[0158] The specific details of the resource allocation device provided in the various embodiments of this application have been described in detail in the corresponding method embodiments, and will not be repeated here.
[0159] Figure 11A schematic block diagram of a computer system architecture for implementing an electronic device according to embodiments of the present application is shown.
[0160] It should be noted that, Figure 11 The computer system 1100 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0161] like Figure 11 As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1102 or programs loaded from storage section 1108 into random access memory (RAM). The RAM 1103 also stores various programs and data required for system operation. The CPU 1101, ROM 1102, and RAM 1103 are interconnected via a bus 1104. An input / output interface 1105 (I / O interface) is also connected to the bus 1104.
[0162] The following components are connected to the input / output interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a local area network card, modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the input / output interface 1105 as needed. Removable media 1111, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on the drive 1110 as needed so that computer programs read from them can be installed into the storage section 1108 as needed.
[0163] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1109, and / or installed from removable medium 1111. When the computer program is executed by central processing unit 1101, it performs various functions defined in the system of this application.
[0164] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0165] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0166] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0167] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0168] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0169] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A resource allocation method, characterized in that, include: A contract template for agreeing on resource allocation rules is sent to a transaction platform node in the blockchain network, so that the transaction platform node fills in the content and signs the contract template to obtain a unilaterally signed smart contract carrying the digital signature of the transaction platform node. The unilateral signature smart contract is sent to the transaction entity node in the blockchain network, so that the transaction entity node performs content verification and signature processing on the unilateral signature smart contract to obtain a multi-signature smart contract carrying the digital signature of the transaction platform and the digital signature of the transaction entity. The multi-signature smart contract is verified, and resources are allocated to the transaction platform node and the transaction entity node based on the verified multi-signature smart contract. The verification result of the multi-signature smart contract is broadcast on the blockchain network to save the verification result of the multi-signature smart contract to the contract buffer pool of the blockchain node. Search the contract buffer pool for process data related to the creation process of the multi-signature smart contract; The verification result of the multi-signature smart contract is associated with the process data and then written into the block to be added to the chain. When the block generation conditions are met, the block to be added to the blockchain is broadcast on the blockchain network so that the blockchain nodes on the blockchain network can perform consensus authentication on the block to be added to the blockchain, and after the authentication is passed, the block to be added to the blockchain is processed.
2. The resource allocation method according to claim 1, characterized in that, Signature verification of the multi-signature smart contract includes: The signature of the multi-signature smart contract is separated to obtain the contract content and the digital signature of the transaction platform node and the digital signature of the transaction subject node attached to the contract content. The contract summary is obtained by extracting a digest from the contract content using a hash algorithm. The digital signature of the trading platform node is decrypted using the public key of the trading platform node to obtain the first digest plaintext to be verified. The digital signature of the transaction entity node is decrypted using the public key of the transaction entity node to obtain the plaintext of the second digest to be verified. A consistency check is performed on the contract digest, the first digest plaintext, and the second digest plaintext.
3. The resource allocation method according to claim 1, characterized in that, Resources are allocated to the transaction platform node and the transaction entity node according to the verified multi-signature smart contract, including: Detect resource allocation instructions transmitted on the blockchain network; Parse the resource allocation instruction to obtain the message transmission source and message transmission destination of the resource allocation instruction; If the message transmission source is the transaction platform node and the message transmission target is the resource allocation node, then the verified multi-signature smart contract bound to the transaction platform node and the transaction subject node is invoked. Resources are allocated to the transaction platform node and the transaction entity node based on the invocation result of the multi-signature smart contract.
4. The resource allocation method according to claim 1, characterized in that, Send the contract template used to agree on resource allocation rules to the transaction platform nodes in the blockchain network, including: Detect contract entry requests transmitted on the blockchain network; Parse the contract entry request to obtain the message transmission source and message transmission target of the contract entry request; If the message transmission source is a trading platform node and the message transmission target is a resource allocation node, then the contract template used to agree on the resource allocation rules will be sent to the trading platform node.
5. The resource allocation method according to claim 4, characterized in that, Sending the contract template used to agree on resource allocation rules to the transaction platform node includes: Obtain the node address of the transaction platform node; Based on the node address of the trading platform node, the contract template used to agree on resource allocation rules is encapsulated to obtain a contract establishment message with the trading platform node as the message transmission target. The contract establishment message is used to instruct the trading platform node to establish a smart contract corresponding to the contract template. The contract signing message is broadcast on the blockchain network to send the contract template carried in the contract signing message to the transaction platform node.
6. The resource allocation method according to claim 4, characterized in that, Sending the contract template used to agree on resource allocation rules to the transaction platform node includes: Broadcast a contract template for agreeing on resource allocation rules on the blockchain network, so that the contract template can be written into the blockchain blocks to be added to each blockchain node on the blockchain network; When the block generation conditions are met, a block to be added to the blockchain carrying the contract template is broadcast on the blockchain network so that each blockchain node on the blockchain network can perform consensus authentication on the block to be added to the blockchain, and after the authentication is passed, the block to be added to the blockchain is processed. The block height of the target block containing the contract template is sent to the trading platform node so that the trading platform node can query the contract template in the target block.
7. The resource allocation method according to claim 4, characterized in that, Sending the contract template used to agree on resource allocation rules to the transaction platform node includes: Obtain the node address and public key of the transaction platform node; The encrypted contract template is obtained by encrypting the contract template used to agree on resource allocation rules based on the node's public key; Based on the node address, the encrypted contract template is sent to the trading platform node, so that the trading platform node can decrypt the encrypted contract template using a node private key that matches the node's public key to obtain the contract template.
8. The resource allocation method according to claim 1, characterized in that, Before broadcasting the block to be added to the blockchain network, the method further includes: Obtain the buffer duration of each process data in the contract buffer pool; If the buffer duration of the process data exceeds the duration threshold, the process data is written into the block to be added to the chain.
9. The resource allocation method according to any one of claims 1 to 8, characterized in that, The contract template is populated with content and signed, including: The contract template is subjected to field recognition to obtain the fields to be filled in the contract template. Obtain the resource allocation parameters agreed upon by the transaction platform node and the transaction entity node, and perform a matching detection between the resource allocation parameters and the field to be filled; When the resource allocation parameter matches the field to be filled, the resource allocation parameter is written into the field to be filled. The contract template filled with resource allocation parameters is signed to obtain a unilaterally signed smart contract carrying the digital signature of the transaction platform node.
10. The resource allocation method according to claim 9, characterized in that, Signing the contract template populated with resource allocation parameters includes: The contract digest is obtained by extracting the digest of the contract template filled with resource allocation parameters using a hash algorithm; The contract digest is encrypted using the private key of the trading platform node to obtain the digital signature of the trading platform node. The digital signature of the trading platform node is attached to the contract template to obtain a unilaterally signed smart contract carrying the digital signature of the trading platform node.
11. The resource allocation method according to any one of claims 1 to 8, characterized in that, Sending the unilaterally signed smart contract to the transaction entity nodes in the blockchain network includes: Obtain the node address of the transaction entity node in the blockchain network; Based on the node address of the transaction entity node, the unilateral signature smart contract is encapsulated to obtain a contract signature message with the transaction entity node as the message transmission target. The contract signature message is used to instruct the transaction entity node to perform signature processing on the unilateral signature smart contract. The contract signature message is broadcast on the blockchain network to send the unilaterally signed smart contract carried by the contract signature message to the transaction entity node.
12. The resource allocation method according to any one of claims 1 to 8, characterized in that, The content verification and signature processing of the unilaterally signed smart contract includes: Perform field recognition on the unilaterally signed smart contract to obtain the filled fields in the contract template; Obtain the resource allocation parameters agreed upon by the transaction platform node and the transaction entity node, and perform a matching detection between the resource allocation parameters and the filled fields; When the resource allocation parameter matches the filled field successfully, a consistency check is performed on the field content of the resource allocation parameter and the filled field. When the consistency verification result is successful, the single-signature smart contract is signed to obtain a multi-signature smart contract carrying the digital signature of the trading platform and the digital signature of the trading entity.
13. The resource allocation method according to claim 12, characterized in that, The signing process for the unilaterally signed smart contract includes: The signature of the unilaterally signed smart contract is separated to obtain the contract content and the digital signature of the trading platform attached to the contract content. The contract summary is obtained by extracting a digest from the contract content using a hash algorithm. The contract digest is encrypted using the private key of the transaction entity node to obtain the digital signature of the transaction entity node. The digital signatures of the trading platform node and the trading entity node are attached to the contract content to obtain a multi-signature smart contract carrying the digital signatures of the trading platform node and the trading entity node.
14. A resource allocation device, characterized in that, include: The first signature module is configured to send a contract template for agreeing on resource allocation rules to a transaction platform node in the blockchain network, so that the transaction platform node fills in the content and signs the contract template to obtain a unilaterally signed smart contract carrying the digital signature of the transaction platform node. The second signature module is configured to send the unilateral signature smart contract to the transaction entity node in the blockchain network, so that the transaction entity node performs content verification and signature processing on the unilateral signature smart contract to obtain a multi-signature smart contract carrying the digital signature of the transaction platform and the digital signature of the transaction entity. The allocation module is configured to perform signature verification on the multi-signature smart contract and allocate resources to the transaction platform node and the transaction entity node based on the verified multi-signature smart contract. The verification result of the multi-signature smart contract is broadcast on the blockchain network to save the verification result of the multi-signature smart contract to the contract buffer pool of the blockchain node. Search the contract buffer pool for process data related to the creation process of the multi-signature smart contract; The verification result of the multi-signature smart contract is associated with the process data and then written into the block to be added to the blockchain. When the block generation conditions are met, the block to be added to the blockchain is broadcast on the blockchain network so that the blockchain nodes on the blockchain network can perform consensus authentication on the block to be added to the blockchain and, after successful authentication, the block to be added to the blockchain is added to the blockchain.
15. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the resource allocation method according to any one of claims 1 to 13.
16. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the resource allocation method of any one of claims 1 to 13 by executing the executable instructions.
17. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium; the processor of the computer device reads from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the resource allocation method as described in any one of claims 1 to 13.