Virtual resource processing method and device based on block chain, equipment and storage medium

A blockchain-based method for red envelope processing through smart contracts addresses security and transparency issues in centralized systems, enhancing trust and reducing disputes by using decentralized virtual resource contracts.

CN119168639APending Publication Date: 2024-12-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310707739.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-14
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

Existing red envelope systems relying on centralized servers face security risks, lack transparency, and require trust in third-party providers, leading to potential fund theft and disputes.

Method used

Implementing a blockchain-based virtual resource processing method using smart contracts to register and execute virtual resource contracts through a smart contract virtual machine, ensuring transparency, security, and reducing trust reliance on centralized entities.

Benefits of technology

Enhances trust, security, and real-time performance in virtual resource processing, ensuring transparency and reducing disputes by utilizing smart contracts on a decentralized blockchain network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119168639A_ABST
    Figure CN119168639A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a virtual resource processing method and device based on a block chain, equipment and a storage medium, and is at least applied to the field of block chains. The method comprises the steps that a smart contract virtual machine registers a virtual resource contract in a block chain network based on virtual resource parameters sent by a server, and generates a contract address for uniquely identifying the virtual resource contract; sending the contract address to a server; when the server receives a virtual resource response request sent by a receiving terminal corresponding to the virtual resource processing request, receiving a contract execution request sent by the server based on the contract address; and in response to the contract execution request, executing the virtual resource contract to obtain a contract execution result, and sending the contract execution result to the server. According to the method and the device, the credibility, the security and the real-time performance in the virtual resource processing process can be improved, the transparency of the virtual resource processing process is ensured, and the dispute of virtual resource configuration is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of blockchain technology, and are related to but not limited to a blockchain-based virtual resource processing method, device, equipment and storage medium. Background Art

[0002] The use of red envelopes in social networks not only facilitates users' work and life, but also greatly enhances the stickiness and interaction between users, making the communication between users increasingly close.

[0003] In the related art, when processing electronic red envelopes, the traditional centralized system is usually used to implement the red envelope function. This method relies on centralized servers and databases to process and store red envelope data. Although the red envelope technical solutions in the related art have certain convenience and popularity, due to their reliance on centralized service providers and platforms, there are risks in trust, security and privacy, and they may face security risks such as fund theft and platform failures; in addition, the sending, receiving and returning process of the red envelope solution is not transparent enough, which is easy to cause disputes. Summary of the invention

[0004] The embodiments of the present application provide a blockchain-based virtual resource processing method, device, equipment and storage medium, which can at least be applied to the blockchain field, and realize the processing of virtual resources through smart contract technology, thereby improving the trust, security and real-time performance of the virtual resource processing process, ensuring the transparency of the virtual resource processing process, and avoiding disputes over virtual resource configuration.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] An embodiment of the present application provides a blockchain-based virtual resource processing method, which is applied to a smart contract virtual machine, wherein the smart contract virtual machine is a data communication bridge between a server and a blockchain network, and an operating environment is provided by the smart contract virtual machine. The smart contract virtual machine implements registration of the virtual resource contract in the blockchain network under the operating environment; the method comprises: receiving a virtual resource parameter sent by a server, wherein the virtual resource parameter is data carried in a virtual resource processing request sent by an initiating terminal to the server; based on the virtual resource parameter, registering a virtual resource contract in the blockchain network, and generating a contract address for uniquely identifying the virtual resource contract; sending the contract address of the virtual resource contract to the server; when the server receives a virtual resource response request sent by a receiving terminal corresponding to the virtual resource processing request, receiving a contract execution request sent by the server based on the contract address; in response to the contract execution request, executing the virtual resource contract, obtaining a contract execution result, and sending the contract execution result to the server.

[0007] An embodiment of the present application provides a blockchain-based virtual resource processing method, which is applied to a server, and the method includes: receiving a virtual resource processing request sent by an initiating terminal; the virtual resource processing request includes virtual resource parameters; in response to the virtual resource processing request, sending the virtual resource parameters to a smart contract virtual machine to register a virtual resource contract in a blockchain network through the smart contract virtual machine; receiving a contract address of the virtual resource contract returned by the smart contract virtual machine; when receiving a virtual resource response request sent by a receiving terminal corresponding to the virtual resource processing request, sending a contract execution request to the smart contract virtual machine based on the contract address to request the smart contract virtual machine to execute the virtual resource contract and obtain a contract execution result; receiving the contract execution result, and sending the contract execution result to the initiating terminal and the receiving terminal.

[0008] An embodiment of the present application provides a virtual resource processing device based on blockchain, and the device includes: a first receiving module, used to receive virtual resource parameters sent by a server, and the virtual resource parameters are data carried in a virtual resource processing request sent by an initiating terminal to the server; a contract registration module, used to register a virtual resource contract in a blockchain network based on the virtual resource parameters, and generate a contract address for uniquely identifying the virtual resource contract; a first sending module, used to send the contract address of the virtual resource contract to the server; the first receiving module is also used to receive a contract execution request sent by the server based on the contract address when the server receives a virtual resource response request sent by a receiving terminal corresponding to the virtual resource processing request; a processing module, used to execute the virtual resource contract in response to the contract execution request, obtain a contract execution result, and send the contract execution result to the server.

[0009] In some embodiments, the contract registration module is also used to: obtain a preset contract template in the smart contract virtual machine; determine the rule type corresponding to each rule information in the virtual resource parameters; determine the setting position corresponding to each rule type in the preset contract template; write each rule information into the preset contract template according to the setting position to obtain a template virtual resource contract; register the template virtual resource contract in the blockchain network to obtain the virtual resource contract.

[0010] In some embodiments, the contract registration module is also used to: compile the template virtual resource contract to obtain bytecode data corresponding to the template virtual resource contract; the bytecode data is data that can be run on the smart contract virtual machine; broadcast the bytecode data corresponding to the template virtual resource contract to each blockchain node in the blockchain network through a peer-to-peer network, so as to register the template virtual resource contract through each blockchain node in the blockchain network to obtain the virtual resource contract.

[0011] In some embodiments, the contract registration module is also used to: verify the data accuracy of the bytecode data corresponding to the template virtual resource contract through each of the blockchain nodes to obtain an accuracy verification result; in response to the accuracy verification result of each of the blockchain nodes being a passed verification, create a new block in the blockchain network and package the bytecode data into the new block; through each blockchain node in the blockchain network, use a consensus algorithm to perform consensus processing on the new block to complete the deployment of the virtual resource contract; generate a contract address for uniquely identifying the virtual resource contract.

[0012] In some embodiments, the device also includes: a request parsing module, used to parse the virtual resource processing request to obtain the virtual resource parameters; a data legitimacy verification module, used to perform data legitimacy verification on the virtual resource parameters to obtain a legitimacy verification result; an interface acquisition module, used to obtain the virtual interface of the smart contract virtual machine in response to the legitimacy verification result being a passed verification; a second sending module, also used to send the virtual resource parameters to the smart contract virtual machine through the virtual interface.

[0013] In some embodiments, the device also includes: a storage module for storing the contract address in a database; an identification determination module for determining, from the virtual resource parameters, a terminal identification of a receiving terminal for receiving the virtual resource corresponding to the virtual resource processing request; a message generation module for generating a virtual resource message corresponding to the virtual resource, the virtual resource message including the contract address; and a third sending module for sending the virtual resource message to the receiving terminal corresponding to the terminal identification.

[0014] In some embodiments, the first receiving module is also used for: when receiving the virtual resource response request sent by the receiving terminal, performing a request legitimacy verification on the virtual resource response request to obtain a legitimacy verification result; in response to the legitimacy verification result being a passed verification, carrying the contract address in the contract execution request, and obtaining the virtual interface of the smart contract virtual machine; receiving the contract execution request sent by the server through the virtual interface.

[0015] In some embodiments, the virtual resource response request includes the contract address and the identity information of the receiving terminal; the first receiving module is also used to: when receiving the virtual resource response request sent by the receiving terminal, parse the virtual resource response request to obtain the contract address and the identity information; authenticate the identity of the receiving terminal based on the identity information to obtain an identity authentication result; verify the legitimacy of the virtual resource response request based on the contract address to obtain a request legitimacy verification result; wherein the identity authentication result and the request legitimacy verification result constitute the legitimacy verification result.

[0016] In some embodiments, the device also includes: a collection record acquisition module, which is used to obtain the collection record information of the receiving terminal in response to the contract execution result being successful collection of virtual resources; the storage module is also used to store the collection record information in a preset storage unit.

[0017] In some embodiments, the device also includes: a processing request generation module, which is used to generate an expiration processing request based on the contract address in response to not receiving a virtual resource response request sent by a receiving terminal corresponding to the virtual resource processing request within a preset time period; a request receiving module, which is used to receive the expiration processing request sent by the server; an execution module, which is used to execute the expiration processing function in the virtual resource contract corresponding to the contract address in response to the expiration processing request to obtain an expiration processing result; a third sending module, which is used to send the expiration processing result to the server, so that the server can generate expiration prompt information based on the expiration processing result, and send the expiration prompt information to the initiating terminal and the receiving terminal.

[0018] An embodiment of the present application provides an electronic device, comprising: a memory for storing executable instructions; and a processor for implementing the above-mentioned blockchain-based virtual resource processing method when executing the executable instructions stored in the memory.

[0019] An embodiment of the present application provides a computer program product, which includes executable instructions, and the executable instructions are stored in a computer-readable storage medium; wherein, when a processor of an electronic device reads the executable instructions from the computer-readable storage medium and executes the executable instructions, the above-mentioned blockchain-based virtual resource processing method is implemented.

[0020] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute the executable instructions to implement the above-mentioned blockchain-based virtual resource processing method.

[0021] The embodiment of the present application has the following beneficial effects: the smart contract virtual machine receives the virtual resource parameters sent by the server, registers the virtual resource contract in the blockchain network based on the virtual resource parameters, and generates a contract address for uniquely identifying the virtual resource contract; when the server receives the virtual resource response request sent by the receiving terminal corresponding to the virtual resource processing request, the receiving server sends a contract execution request based on the contract address; thus, in response to the contract execution request, the virtual resource contract is executed, the contract execution result is obtained, and the contract execution result is sent to the server. In this way, the processing of virtual resources is realized through smart contract technology, thereby improving the trust, security and real-time performance of the virtual resource processing process, ensuring the transparency of the virtual resource processing process, avoiding disputes over virtual resource configuration, and responding to the virtual resource response request of the receiving terminal based on the contract address, which can ensure the accuracy of virtual resource processing and reduce virtual resource processing errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 is a structural diagram of a virtual resource processing system provided in an embodiment of the present application;

[0023] Figure 2 This is an architecture diagram of the blockchain system provided by the embodiment of the present application;

[0024] Figure 3 This is an optional structural diagram of a distributed system provided in an embodiment of the present application;

[0025] Figure 4 It is an optional schematic diagram of a block structure provided in an embodiment of the present application;

[0026] Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0027] Figure 6 This is an optional flowchart of a blockchain-based virtual resource processing method provided in an embodiment of the present application;

[0028] Figure 7 It is another optional flow chart of the virtual resource processing method based on blockchain provided in the embodiment of the present application;

[0029] Figure 8 This is another optional flow chart of the blockchain-based virtual resource processing method provided in the embodiment of the present application;

[0030] Fig. 9 This is a home page interface diagram of the red envelope method of the smart contract platform technology provided in the embodiment of the present application;

[0031] Fig.10This is a red envelope sending page diagram of the red envelope method of the smart contract platform technology provided in the embodiment of the present application;

[0032] Fig.11 This is a red envelope receiving page diagram of the red envelope method of the smart contract platform technology provided in the embodiment of the present application;

[0033] Fig.12 This is a picture of my red envelope page of the red envelope method of the smart contract platform technology provided in the embodiment of the present application;

[0034] Fig.13 This is a timing diagram of the technical implementation of the smart contract red envelope solution provided in the embodiment of the present application. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0036] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meaning as those commonly understood by those skilled in the art of the technical field of the embodiments of the present application. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0037] Before explaining the blockchain-based virtual resource processing method in the embodiment of the present application, the professional terms involved in the embodiment of the present application are first explained.

[0038] (1) P2P peer-to-peer communication: Peer-to-peer communication is a communication mode in which two nodes communicate directly, sending and receiving messages to each other without going through an intermediate node or proxy. In peer-to-peer communication, the sender sends a message to the receiver, and the receiver directly receives and processes the message. Peer-to-peer communication is usually associated with a client-server architecture, in which the client node sends a request to the server node, and the server node responds to the request and sends the response result back to the client node. This communication mode is widely used in many applications, for example, a web browser sends a Hyper Text Transfer Protocol (HTTP) request to a web server, and an email client sends a Simple Mail Transfer Protocol (SMTP) request to a mail server.

[0039] Peer-to-peer communication is usually a real-time communication mode because two nodes can exchange messages directly without the help of intermediate nodes or agents. This communication mode can provide low latency and high bandwidth, so it is widely used in many real-time applications, such as real-time video and audio communication, online games, and financial trading systems.

[0040] (2) P2P broadcast: P2P broadcast refers to the broadcast method in a peer-to-peer network, that is, a node sends a data packet to all other nodes. This broadcast method is different from the traditional broadcast method based on broadcast addresses. P2P broadcast is achieved by directly sending data packets to other nodes. P2P broadcast is usually used in application scenarios such as P2P streaming media and P2P file sharing.

[0041] (3) Smart contract: It is an automated contract based on blockchain technology that can automatically execute and verify the terms of the contract without the intervention of a third party.

[0042] (4) Digital red envelope: an electronic red envelope based on mobile payment and Internet technology. It is sent by the sender to the receiver via a mobile phone or other device. The receiver obtains the red envelope amount through online collection or other methods.

[0043] The related technology uses a traditional centralized system to implement the red envelope function. This solution does not require smart contracts and blockchain networks, but relies on centralized servers and databases to process and store red envelope data. However, the related technology relies on centralized service providers and platforms, which poses risks in terms of trust, security, and privacy.

[0044] Based on this, the embodiments of the present application will solve the following problems:

[0045] (1) Security issues: The red envelope scheme in related technologies may face security risks such as fund theft and platform failure. The embodiment of the present application uses smart contracts to automatically execute the sending, receiving and returning of red envelopes, directly locking the funds in the contract, reducing security risks.

[0046] (2) Transparency issue: The sending, receiving and returning process of the red envelope scheme in the related art may not be transparent enough and easily lead to disputes. However, the embodiment of the present application based on blockchain technology can ensure that all processes are verified on the chain, thereby improving transparency.

[0047] (3) Trust issue: The electronic red envelope scheme in related technologies relies on centralized service providers and platforms, and users need to trust these third parties to ensure the security of their funds. The smart contract red envelope scheme based on blockchain technology adopts a decentralized approach and reduces the need for trust in third parties through an open and transparent code execution process.

[0048] (4) Flexibility: Through smart contracts, the initiator can customize the red envelope distribution method, collection conditions and other parameters according to needs, which increases the flexibility of the red envelope plan.

[0049] The virtual resource processing method based on blockchain provided by the embodiment of the present application comprises the following steps: the server receives the virtual resource processing request sent by the initiating terminal; the virtual resource processing request includes virtual resource parameters; the server responds to the virtual resource processing request, sends the virtual resource parameters to the smart contract virtual machine, and registers the virtual resource contract in the blockchain network through the smart contract virtual machine; then, the smart contract virtual machine returns the contract address of the virtual resource contract to the server; thereafter, when the server receives the virtual resource response request sent by the receiving terminal corresponding to the virtual resource processing request, the server sends a contract execution request to the smart contract virtual machine based on the contract address, and the smart contract virtual machine executes the virtual resource contract to obtain the contract execution result. In this way, the processing of virtual resources is realized through smart contract technology, thereby improving the trust, security and real-time performance in the virtual resource processing process, ensuring the transparency of the virtual resource processing process, and avoiding disputes over virtual resource configuration.

[0050] Before explaining the virtual resource processing method of the blockchain according to the embodiment of the present application, the virtual resource processing system provided by the embodiment of the present application is first described.

[0051] The present application embodiment provides a virtual resource processing system. Figure 1 is a schematic diagram of the structure of the virtual resource processing system provided in the embodiment of the present application, such as Figure 1 As shown, the virtual resource processing system 10 includes an initiating terminal 101, a server 102, a smart contract virtual machine 103, a blockchain network 104 and a receiving terminal 105. Among them, an instant messaging application is running on both the sending terminal 101 and the receiving terminal 105. The instant messaging application has a virtual resource processing function, and the virtual resource processing function can be, for example, a red envelope sending and receiving red envelope function. The server 103 is the background server of the instant messaging application. The server 103 can realize the red envelope sending and receiving red envelope functions in the instant messaging application, that is, the instant messaging application can realize the virtual resource processing function.

[0052] When the user runs the instant messaging application to implement the red envelope function, the user can trigger the virtual resource processing operation at the initiating terminal 100, thereby sending a virtual resource processing request to the server 102. After receiving the virtual resource processing request sent by the initiating terminal 101, the server 102 responds to the virtual resource processing request and sends the virtual resource parameters carried in the virtual resource processing request to the smart contract virtual machine 103, so as to register the virtual resource contract in the blockchain network 104 through the smart contract virtual machine 103; after completing the registration of the virtual resource contract, the smart contract virtual machine 103 returns the contract address of the virtual resource contract to the server 102. Afterwards, the user can trigger the virtual resource response operation at the receiving terminal 105, thereby sending a virtual resource response request to the server 102 through the receiving terminal 105. After receiving the virtual resource response request, the server 102 sends a contract execution request to the smart contract virtual machine 103 based on the contract address to request the smart contract virtual machine to execute the virtual resource contract and obtain the contract execution result; and feeds back the contract execution result to the server 102. The server 102 receives the contract execution result and sends the contract execution result to the initiating terminal 101 and the receiving terminal 105 respectively. Thus, the contract execution result is displayed on the current interface of the initiating terminal 101 and the receiving terminal 105.

[0053] In the embodiment of the present application, the smart contract virtual machine 103 is the operating environment of the virtual resource contract. The smart contract virtual machine is similar to an operating system, because the virtual resource contract is essentially a piece of contract code. The contract code must be run in the program, and the smart contract virtual machine provides an operating environment for the virtual resource contract. It should be noted that the smart contract virtual machine is actually a program, and the program of the smart contract virtual machine provides an operating environment. Therefore, the smart contract virtual machine is an operating environment that has been separated from the blockchain node in the blockchain network. It can be understood that the smart contract virtual machine is a data communication bridge between the server and the blockchain network, which can realize data communication between the server and the blockchain network.

[0054] In the embodiment of the present application, the blockchain network 104 is a blockchain system, which includes multiple blockchain nodes in the blockchain system. When the smart contract virtual machine registers a virtual resource contract in the blockchain network, it can obtain a preset contract template in the smart contract virtual machine; then obtain a template virtual resource contract based on the virtual resource parameters and the preset contract template; then register the template virtual resource contract in the blockchain network to obtain a virtual resource contract. Among them, when registering the template virtual resource contract through each blockchain node in the blockchain network, the bytecode data corresponding to the template virtual resource contract is verified for data accuracy by each blockchain node to obtain an accuracy verification result; then, in response to the accuracy verification result of each blockchain node being a verification pass, a new block is created in the blockchain network, and the bytecode data is packaged into the new block; through each blockchain node in the blockchain network, a consensus algorithm is used to perform consensus processing on the new block to complete the deployment of the virtual resource contract; and a contract address for uniquely identifying the virtual resource contract is generated, and thus the registration of the template virtual resource contract is completed.

[0055] Figure 2 This is an architecture diagram of the blockchain system provided by the embodiment of the present application, such as Figure 2 As shown, the blockchain system 20 consists of a data layer 13, a network layer 14, a consensus layer 15, an incentive layer 16, a contract layer 17 and an application layer 18.

[0056] The data layer 13 encapsulates the chain structure of the underlying data blocks, as well as related asymmetric public and private key data encryption technology and timestamp technology. Among them, the data layer 13 not only encapsulates the data blocks of each blockchain node, but also encapsulates the contract data blocks of the virtual resource contract, and the chain structure of the identity data blocks of the initiating terminal and the receiving terminal (the identity data block here refers to the data block formed by different types of identity data such as personal identity data, application identity data, device identity data and institutional identity data). The data layer 13 is the bottom data structure in the entire blockchain system. The network layer 14 includes distributed networking mechanisms, data dissemination mechanisms and data verification mechanisms. Since a completely P2P networking technology is adopted, it means that the blockchain has an automatic networking function. The consensus layer 15 mainly encapsulates various consensus mechanism algorithms of each node in the blockchain system. The consensus mechanism algorithm is the core technology of blockchain technology, because it determines who will do the bookkeeping, and the bookkeeper selection method will affect the security and reliability of the entire system. The incentive layer 16 integrates economic factors into the blockchain technology system, mainly including the issuance mechanism and distribution mechanism of economic incentives. The incentive mechanism is often also a game mechanism, which makes more rule-abiding nodes willing to keep accounts. The contract layer 17 mainly encapsulates various scripts, algorithms and smart contracts, and is the basis of the programmable characteristics of the blockchain. The application layer 18 encapsulates various application scenarios and cases of the blockchain. For example, various blockchain applications built on Ethereum are deployed in the application layer, and the so-called programmable currency and programmable finance will also be built in the application layer. Among them, the data layer, network layer and consensus layer are necessary factors for building blockchain applications, otherwise it cannot be called a real blockchain. The incentive layer, contract layer and application layer are not necessary factors for every blockchain application. Some blockchain applications do not fully contain these three layers.

[0057] In some embodiments, the above blockchain system may also be a distributed system 201 of the blockchain system, see Figure 3 , Figure 3 This is an optional structural diagram of a distributed system 201 provided in an embodiment of the present application, wherein the distributed system 201 may be a distributed node formed by multiple nodes 202 (any form of computing devices in the access network, such as servers, user terminals) and clients 203, and a P2P network is formed between the nodes. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP) protocol. In a distributed system, any machine such as a server or a terminal can join and become a node, and the node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0058] It should be noted that the node 202 in the distributed system 201 can be a blockchain node for registering the template virtual resource contract, or it can be another blockchain node, that is, when the node 202 is a blockchain node for registering the template virtual resource contract, the node 202 can be used to verify the data accuracy of the bytecode data corresponding to the template virtual resource contract to obtain the accuracy verification result; and in response to the accuracy verification result of each blockchain node being verified, a new block is created in the blockchain network, and the bytecode data is packaged into the new block; then, through each blockchain node in the blockchain network, a consensus algorithm is used to perform consensus processing on the new block to complete the deployment of the virtual resource contract; at the same time, a contract address for uniquely identifying the virtual resource contract is generated. When the node 202 is another blockchain node, the node 202 can be used for data on-chain storage, etc.

[0059] See also Figure 3The functions of each node in the blockchain system shown in the figure are introduced in detail below: 1) Routing, the basic function of the node, used to support communication between nodes. In addition to the routing function, the node can also have the following functions: 2) Application, used to be deployed in the blockchain, to implement specific services according to actual business needs, to record the data related to the implementation of the function to form record data, to carry a digital signature in the record data to indicate the source of the task data, and to send the record data to other nodes in the blockchain system for other nodes to add the record data to the temporary block when they successfully verify the source and integrity of the record data. For example, the services implemented by the application include: 2.1) Wallet, which is used to provide the function of conducting electronic currency transactions, including initiating transactions (that is, sending the transaction record of the current transaction to other nodes in the blockchain system. After the other nodes successfully verify the transaction, as a response to acknowledging the validity of the transaction, the record data of the transaction is stored in a temporary block of the blockchain; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address. 2.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data, and sends the record data of the operation on the account data to other nodes in the blockchain system. After the other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation. 2.3) Smart contracts, computerized protocols that can execute the terms of a contract, are implemented through code deployed on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer, and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods; of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information. 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system. 4) Consensus is a process in the blockchain network used to reach agreement on transactions in a block among multiple nodes involved. The agreed blocks will be appended to the end of the blockchain. The mechanisms for achieving consensus include Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof-of-Stake (DPoS), Proof of Elapsed Time (PoET), etc.

[0060] See also Figure 4 , Figure 4It is an optional schematic diagram of the block structure (Block Structure) provided in an embodiment of the present application. Each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected by the hash value to form a blockchain. In addition, the block may also include information such as the timestamp when the block was generated. Blockchain (Blockchain), essentially a decentralized database, is a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block. In some embodiments, each block may also include a block header.

[0061] An exemplary application of a virtual resource processing device based on blockchain in an embodiment of the present application is described below. The virtual resource processing device based on blockchain is an electronic device for implementing a virtual resource processing method based on blockchain. In one implementation, the virtual resource processing device based on blockchain provided in an embodiment of the present application (i.e., electronic device) can be implemented as a server, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network work), and big data and artificial intelligence platforms. The initiating terminal, the receiving terminal, and the server can be directly or indirectly connected by wired or wireless communication, which is not limited in the embodiment of the present application. Below, an exemplary application of a virtual resource processing device based on blockchain when implemented as a server will be described.

[0062] Another exemplary application of the virtual resource processing device based on blockchain of the embodiment of the present application is described below. The virtual resource processing device based on blockchain is an electronic device for implementing a virtual resource processing method based on blockchain. In one implementation, the virtual resource processing device (i.e., electronic device) based on blockchain provided by the embodiment of the present application can be a smart contract virtual machine, which can be deployed in any third-party server. The smart contract virtual machine is a data communication bridge between the server and the blockchain network, and the operating environment is provided by the smart contract virtual machine. The smart contract virtual machine implements the registration of the virtual resource contract in the blockchain network under the operating environment. Among them, the third-party server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network), and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms. Moreover, the third-party server is another server different from the above-mentioned server. The initiating terminal, the receiving terminal, and the third-party server can be directly or indirectly connected by wired or wireless communication, which is not limited in the embodiment of the present application. The structure of the third-party server (i.e. another blockchain-based virtual resource processing device) can be found in Figure 5 The structure of the electronic device shown.

[0063] See also Figure 5 , Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 5 The electronic device shown may be a blockchain-based virtual resource processing device, which includes: at least one processor 310, a memory 350, at least one network interface 320, and a user interface 330. The various components in the blockchain-based virtual resource processing device are coupled together through a bus system 340. It is understood that the bus system 340 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 340 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in Figure 5 Various buses are labeled as bus system 340 .

[0064] The processor 310 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0065] The user interface 330 includes one or more output devices 331 that enable presentation of media content, and one or more input devices 332 .

[0066] The memory 350 may be removable, non-removable or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drive, optical disk drive, etc. The memory 350 may optionally include one or more storage devices physically away from the processor 310. The memory 350 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 350 described in the embodiment of the present application is intended to include any suitable type of memory. In some embodiments, the memory 350 can store data to support various operations, and examples of these data include programs, modules, and data structures or subsets or supersets thereof, as exemplarily described below.

[0067] An operating system 351 includes system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic businesses and processing hardware-based tasks; a network communication module 352 is used to reach other computing devices via one or more (wired or wireless) network interfaces 320. Exemplary network interfaces 320 include: Bluetooth, wireless compatibility certification (WiFi), and Universal Serial Bus (USB), etc.; an input processing module 353 is used to detect one or more user inputs or interactions from one of the one or more input devices 332 and translate the detected inputs or interactions.

[0068] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 5 A blockchain-based virtual resource processing device 354 stored in a memory 350 is shown. The blockchain-based virtual resource processing device 354 can be a blockchain-based virtual resource processing device in an electronic device, which can be software in the form of programs and plug-ins, including the following software modules: a first receiving module 3541, a contract registration module 3542, a first sending module 3543 and a processing module 3544. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.

[0069] In some embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the blockchain-based virtual resource processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.

[0070] This application can also use cloud technology to implement a virtual resource processing method based on blockchain, where cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or local area network to realize data calculation, storage, processing, and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model application. It can form a resource pool, which is used on demand, flexible and convenient. Cloud computing technology will become an important support. The background service of the technical network system requires a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, each item may have its own identification mark in the future, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately, and all kinds of industry data need strong system backing support, which can only be achieved through cloud computing.

[0071] In some embodiments, data can also be stored for information such as virtual resource contracts, identity information of the initiating terminal and the receiving terminal. In the process of storing data such as virtual resource contracts, identity information of the initiating terminal and the receiving terminal, cloud storage technology can be used. Cloud storage is a new concept extended and developed from the concept of cloud computing. A distributed cloud storage system refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of storage devices of various types (storage devices are also called storage nodes) in the network through application software or application interfaces to work together and provide data storage and business access functions to the outside world.

[0072] In other embodiments, data query can be performed on virtual resource contracts, identity information of initiating terminals and receiving terminals, etc. The scheme for performing data query on virtual resource contracts, identity information of initiating terminals and receiving terminals, etc. can be implemented by using a database in cloud technology, wherein the database (Database), in short, can be regarded as an electronic filing cabinet, that is, a place for storing electronic files, and users can add, query, update, etc. data in the files. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application.

[0073] The following will combine the exemplary application and implementation of the blockchain system and electronic device provided in the embodiments of the present application to illustrate the blockchain-based virtual resource processing method provided in the embodiments of the present application. The blockchain-based virtual resource processing method provided in each embodiment of the present application can be executed by an electronic device, wherein the electronic device can be implemented as a server or as a smart contract virtual machine, that is, the blockchain-based virtual resource processing method in each embodiment of the present application can be executed by a server, or by a smart contract virtual machine, or can be executed interactively between an initiating terminal, a receiving terminal, a server and a smart contract virtual machine.

[0074] Figure 6 This is an optional flow chart of a virtual resource processing method based on blockchain provided in an embodiment of the present application. Figure 6 The steps shown are explained as Figure 6 As shown, the method includes the following steps S101 to S105:

[0075] Step S101: The server receives a virtual resource processing request sent by an initiating terminal.

[0076] Here, the virtual resource processing request is used to request processing of virtual resources, and the virtual resource processing request includes virtual resource parameters. Virtual resources can be various virtual items, such as virtual red envelopes, points, or electronic vouchers. The virtual resource processing request of the embodiment of the present application can be a request for sending a red envelope, receiving a red envelope, sending a points request, receiving a points request, sending an electronic voucher, receiving an electronic voucher, etc., for any processing request of a virtual item.

[0077] In some embodiments, the virtual resource parameters include response conditions for specifying the virtual resource processing request. For example, the virtual resource parameters may include but are not limited to at least one of the following: amount, quantity, type, identity of the recipient, department, graduation school, geographic location and other information. These parameters are used to limit the response conditions of the virtual resource processing process. That is, in the process of processing the virtual resource, these response conditions need to be met in order to achieve an effective response to the virtual resource processing request.

[0078] Step S102: The server responds to the virtual resource processing request and sends the virtual resource parameters to the smart contract virtual machine to register the virtual resource contract in the blockchain network through the smart contract virtual machine.

[0079] After receiving the virtual resource processing request, the server can first verify the virtual resource processing request. Here, the identity of the initiating terminal that sends the virtual resource processing request can be verified, and the parameters carried in the virtual resource processing request can also be verified. When the identity authentication and parameter verification are passed, the virtual resource parameters are sent to the smart contract virtual machine in response to the virtual resource processing request.

[0080] Here, the smart contract virtual machine is the operating environment of the virtual resource contract. The smart contract virtual machine is similar to an operating system, because the virtual resource contract is essentially a piece of contract code. The contract code needs to be run in the program, so the smart contract virtual machine provides an operating environment for the virtual resource contract. It should be noted that the smart contract virtual machine is actually a program. The program of the smart contract virtual machine provides an operating environment. Therefore, the smart contract virtual machine is an operating environment that has been separated from the blockchain node in the blockchain network. It can be understood that the smart contract virtual machine is a data communication bridge between the server and the blockchain network, which can realize data communication between the server and the blockchain network.

[0081] The smart contract virtual machine can register the virtual resource contract based on the virtual resource parameters in the blockchain network, that is, the smart contract virtual machine can generate the smart contract for this virtual resource processing process. In this way, the constraints of this virtual resource processing process are specified in the smart contract. Since the blockchain network can realize that the full name of the virtual resource processing process can be verified on the blockchain of the blockchain network, the transparency of the virtual resource processing process is improved, and the trustworthiness of the virtual resource processing process is improved.

[0082] Step S103, the server receives the contract address of the virtual resource contract returned by the smart contract virtual machine.

[0083] In the embodiment of the present application, after completing the step of registering the virtual resource contract, the smart contract virtual machine can also obtain the contract address of the virtual resource contract, wherein the contract address refers to the storage address of the registered virtual resource contract in the blockchain network. The contract address of the virtual resource contract can be sent to the server, so that when the server subsequently executes the response process of this virtual resource processing process, it can directly obtain the virtual resource contract based on the contract address, thereby executing the subsequent processing process based on the virtual resource contract.

[0084] Step S104, when receiving the virtual resource response request sent by the receiving terminal corresponding to the virtual resource processing request, the server sends a contract execution request to the smart contract virtual machine based on the contract address to request the smart contract virtual machine to execute the virtual resource contract and obtain the contract execution result.

[0085] In some embodiments, the server may also receive a virtual resource response request sent by other receiving terminals, and the virtual resource response request is a request corresponding to the virtual resource processing request. The correspondence here means that the virtual resource response request is used to request a response to the virtual resource processing request, that is, the response process corresponding to the virtual resource response request is the response process corresponding to the virtual resource processing request. For example, the virtual resource processing request may be a red envelope request, then the virtual resource response request is a red envelope receiving request corresponding to the red envelope request. For example, user A sends a red envelope to user B's terminal B1 on terminal A1, then user A sends a virtual resource processing request through terminal A1, and when user B clicks on the red envelope through terminal B1, user B sends a virtual resource response request through terminal B1.

[0086] The relationship between the virtual resource processing request and the virtual resource response request can be one-to-one, one-to-many, and one-to-zero, wherein the one-to-one relationship means that the virtual resource processing request sent by the initiating terminal can only be responded to by one receiving terminal. At this time, if the receiving terminal sends a virtual resource response request to the server in response to the virtual resource processing request, then the relationship between the virtual resource processing request and the virtual resource response request is one-to-one; the one-to-many relationship means that the virtual resource processing request sent by the initiating terminal can be responded to by multiple receiving terminals. At this time, if multiple receiving terminals all send virtual resource response requests to the server in response to the virtual resource processing request, then the relationship between the virtual resource processing request and the virtual resource response request is one-to-many; the one-to-zero relationship means that the virtual resource processing request sent by the initiating terminal can be responded to by one or more receiving terminals, but if within a preset time, no receiving terminal sends a virtual resource response request to the server in response to the virtual resource processing request, then the relationship between the virtual resource processing request and the virtual resource response request is one-to-zero.

[0087] For example, a one-to-one relationship may correspond to the following scenario: in the scenario of sending red envelopes between user A and user B, user A may send a red envelope to user B through terminal A1, and user B clicks on the red envelope on terminal B1 to receive the red envelope sent by user A. A one-to-many relationship may correspond to the following scenario: user A sends a group red envelope (for example, a lucky red envelope) in a user group C (with at least three group members), and sets the number of red envelopes to multiple, and multiple group members may click on the red envelope on their respective terminals to receive the group red envelope sent by user A. A one-to-zero relationship may correspond to the following scenario: user A sends a red envelope to user B, but user B does not click to receive the red envelope within a preset time (for example, one day), and the amount of the red envelope will be returned to user A's account; or user A sends a group red envelope in a user group C, and sets the number of red envelopes to multiple, but no group member clicks on the terminal to receive the red envelope within the preset time, and the amount of the red envelope will also be returned to user A's account.

[0088] In some embodiments, the virtual resource response request may carry a contract address, or may carry a request identifier of a virtual resource processing request. When the server receives the virtual resource response request, it may parse the contract address or request identifier to determine that the virtual resource response request is a response request for the virtual resource processing request. At the same time, the identity information of the receiving terminal may be verified to determine that the receiving terminal is a terminal capable of responding to the virtual resource processing request. After the receiving terminal passes the identity authentication, a contract execution request may be generated based on the contract address, and the contract execution request may be sent to the smart contract virtual machine to request the smart contract virtual machine to execute the virtual resource contract corresponding to the contract address to obtain the contract execution result.

[0089] In some embodiments, the contract execution result may be the result of completing the execution of the virtual resource processing request. For example, the virtual resource processing request is a red envelope request, which includes the red envelope amount and the user ID of the red envelope receiving user. When the receiving terminal is authenticated based on the virtual resource response request sent by the receiving terminal, it can be determined based on the receiving terminal whether the terminal user corresponding to the receiving terminal is consistent with the user ID. If they are consistent, the identity authentication is passed, and the funds corresponding to the red envelope amount can be transferred from the account of the red envelope sending user (corresponding to the initiating terminal) to the account of the red envelope receiving user (corresponding to the receiving terminal).

[0090] Step S105: The server receives the contract execution result and sends the contract execution result to the initiating terminal and the receiving terminal.

[0091] In some embodiments, after the smart contract virtual machine obtains the contract execution result, it can send the contract execution result to the server, and the server forwards the contract execution result to the initiating terminal and the receiving terminal.

[0092] The blockchain-based virtual resource processing method provided in the embodiment of the present application, after receiving the virtual resource processing request sent by the initiating terminal, responds to the virtual resource processing request, sends the virtual resource parameters to the smart contract virtual machine, so as to register the virtual resource contract in the blockchain network through the smart contract virtual machine; and receives the contract address of the virtual resource contract returned by the smart contract virtual machine; thereafter, when receiving the virtual resource response request sent by the receiving terminal corresponding to the virtual resource processing request, sends a contract execution request to the smart contract virtual machine based on the contract address, so as to request the smart contract virtual machine to execute the virtual resource contract and obtain the contract execution result. In this way, the processing of virtual resources is realized through smart contract technology, thereby improving the trust, security and real-time performance in the virtual resource processing process, ensuring the transparency of the virtual resource processing process, and avoiding disputes over virtual resource configuration.

[0093] In some embodiments, the blockchain-based virtual resource processing method can be applied to a virtual resource processing system, which includes: an initiating terminal, a server, a smart contract virtual machine, a blockchain network, and a receiving terminal.

[0094] The following will take the virtual resource processing system including an initiating terminal, a server, a smart contract virtual machine, a blockchain network and a receiving terminal as an example to illustrate the blockchain-based virtual resource processing method of an embodiment of the present application.

[0095] Figure 7 is another optional flow chart of the blockchain-based virtual resource processing method provided in the embodiment of the present application, such as Figure 7 As shown, the method includes the following steps S201 to S218:

[0096] Step S201: an initiating terminal receives a user's virtual resource processing operation.

[0097] Here, the virtual resource processing operation may be a red envelope sending operation. The user may trigger the red envelope function on the client of the instant messaging application, input red envelope parameters (ie, virtual resource parameters), and click the red envelope sending button to generate the virtual resource processing operation.

[0098] Step S202: the initiating terminal generates a virtual resource processing request in response to the virtual resource processing operation; the virtual resource processing request includes virtual resource parameters.

[0099] After the initiating terminal receives the user's virtual resource processing operation, it performs operation verification on the virtual resource processing operation to verify the accuracy and legality of the virtual resource processing operation. If the virtual resource processing operation is correct and legal, a virtual resource processing request is generated.

[0100] It should be noted that the virtual resource parameter includes at least one sub-parameter, and the correct operation of the virtual resource processing operation can be that the corresponding sub-parameters are all entered for the virtual resource parameters that must be entered on the current interface of the red envelope function of the instant messaging application; and each sub-parameter in the virtual resource parameter is an accurate parameter, for example, the amount of the red envelope is less than or equal to the balance of the account, the user who receives the red envelope is a currently existing and legal user, the amount of the red envelope is a positive number, the address to receive the red envelope is an accurate address, etc. The legal operation of the virtual resource processing operation can be that each sub-parameter in the input virtual resource parameter is a legal parameter, for example, red envelopes cannot be sent to illegal users, and the user who receives the red envelope is a currently existing and legal user, etc.

[0101] Virtual resources may be various virtual items, such as virtual red envelopes, points or electronic vouchers, etc. The generated virtual resource processing request may be a red envelope sending request, a red envelope receiving request, a points sending request, a points receiving request, an electronic voucher sending request, an electronic voucher receiving request, etc., which are processing requests for any virtual item.

[0102] The virtual resource parameters include response conditions for specifying the virtual resource processing request. For example, the virtual resource parameters may include but are not limited to at least one of the following information: amount, quantity, type, identity of the recipient, department, graduate school, geographic location, etc. These sub-parameters are used to limit the response conditions of the virtual resource processing process. That is, in the process of processing the virtual resource, these response conditions need to be met to achieve an effective response to the virtual resource processing request. It should be noted that each sub-parameter in the virtual resource parameters corresponds to at least one condition. For example, for the amount parameter in the virtual resource parameters, the corresponding condition is that the amount in the virtual resource processing process is the value corresponding to the amount parameter; for the recipient department parameter in the virtual resource parameters, the corresponding condition is that the user who receives the virtual resource in the virtual resource processing process should be an employee of the department; for the graduate school parameter in the virtual resource parameters, the corresponding condition is that the user who receives the virtual resource in the virtual resource processing process should be a graduate of the graduate school.

[0103] The virtual resource parameters may also include mandatory conditions corresponding to multiple sub-parameters, where the mandatory conditions are used to define which conditions must be met and which conditions may or may not be met. When the user of the initiating terminal inputs the virtual resource parameters, a mandatory condition selection button may be set for each sub-parameter on the current interface of the initiating terminal, and the user may click the mandatory condition button to select the mandatory condition or click the mandatory condition button to unselect the mandatory condition. When the mandatory condition is selected for any sub-parameter, the sub-parameter is a condition that must be met during the execution of the virtual resource processing.

[0104] For example, if the virtual resource processing request is a red envelope sending request, for the three sub-parameters of department, graduate school, and geographical location in the virtual resource parameters, among which the department parameter is K department, the graduate school parameter is X university, and the geographical location parameter is L location, if the user selects the mandatory satisfaction condition for K department and X university, and does not select the mandatory satisfaction condition for L location, then when receiving the red envelope, any user who meets the two conditions of K department and X university can receive the red envelope, regardless of whether the user is in L location.

[0105] Step S203: the initiating terminal sends a virtual resource processing request to the server.

[0106] Step S204: The server responds to the virtual resource processing request and sends the virtual resource parameters to the smart contract virtual machine.

[0107] In some embodiments, in step S204, in response to the virtual resource processing request, sending the virtual resource parameters to the smart contract virtual machine can be implemented in the following manner: First, the server parses the virtual resource processing request to obtain the virtual resource parameters. Then, the server performs a data legitimacy check on the virtual resource parameters to obtain a legitimacy check result. If the legitimacy check result is a pass, the server obtains the virtual interface of the smart contract virtual machine. Finally, the server sends the virtual resource parameters to the smart contract virtual machine through the virtual interface.

[0108] Here, data validity verification refers to verifying whether each sub-parameter in the virtual resource parameter is an accurate parameter.

[0109] The virtual interface of the smart contract virtual machine can be an application programming interface (API) or a software development kit (SDK) of the smart contract virtual machine. The virtual resource parameters can be sent to the smart contract virtual machine through the API interface and the SDK interface.

[0110] Step S205: The smart contract virtual machine registers the virtual resource contract in the blockchain network based on the virtual resource parameters.

[0111] In some embodiments, see Figure 7 , Figure 7 It is also shown that step S205 can be implemented by following the steps S2051 to S2055:

[0112] Step S2051, obtaining a preset contract template in the smart contract virtual machine.

[0113] Step S2052: determine the rule type corresponding to each rule information in the virtual resource parameters.

[0114] Step S2053, in the preset contract template, determine the setting location corresponding to each rule type.

[0115] Step S2054, write each rule information into the preset contract template according to the setting position to obtain the template virtual resource contract.

[0116] Step S2055, register the template virtual resource contract in the blockchain network to obtain the virtual resource contract.

[0117] In some embodiments, step S2055 can be implemented in the following manner: first, compile the template virtual resource contract to obtain bytecode data corresponding to the template virtual resource contract; the bytecode data is data that can be run on the smart contract virtual machine; then, broadcast the bytecode data corresponding to the template virtual resource contract to each blockchain node in the blockchain network through a peer-to-peer network, so as to register the template virtual resource contract through each blockchain node in the blockchain network to obtain a virtual resource contract.

[0118] In some embodiments, registering the template virtual resource contract through each blockchain node in the blockchain network can be achieved in the following manner: First, the bytecode data corresponding to the template virtual resource contract is verified for data accuracy through each blockchain node to obtain an accuracy verification result. Then, if the accuracy verification result of each blockchain node is verified to be passed, a new block is created in the blockchain network, and the bytecode data is packaged into the new block. Finally, a consensus algorithm is used to perform consensus processing on the new block through each blockchain node in the blockchain network to complete the deployment of the virtual resource contract.

[0119] Step S206: The smart contract virtual machine generates a contract address for uniquely identifying the virtual resource contract.

[0120] Here, the contract address refers to the storage address of the registered virtual resource contract in the blockchain network. After completing the step of registering the virtual resource contract, the smart contract virtual machine can also obtain the address in the blockchain network where the virtual resource contract is stored to obtain the contract address of the virtual resource contract.

[0121] Step S207, the smart contract virtual machine sends the contract address of the virtual resource contract to the server.

[0122] Step S208: The server stores the contract address in the database.

[0123] Here, the database may be a database implemented based on cloud storage technology, and the contract address may be stored in the database based on cloud storage technology.

[0124] Step S209: The server determines, from the virtual resource parameters, a terminal identifier of a receiving terminal for receiving the virtual resource corresponding to the virtual resource processing request.

[0125] Here, the terminal identifier of the virtual resource receiving terminal can be obtained from the virtual resource parameter, wherein the virtual resource parameter can be parsed to directly obtain the terminal identifier. When the virtual resource processing request is generated, the terminal identifier will be written into a specific field of the virtual resource parameter. Therefore, after parsing the virtual resource parameter, the value in the specific field can be obtained, and the value is the terminal identifier of the receiving terminal.

[0126] Step S210: The server generates a virtual resource message corresponding to the virtual resource, and the virtual resource message includes a contract address.

[0127] Here, the server can generate a virtual resource message based on the contract address, that is, the contract address can be encapsulated into the virtual resource message to inform the receiving terminal of the location of the virtual resource contract through the virtual resource message.

[0128] Step S211: The server sends the virtual resource message to the receiving terminal corresponding to the terminal identifier.

[0129] The virtual resource message can be presented on the receiving terminal in any form such as a picture, a QR code, an operable link, text, etc. For example, the virtual resource message can be presented on the receiving terminal in the form of a red envelope picture.

[0130] Step S212: the receiving terminal receives the user's virtual resource response operation.

[0131] Here, the virtual resource response operation may be a red envelope receiving operation. The user may perform an interactive operation on the virtual resource message on the client of the instant messaging application to generate the virtual resource response operation. The interactive operation may be any one of the following: click, double-click, long press, copy, paste, forward, etc.

[0132] Step S213: the receiving terminal generates a virtual resource response request in response to the virtual resource response operation; the virtual resource response request includes virtual resource parameters.

[0133] In the embodiment of the present application, the relationship between the virtual resource processing request and the virtual resource response request can be one-to-one, one-to-many, or one-to-zero.

[0134] In some embodiments, the virtual resource response request may carry a contract address, or may carry a request identifier of a virtual resource processing request. After the server receives the virtual resource response request, it may parse the contract address or the request identifier to determine that the virtual resource response request is a response request for the virtual resource processing request. At the same time, the identity information of the receiving terminal may also be verified to determine that the receiving terminal is a terminal that can respond to the virtual resource processing request.

[0135] Step S214: the receiving terminal sends the virtual resource response request to the server.

[0136] Step S215: The server responds to the virtual resource response request and sends a contract execution request to the smart contract virtual machine based on the contract address.

[0137] In an embodiment of the present application, after the server authenticates the receiving terminal, it can generate a contract execution request based on the contract address, and send the contract execution request to the smart contract virtual machine to request the smart contract virtual machine to execute the virtual resource contract corresponding to the contract address to obtain the contract execution result.

[0138] In some embodiments, step S215 may be implemented in the following manner:

[0139] First, the virtual resource response request is verified for legitimacy and the legitimacy verification result is obtained. If the legitimacy verification result is passed, the server carries the contract address in the contract execution request. Then, the server obtains the virtual interface of the smart contract virtual machine. Finally, the server sends the contract execution request to the smart contract virtual machine through the virtual interface.

[0140] In some embodiments, the virtual resource response request includes a contract address and identity information of a receiving terminal; the legitimacy verification of the virtual resource response request can be achieved in the following manner: when a virtual resource response request sent by a receiving terminal is received, first, the virtual resource response request is parsed to obtain the contract address and identity information; then, the identity of the receiving terminal is authenticated based on the identity information to obtain an identity authentication result; and, based on the contract address, the legitimacy verification of the virtual resource response request is performed to obtain a request legitimacy verification result; wherein the identity authentication result and the request legitimacy verification result constitute a legitimacy verification result.

[0141] Here, the virtual resource contract stored in the contract address can be queried based on the contract address to determine whether the virtual resource contract matches the virtual resource response request, that is, to determine whether the virtual resource contract is a contract used to respond to the virtual resource response request. If so, the request legitimacy verification result is verification passed.

[0142] Step S216, the smart contract virtual machine responds to the contract execution request, executes the virtual resource contract, and obtains the contract execution result.

[0143] Step S217, the smart contract virtual machine sends the contract execution result to the server.

[0144] Step S218: The server sends the contract execution result to the initiating terminal and the receiving terminal.

[0145] In the embodiments of the present application, the processing of virtual resources is achieved through smart contract technology, thereby improving the trust, security and real-time performance of the virtual resource processing process, ensuring the transparency of the virtual resource processing process, and avoiding disputes over virtual resource configuration.

[0146] Figure 8 It is another optional flow chart of the virtual resource processing method based on blockchain provided in the embodiment of the present application, such as Figure 8 As shown, the method includes the following steps S301 to S326:

[0147] Step S301: an initiating terminal receives a user's virtual resource processing operation.

[0148] Here, the virtual resource processing operation may be a red envelope sending operation. The user may trigger the red envelope function on the client of the instant messaging application, input red envelope parameters (ie, virtual resource parameters), and click the red envelope sending button to generate the virtual resource processing operation.

[0149] Step S302: the initiating terminal generates a virtual resource processing request in response to the virtual resource processing operation; the virtual resource processing request includes virtual resource parameters.

[0150] After the initiating terminal receives the user's virtual resource processing operation, it performs operation verification on the virtual resource processing operation to verify the accuracy and legality of the virtual resource processing operation. If the virtual resource processing operation is correct and legal, a virtual resource processing request is generated.

[0151] Step S303: the initiating terminal sends a virtual resource processing request to the server.

[0152] Step S304: The server responds to the virtual resource processing request and sends the virtual resource parameters to the smart contract virtual machine.

[0153] Here, the server parses the virtual resource processing request and obtains the virtual resource parameters. Then, the server performs a data validity check on the virtual resource parameters and obtains a validity check result. If the validity check result is a pass, the server obtains the virtual interface of the smart contract virtual machine. Finally, the server sends the virtual resource parameters to the smart contract virtual machine through the virtual interface.

[0154] Step S305: The smart contract virtual machine registers the virtual resource contract in the blockchain network based on the virtual resource parameters.

[0155] Step S306: The smart contract virtual machine generates a contract address for uniquely identifying the virtual resource contract.

[0156] The contract address refers to the storage address of the registered virtual resource contract in the blockchain network. After completing the steps of registering the virtual resource contract, the smart contract virtual machine can also obtain the address in the blockchain network where the virtual resource contract is stored to obtain the contract address of the virtual resource contract.

[0157] Step S307, the smart contract virtual machine sends the contract address of the virtual resource contract to the server.

[0158] Step S308: The server stores the contract address in the database.

[0159] Step S309: The server determines, from the virtual resource parameters, a terminal identifier of a receiving terminal for receiving the virtual resource corresponding to the virtual resource processing request.

[0160] In an embodiment of the present application, a terminal identifier of a virtual resource receiving terminal can be obtained from a virtual resource parameter, wherein the virtual resource parameter can be parsed to directly obtain the terminal identifier. When a virtual resource processing request is generated, the terminal identifier is written into a specific field of the virtual resource parameter. Therefore, after parsing the virtual resource parameter, a value in the specific field can be obtained, and the value is the terminal identifier of the receiving terminal.

[0161] Step S310: The server generates a virtual resource message corresponding to the virtual resource, and the virtual resource message includes a contract address.

[0162] In an embodiment of the present application, the server can generate a virtual resource message based on the contract address, that is, the contract address can be encapsulated into the virtual resource message to inform the receiving terminal of the location of the virtual resource contract through the virtual resource message.

[0163] Step S311: The server sends the virtual resource message to the receiving terminal corresponding to the terminal identifier.

[0164] Step S312: the receiving terminal receives the user's virtual resource response operation.

[0165] Step S313: the receiving terminal generates a virtual resource response request in response to the virtual resource response operation; the virtual resource response request includes virtual resource parameters.

[0166] Step S314: the receiving terminal sends the virtual resource response request to the server.

[0167] Step S315: The server responds to the virtual resource response request and sends a contract execution request to the smart contract virtual machine based on the contract address.

[0168] Step S316, the smart contract virtual machine responds to the contract execution request, executes the virtual resource contract, and obtains the contract execution result.

[0169] Step S317, the smart contract virtual machine sends the contract execution result to the server.

[0170] Step S318, in response to the contract execution result that the virtual resource is successfully received, the server obtains the receiving terminal's receipt record information.

[0171] Here, the collection record information includes but is not limited to at least one of the following: collection time, collection amount, collection object, etc.

[0172] Step S319, the server stores the collection record information in a preset storage unit.

[0173] Here, the preset storage unit may be a storage unit implemented based on cloud storage technology, and the collection record information may be stored in the preset storage unit based on cloud storage technology.

[0174] In some embodiments, the preset storage unit may be located in the above-mentioned database.

[0175] Step S320: The server sends the contract execution result to the initiating terminal and the receiving terminal.

[0176] Step S321: If the virtual resource response request sent by the receiving terminal corresponding to the virtual resource processing request is not received within a preset time period, the server generates an expiration processing request based on the contract address.

[0177] Step S322: The server sends an expiration processing request to the smart contract virtual machine.

[0178] Step S323, the smart contract virtual machine executes the expiration processing function in the virtual resource contract corresponding to the contract address to obtain the expiration processing result.

[0179] Step S324, the smart contract virtual machine returns the expiration processing result to the server.

[0180] Step S325: The server generates expiration prompt information based on the expiration processing result.

[0181] Step S326: The server sends expiration prompt information to the initiating terminal and the receiving terminal.

[0182] In the embodiments of the present application, the processing of virtual resources is achieved through smart contract technology, thereby improving the trust, security and real-time performance of the virtual resource processing process, ensuring the transparency of the virtual resource processing process, and avoiding disputes over virtual resource configuration.

[0183] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0184] The blockchain-based virtual resource processing method provided in the embodiment of the present application, taking the virtual resource as a red envelope as an example, can be a digital red envelope system and method based on smart contract technology, which can realize the creation, issuance and receipt of red envelopes on the blockchain network. Specifically, through smart contract technology, the embodiment of the present application solves the trust problem, security problem and real-time problem in the red envelope issuance process.

[0185] The red envelope solution based on the smart contract platform technology of the embodiment of the present application can be applied to various scenarios, such as social applications, payment platforms, e-commerce platforms, etc. The following is an optional product application scenario and the corresponding graphical user interface (GUI) interaction diagram and text description.

[0186] Fig. 9 This is a home page interface diagram of the red envelope method of the smart contract platform technology provided in the embodiment of the present application, such as Fig. 9 As shown in the figure, an interface is displayed on the product homepage, including the following function buttons:

[0187] Send red envelope button: After the user clicks it, they will enter the red envelope creation page.

[0188] Receive red envelope button: After the user clicks it, he will enter the red envelope receiving page.

[0189] My Red Envelope Button: After the user clicks it, he will enter the page to view the records of red envelopes that have been sent and received.

[0190] Settings button: After the user clicks it, they will enter the settings interface, where they can manage wallet IDs, select types, etc.

[0191] Fig.10 This is a red envelope sending page diagram of the red envelope method of the smart contract platform technology provided in the embodiment of the present application, such as Fig.10 As shown, the red envelope sending page includes the following function buttons:

[0192] Red envelope type: Users can choose a regular red envelope (fixed amount) or a lucky red envelope (random amount).

[0193] Total amount: The user enters the total amount of the red envelope.

[0194] Number of red envelopes: The user enters the number of red envelopes.

[0195] Greetings: Users can customize greetings.

[0196] Red envelope collection rules: Users can set rules for receiving red envelopes, such as validity period, the region, gender, age, etc. of the user receiving the red envelope.

[0197] Send button: After clicking, the application will generate a smart contract (i.e. the virtual resource contract mentioned above), lock the corresponding, and generate a red envelope sharing link or QR code.

[0198] Fig.11 This is a diagram of a red envelope receiving page of a red envelope method of the smart contract platform technology provided in an embodiment of the present application, such as Fig.11 As shown, the red envelope receiving page includes the following function buttons:

[0199] Input box: used for users to enter or paste red envelope links.

[0200] Claim button: After clicking, the app will check whether the user meets the claim conditions and interact with the smart contract to transfer the red envelope amount to the user's wallet.

[0201] Red envelope details: Displays the amount of the red envelope, the remaining number, the validity period and other information.

[0202] Fig.12 This is a diagram of my red envelope page of the red envelope method of the smart contract platform technology provided in the embodiment of the present application, such as Fig.12 As shown, the My Red Packet page includes the following function buttons:

[0203] Sent red envelopes: Displays the red envelope records sent by users, including red envelope amount, type, status and other information.

[0204] Received red envelopes: Displays the records of red envelopes received by users, including the amount of the red envelope, sender and other information.

[0205] The embodiment of the present application is a rule-constrained method of issuing and receiving red envelopes based on smart contract technology. Fig.13 This is the technical implementation sequence diagram of the smart contract red envelope solution, such as Fig.13 As shown, the scheme includes the following steps:

[0206] Step S1301, the user sending the red envelope inputs relevant parameters of the red envelope, such as amount, quantity, type, etc., through the client.

[0207] Here, the client designs a user interface that allows users to enter the parameters of the red envelope, including amount, quantity, type, etc.

[0208] Regarding parameter validation, the client should validate the data entered by the user before submission to ensure that the data conforms to the expected rules and format.

[0209] Step S1302, the client sends these red envelope parameters to the backend service (ie, the server).

[0210] Here, the client packages and sends the data to the backend service by using Hyper Text Transfer Protocol (HTTP) or other communication protocols. The data is sent in the format of JavaScript Object Notation (JSON) or Extensible Markup Language (XML).

[0211] Step S1303, the backend service sends the red envelope parameters to the smart contract virtual machine.

[0212] Here, the backend service first verifies and processes the legitimacy of the data received from the client. Then, the backend service sends the red envelope parameters to the smart contract virtual machine through the smart contract virtual machine's application programming interface (API) or software development kit (SDK). The smart contract virtual machine creates a red envelope contract based on the parameters and compiles it into bytecode data, which can be executed on the smart contract virtual machine.

[0213] Step S1304: The smart contract virtual machine sends the contract bytecode data to the blockchain network.

[0214] Here, the smart contract virtual machine broadcasts the contract bytecode data to other nodes in the blockchain network through the P2P network. Each node will receive and verify the correctness of the contract bytecode data.

[0215] Step S1305: The blockchain network registers the contract, and after reaching a consensus, the contract address is returned to the smart contract virtual machine.

[0216] Here, miners or verification nodes in the blockchain network package the contract bytecode data into a new block. The blockchain network uses consensus algorithms (such as proof of work, proof of stake, etc.) to reach a consensus on the new block. After the contract is deployed, the blockchain network generates a unique contract address.

[0217] Step S1306, the smart contract virtual machine returns the contract address to the backend service.

[0218] Here, after the smart contract virtual machine receives the contract address from the blockchain network, it returns the address to the backend service through the API or SDK.

[0219] Step S1307, the backend service stores the contract address and sends a red envelope message to the client.

[0220] In the embodiment of the present application, the backend service can store the contract address in the database for subsequent query and operation. At the same time, the backend service can also send the red envelope message containing the contract address to the client via HTTP or other communication protocols.

[0221] Step S1308: The red envelope recipient collects the red envelope through the client.

[0222] Here, after receiving the red envelope message, the client displays the relevant information of the red envelope, such as the amount, quantity, type, etc. The user who receives the red envelope can click on the red envelope to initiate the collection operation.

[0223] Step S1309: The client sends a red envelope request to the backend service.

[0224] In an embodiment of the present application, the client sends a red envelope request and a contract address together to the backend service.

[0225] Step S1310, the backend service triggers the smart contract virtual machine to execute the contract.

[0226] Here, the backend service verifies the received red envelope request data and sends a request to execute the red envelope contract through the API or SDK of the smart contract virtual machine.

[0227] Step S1311: The smart contract virtual machine transfers the red envelope amount to the wallet of the user receiving the red envelope.

[0228] The smart contract virtual machine executes the receiving function in the red envelope contract and transfers the red envelope amount from the wallet of the red envelope sender to the wallet of the red envelope receiver. In the implementation process, operations such as randomly allocating the red envelope amount and updating the remaining amount of the red envelope are involved.

[0229] Step S1312, the smart contract virtual machine notifies the backend service that the red envelope has been successfully received.

[0230] After the red envelope amount is transferred successfully, the smart contract virtual machine returns the successful receipt message to the backend service through the API or SDK.

[0231] Step S1313, the backend service sends a message to the client indicating that the red envelope has been successfully received.

[0232] Here, the backend service sends a successful collection message to the client, including information such as the collection amount and collection time.

[0233] Step S1314, the client notifies the red envelope recipient that the red envelope has been successfully received.

[0234] After receiving the successful receipt message, the client displays a prompt box or notification to inform the red envelope recipient that the red envelope has been successfully received and display the received amount.

[0235] After the client notifies the red envelope recipient that the red envelope has been successfully received, the client can update the red envelope status.

[0236] The client can update the status information of the red envelope, such as the remaining amount, remaining quantity, etc., according to the message of successful red envelope collection sent by the backend service. The client can also query the red envelope status from the backend service regularly to ensure that the displayed information is the latest.

[0237] Afterwards, the backend service can also record the red envelope collection record. After receiving the message that the red envelope is successfully collected, the backend service stores the collection record in the database or other persistent storage. The stored collection record may include the information of the user who collected the red envelope, the collection time, the collection amount, etc.

[0238] In some embodiments, the client can also display the collection record. The client can request the backend service to display the red envelope collection record to the user. The user can view who has received the red envelope, as well as information such as the amount and time of collection.

[0239] In some embodiments, the red envelope can also be expired. For example, if the red envelope is not fully received within a certain period of time, the backend service can trigger the expiration processing function in the smart contract. The expiration processing function usually returns the uncollected red envelope amount to the red envelope user.

[0240] During the implementation, the client can display the red envelope expiration information. If the red envelope has expired, the client can display relevant prompt information to inform the user that the red envelope has expired. The client can also regularly query the backend service for the red envelope status so as to update the interface when the red envelope expires.

[0241] Through the technical solution provided in the embodiment of this application, the digital red envelope function is fully realized in the smart contract. The entire process covers the interaction between the client, backend service, smart contract virtual machine and blockchain network, ensuring the security and transparency of the red envelope.

[0242] Compared with the solutions in the related technologies, the red envelope solution based on smart contract technology provided in the embodiment of the present application has significant improvements mainly in terms of security and transparency.

[0243] First, in terms of security: the embodiment of the present application locks the red envelope funds through a smart contract, avoiding the risk of relying on a centralized service provider in the red envelope scheme of the related art. In addition, the automatic execution characteristics of the smart contract can reduce the possibility of human operational errors and malicious attacks. Therefore, in terms of security, the embodiment of the present application has significant advantages over the related art.

[0244] Secondly, in terms of transparency: the embodiment of this application is based on smart contract technology, and all red envelope sending, receiving and returning processes are verified on the blockchain, and the data is open and transparent and difficult to tamper with. This means that users and third parties can easily locate and audit red envelope transactions, which improves the transparency of the entire system.

[0245] In some embodiments, the above red envelope solution based on smart contract technology can also introduce privacy protection technology, such as zero knowledge proof (ZKP) or homomorphic encryption, to protect the data of red envelope users. In this way, users can interact with red envelopes while protecting their privacy data.

[0246] It can be understood that in the embodiments of the present application, the content involving user information, such as the identity information of the initiating terminal and the receiving terminal, virtual resource parameters, virtual resource contracts, etc., if it involves data related to user information or enterprise information, when the embodiments of the present application are applied to specific products or technologies, it is necessary to obtain user permission or consent, or to blur this information to eliminate the correspondence between this information and the user; and the relevant data collection and processing should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, obtain the informed consent or separate consent of the subject of personal information, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the subject of personal information.

[0247] The following is an exemplary structure of a blockchain-based virtual resource processing device 354 implemented as a software module provided in an embodiment of the present application. In some embodiments, Figure 5 As shown, the blockchain-based virtual resource processing device 354 includes: a first receiving module 3541, used to receive virtual resource parameters sent by the server, and the virtual resource parameters are data carried in the virtual resource processing request sent by the initiating terminal to the server; a contract registration module 3542, used to register the virtual resource contract in the blockchain network based on the virtual resource parameters, and generate a contract address for uniquely identifying the virtual resource contract; a first sending module 3543, used to send the contract address of the virtual resource contract to the server; the first receiving module 3541 is also used to receive the contract execution request sent by the server based on the contract address when the server receives the virtual resource response request sent by the receiving terminal corresponding to the virtual resource processing request; a processing module 3544, used to execute the virtual resource contract in response to the contract execution request, obtain the contract execution result, and send the contract execution result to the server.

[0248] In some embodiments, the contract registration module is also used to: obtain a preset contract template in the smart contract virtual machine; determine the rule type corresponding to each rule information in the virtual resource parameters; determine the setting position corresponding to each rule type in the preset contract template; write each rule information into the preset contract template according to the setting position to obtain a template virtual resource contract; register the template virtual resource contract in the blockchain network to obtain the virtual resource contract.

[0249] In some embodiments, the contract registration module is also used to: compile the template virtual resource contract to obtain bytecode data corresponding to the template virtual resource contract; the bytecode data is data that can be run on the smart contract virtual machine; broadcast the bytecode data corresponding to the template virtual resource contract to each blockchain node in the blockchain network through a peer-to-peer network, so as to register the template virtual resource contract through each blockchain node in the blockchain network to obtain the virtual resource contract.

[0250] In some embodiments, the contract registration module is also used to: verify the data accuracy of the bytecode data corresponding to the template virtual resource contract through each of the blockchain nodes to obtain an accuracy verification result; in response to the accuracy verification result of each of the blockchain nodes being a passed verification, create a new block in the blockchain network and package the bytecode data into the new block; through each blockchain node in the blockchain network, use a consensus algorithm to perform consensus processing on the new block to complete the deployment of the virtual resource contract; generate a contract address for uniquely identifying the virtual resource contract.

[0251] In some embodiments, the device also includes: a request parsing module, used to parse the virtual resource processing request to obtain the virtual resource parameters; a data legitimacy verification module, used to perform data legitimacy verification on the virtual resource parameters to obtain a legitimacy verification result; an interface acquisition module, used to obtain the virtual interface of the smart contract virtual machine in response to the legitimacy verification result being a passed verification; a second sending module, also used to send the virtual resource parameters to the smart contract virtual machine through the virtual interface.

[0252] In some embodiments, the device also includes: a storage module for storing the contract address in a database; an identification determination module for determining, from the virtual resource parameters, a terminal identification of a receiving terminal for receiving the virtual resource corresponding to the virtual resource processing request; a message generation module for generating a virtual resource message corresponding to the virtual resource, the virtual resource message including the contract address; and a third sending module for sending the virtual resource message to the receiving terminal corresponding to the terminal identification.

[0253] In some embodiments, the first receiving module is also used for: when receiving the virtual resource response request sent by the receiving terminal, performing a request legitimacy verification on the virtual resource response request to obtain a legitimacy verification result; in response to the legitimacy verification result being a passed verification, carrying the contract address in the contract execution request, and obtaining the virtual interface of the smart contract virtual machine; receiving the contract execution request sent by the server through the virtual interface.

[0254] In some embodiments, the virtual resource response request includes the contract address and the identity information of the receiving terminal; the first receiving module is also used to: when receiving the virtual resource response request sent by the receiving terminal, parse the virtual resource response request to obtain the contract address and the identity information; authenticate the identity of the receiving terminal based on the identity information to obtain an identity authentication result; verify the legitimacy of the virtual resource response request based on the contract address to obtain a request legitimacy verification result; wherein the identity authentication result and the request legitimacy verification result constitute the legitimacy verification result.

[0255] In some embodiments, the device also includes: a collection record acquisition module, which is used to obtain the collection record information of the receiving terminal in response to the contract execution result being successful collection of virtual resources; the storage module is also used to store the collection record information in a preset storage unit.

[0256] In some embodiments, the device also includes: a processing request generation module, which is used to generate an expiration processing request based on the contract address in response to not receiving a virtual resource response request sent by a receiving terminal corresponding to the virtual resource processing request within a preset time period; a request receiving module, which is used to receive the expiration processing request sent by the server; an execution module, which is used to execute the expiration processing function in the virtual resource contract corresponding to the contract address in response to the expiration processing request to obtain an expiration processing result; a third sending module, which is used to send the expiration processing result to the server, so that the server can generate expiration prompt information based on the expiration processing result, and send the expiration prompt information to the initiating terminal and the receiving terminal.

[0257] It should be noted that the description of the device of the embodiment of the present application is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment, so it is not repeated. For technical details not disclosed in the embodiment of the device, please refer to the description of the method embodiment of the present application for understanding.

[0258] The embodiment of the present application provides a computer program product, which includes an executable instruction, which is a computer instruction; the executable instruction is stored in a computer-readable storage medium. When a processor of an electronic device reads the executable instruction from the computer-readable storage medium and the processor executes the executable instruction, the electronic device executes the method described in the embodiment of the present application.

[0259] The present application embodiment provides a storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the method provided by the present application embodiment, for example, Figure 6The method shown.

[0260] In some embodiments, the storage medium can be a computer-readable storage medium, for example, a ferroelectric random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPR OM), a flash memory, a magnetic surface memory, an optical disk, or a compact disk read-only memory (CD-ROM), etc.; it can also be various devices including one or any combination of the above memories.

[0261] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0262] As an example, executable instructions may, but need not correspond to, a file in a file system, may be stored as part of a file storing other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions). As an example, executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed at multiple locations and interconnected by a communication network.

[0263] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A virtual resource processing method based on blockchain, It is characterized in that Applied to a smart contract virtual machine, the smart contract virtual machine is a data communication bridge between a server and a blockchain network, an operating environment is provided by the smart contract virtual machine, and the smart contract virtual machine implements registration of the virtual resource contract in the blockchain network under the operating environment; the method comprises: Receiving a virtual resource parameter sent by a server, wherein the virtual resource parameter is data carried in a virtual resource processing request sent by an initiating terminal to the server; Based on the virtual resource parameters, register the virtual resource contract in the blockchain network, and generate a contract address for uniquely identifying the virtual resource contract; Sending the contract address of the virtual resource contract to the server; When the server receives a virtual resource response request sent by a receiving terminal corresponding to the virtual resource processing request, receiving a contract execution request sent by the server based on the contract address; In response to the contract execution request, the virtual resource contract is executed, a contract execution result is obtained, and the contract execution result is sent to the server.

2. The method according to claim 1, It is characterized in that The registering the virtual resource contract in the blockchain network based on the virtual resource parameter includes: Obtaining a preset contract template in the smart contract virtual machine; Determine the rule type corresponding to each rule information in the virtual resource parameter; In the preset contract template, determine the setting location corresponding to each rule type; Writing each rule information into the preset contract template according to the setting position to obtain a template virtual resource contract; The template virtual resource contract is registered in the blockchain network to obtain the virtual resource contract.

3. The method according to claim 2, It is characterized in that The step of registering the template virtual resource contract in the blockchain network to obtain the virtual resource contract includes: Compiling the template virtual resource contract to obtain bytecode data corresponding to the template virtual resource contract; the bytecode data is data that can be run on the smart contract virtual machine; The bytecode data corresponding to the template virtual resource contract is broadcast to each blockchain node in the blockchain network through a peer-to-peer network, so that the template virtual resource contract is registered through each blockchain node in the blockchain network to obtain the virtual resource contract.

4. The method according to claim 3, It is characterized in that The registering the template virtual resource contract through each blockchain node in the blockchain network includes: Verifying the accuracy of the bytecode data corresponding to the template virtual resource contract through each of the blockchain nodes to obtain an accuracy verification result; In response to the accuracy verification result of each of the blockchain nodes being a passed verification, creating a new block in the blockchain network, and packaging the bytecode data into the new block; Through each blockchain node in the blockchain network, a consensus algorithm is used to perform consensus processing on the new block to complete the deployment of the virtual resource contract; A contract address is generated for uniquely identifying the virtual resource contract.

5. The method according to claim 1, It is characterized in that Before receiving the virtual resource parameters sent by the server, the method further includes: Parsing the virtual resource processing request by the server to obtain the virtual resource parameters; Performing data validity verification on the virtual resource parameters to obtain a validity verification result; In response to the legitimacy verification result being a passed verification, obtaining a virtual interface of the smart contract virtual machine; The virtual resource parameters sent by the server are received through the virtual interface.

6. The method according to claim 1, It is characterized in that The method further comprises: Storing the contract address in a database through the server; Determining, from the virtual resource parameters, a terminal identifier of a receiving terminal for receiving the virtual resource corresponding to the virtual resource processing request; Generate a virtual resource message corresponding to the virtual resource, wherein the virtual resource message includes the contract address; The virtual resource message is sent to a receiving terminal corresponding to the terminal identifier.

7. The method according to any one of claims 1 to 6, It is characterized in that When the server receives the virtual resource response request sent by the receiving terminal corresponding to the virtual resource processing request, receiving the contract execution request sent by the server based on the contract address includes: When receiving the virtual resource response request sent by the receiving terminal, performing a request legitimacy verification on the virtual resource response request to obtain a legitimacy verification result; In response to the legitimacy verification result being a passed verification, the contract address is carried in the contract execution request, and a virtual interface of the smart contract virtual machine is obtained; The contract execution request sent by the server is received through the virtual interface.

8. The method according to claim 7, It is characterized in that The virtual resource response request includes the contract address and the identity information of the receiving terminal; When receiving the virtual resource response request sent by the receiving terminal, performing a validity verification on the virtual resource response request to obtain a validity verification result includes: When receiving the virtual resource response request sent by the receiving terminal, parsing the virtual resource response request to obtain the contract address and the identity information; Performing identity authentication on the receiving terminal based on the identity information to obtain an identity authentication result; Performing request legitimacy verification on the virtual resource response request based on the contract address to obtain a request legitimacy verification result; Among them, the identity authentication result and the request legitimacy verification result constitute the legitimacy verification result.

9. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: In response to the contract execution result being that the virtual resource is successfully received, obtaining the receiving terminal's receiving record information; The collection record information is stored in a preset storage unit.

10. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: In response to not receiving a virtual resource response request sent by a receiving terminal corresponding to the virtual resource processing request within a preset time period, generating an expiration processing request based on the contract address by the server; Receiving the expiration processing request sent by the server; In response to the expiration processing request, executing the expiration processing function in the virtual resource contract corresponding to the contract address to obtain an expiration processing result; The expiration processing result is sent to the server, so that the server generates expiration prompt information based on the expiration processing result, and sends the expiration prompt information to the initiating terminal and the receiving terminal.

11. A virtual resource processing device based on blockchain, It is characterized in that The device comprises: A first receiving module, configured to receive a virtual resource parameter sent by a server, wherein the virtual resource parameter is data carried in a virtual resource processing request sent by an initiating terminal to the server; A contract registration module, used to register a virtual resource contract in a blockchain network based on the virtual resource parameters, and generate a contract address for uniquely identifying the virtual resource contract; A first sending module, used to send the contract address of the virtual resource contract to the server; The first receiving module is further configured to receive a contract execution request sent by the server based on the contract address when the server receives a virtual resource response request sent by a receiving terminal corresponding to the virtual resource processing request; The processing module is used to respond to the contract execution request, execute the virtual resource contract, obtain the contract execution result, and send the contract execution result to the server.

12. An electronic device, It is characterized in that include: A memory for storing executable instructions; The processor is used to implement the blockchain-based virtual resource processing method described in any one of claims 1 to 10 when executing the executable instructions stored in the memory.

13. A computer-readable storage medium, It is characterized in that Executable instructions are stored, which are used to cause the processor to execute the executable instructions to implement the blockchain-based virtual resource processing method described in any one of claims 1 to 10.