CN109559228B - Resource transfer method, device, computer equipment and readable storage medium - Google Patents
Resource transfer method, device, computer equipment and readable storage medium Download PDFInfo
- Publication number
- CN109559228B CN109559228B CN201811446276.7A CN201811446276A CN109559228B CN 109559228 B CN109559228 B CN 109559228B CN 201811446276 A CN201811446276 A CN 201811446276A CN 109559228 B CN109559228 B CN 109559228B
- Authority
- CN
- China
- Prior art keywords
- resource
- order
- account address
- contract
- target virtual
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/018—Certifying business or products
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Development Economics (AREA)
- Technology Law (AREA)
- Entrepreneurship & Innovation (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention discloses a resource transfer method, a resource transfer device, computer equipment and a readable storage medium, and belongs to the technical field of networks. According to the embodiment of the invention, the resource orders in real life are converted into the virtual resources and the contract data in the block chain system by using the block chain, and the transfer of the virtual resources is constrained by using the transfer conditions in the contract data.
Description
Technical Field
The present invention relates to the field of network technologies, and in particular, to a resource transfer method, an apparatus, a computer device, and a readable storage medium.
Background
In recent years, industries such as tourism, culture, sports and the like are rapidly developed, and the development in the culture industry is particularly prominent. The box office is one of the measurement standards of the film quality, and the objective box office record can reflect the real film quality, not only honors the art, but also marks the influence degree of a film on social and mental culture.
The current method for counting the box-office can be to count the total amount of the movie tickets sold, to count the box-office according to the uniform unit price of the movie tickets, and after the movie cities finish the business in the same day, the ticketing system directly reports the data of the box-office in the same day to the movie data system, and finally the data processing system of the movie records the result, so as to obtain the box-office record.
However, the foregoing box-office statistical method fluctuates with the price of the movie ticket, and deviation is likely to occur during statistics, for example, when a movie theater has a special offer, the uniform unit price of the movie ticket is lower than the price of the ticket actually sold, and the foregoing statistical method ignores the special offer price, which may result in a higher box-office.
Disclosure of Invention
The embodiment of the invention provides a resource transfer method, a resource transfer device, computer equipment and a readable storage medium, which ensure the accuracy of virtual resource statistics and avoid false statistics. The technical scheme is as follows:
in one aspect, a resource transfer method is provided, where the method is applied to a node device in a blockchain system, and the method includes:
acquiring transaction data of a first resource order, wherein the first resource order corresponds to a resource;
generating target virtual resources in a user account address corresponding to the first resource order according to the transaction data, wherein the quantity of the target virtual resources corresponds to the order denomination in the transaction data;
generating first contract data in the blockchain system, the first contract data including the transaction data, a first contract account address, and transfer conditions for the target virtual resource, the first contract account address being used to provide virtual resource storage services for the first resource order;
transferring the target virtual resource from the user account address into the first contract account address;
and when the order state of the first resource order meets the transfer condition of the target virtual resource in the first contract data, transferring the target virtual resource in the first contract account address to the account address of the resource.
In one aspect, a resource query method is provided, which is applied to a node device in a blockchain system, and includes:
receiving a first query request, wherein the query request carries a resource identifier to be queried;
mapping the resource identifier carried by the first query request to a resource account address in a block chain system to obtain a second query request;
responding to the second query request, and acquiring the virtual resource allowance in the resource account address;
and outputting a query result based on the virtual resource allowance.
In one aspect, an apparatus for resource transfer is provided, where the apparatus is applied to a node device in a blockchain system, and the apparatus includes:
an acquisition module for acquiring transaction data of a first resource order, the first resource order corresponding to a resource;
a generating module, configured to generate a target virtual resource in a user account address corresponding to the first resource order according to the transaction data, where the number of the target virtual resource corresponds to an order denomination in the transaction data;
the generation module is further configured to generate first contract data in the blockchain system, where the first contract data includes the transaction data, a first contract account address, and a transfer condition of the target virtual resource, and the first contract account address is used to provide virtual resource storage service for the first resource order;
a transfer module for transferring the target virtual resource from the user account address to the first contract account address;
the transfer module is further configured to transfer the target virtual resource in the first contract account address to the account address of the resource when the order status of the first resource order satisfies a transfer condition of the target virtual resource in the first contract data.
In one aspect, a computer device is provided, which includes a processor and a memory, where at least one instruction is stored, and the instruction is loaded and executed by the processor to implement the operations performed by the resource transfer method or the resource query method.
In one aspect, a computer-readable storage medium is provided, in which at least one instruction is stored, and the instruction is loaded and executed by the processor to implement the operations performed by the resource transfer method or the resource query method.
The technical scheme provided by the embodiment of the invention has the beneficial effects that at least:
according to the embodiment of the invention, the resource orders in real life are converted into the virtual resources and the contract data in the block chain system by using the block chain, and the transfer of the virtual resources is constrained by using the transfer conditions in the contract data.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a virtual resource statistics system according to an embodiment of the present invention;
FIG. 2 is a flowchart of a resource transfer method according to an embodiment of the present invention;
FIG. 3 is a flowchart of a resource transfer method according to an embodiment of the present invention;
FIG. 4 is a flowchart of a resource query method according to an embodiment of the present invention;
FIG. 5 is an exemplary diagram of movie box office based statistics provided by embodiments of the present invention;
fig. 6 is a schematic structural diagram of a resource transfer apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a resource query apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Fig. 1 is a schematic structural diagram of a virtual resource statistics system according to an embodiment of the present invention, and referring to fig. 1, the virtual resource statistics system includes a plurality of node devices 101 and a target server 102, where the node devices 101 may be configured with a same blockchain, that is, the node devices 101 may form a blockchain system. The plurality of node devices 101 may belong to the same operation entity, or may belong to different operation entities, which is not limited in the embodiment of the present invention.
In an embodiment, the node device 101 in the virtual resource statistics system may be a node device on an order side, that is, the node device is a server of an order system, and the node device may generate a resource order based on an order placing operation, a payment operation, and the like of a user of the order system, and perform a series of processing based on the current resource order in a block chain system based on order generation information of the resource order to associate the current resource order with a corresponding resource.
In an embodiment, the node device 101 in the virtual resource statistics system may be associated with an order system, that is, after the order system generates a resource order, the order generation information of the resource order may be sent to the associated node device, and the node device may perform a series of processing based on the current resource order in the blockchain system based on the order generation information of the resource order, so as to associate the current resource order with a corresponding resource.
In an embodiment, the node device 101 in the virtual resource statistics system may not be associated with an order system, and after the order system generates a resource order, the order generation information of the resource order may be sent to the virtual resource statistics system, and received by any node device in the virtual resource statistics system, and after receiving the order generation information, the node device may perform a series of processing based on the current resource order in the block chain system based on the order generation information of the resource order, so as to associate the current resource order with a corresponding resource.
For the node device in any of the above embodiments, after receiving the order generation information, the order generation information is converted into transaction data of the resource order, and the blockchain system can store the transaction data into the blockchain through a consensus mechanism by broadcasting in the blockchain system, further, the node device can generate contract data according to the transaction data to implement a function of transferring virtual resources related to the transaction data, and the contract data can automatically execute a contract program according to a specific condition (such as any kind of operation behavior), which is an important way to implement business logic by using the blockchain. Further, each node device may further perform processing such as contract invalidation and virtual resource invalidation on the generated contract and the generated virtual resource based on the order unsubscribing information when receiving the order unsubscribing information.
The target server 102 is configured to verify authenticity of the transaction data and the unsubscribe data based on the stored information related to the resource order, so as to provide a trigger condition for contract data associated with the transaction data or the unsubscribe data on the blockchain system, thereby implementing transfer or invalidation of the virtual resource. The information related to the resource order stored in the target server 102 may be provided by an order system, for example, when the order system sends the order generation information of the resource order to the node device, the order generation information of the resource order or the resource order may be sent to the target server. It should be noted that the sending of the order system to the node device and the target server may be simultaneous sending, or may be sending at a certain time interval, where the time interval is set as long as the target server already stores the relevant information of the corresponding resource order before the node device starts to request the verification of the order, and the specific time interval is not limited in the embodiment of the present invention.
For any resource order transaction initiator, the node device of the virtual resource statistics system generates a user account address for the transaction initiator, that is, the user account address of the transaction initiator is generated in the blockchain system, so as to uniquely identify the resource order.
For any resource issuer, when a resource is issued or online, a resource issuing request may be sent to the virtual resource statistics system, where the resource issuing request may carry a resource identifier of a resource to be issued, for example, a movie number (e.g., an IMDB number), and of course, a place identifier of the resource (e.g., a movie theater number), and when the virtual resource statistics system receives the resource issuing request, an account address in the block chain system may be generated for the resource, that is, a corresponding account address is generated for the resource identifier in the block chain system, and then a mapping relationship between the account address and the resource identifier is established, so that subsequent transaction data related to the resource may be transferred based on the account address of the resource, and then corresponding resource statistics may be performed. For example, for a movie, the issued resource may be a corresponding account address maintained in the blockchain system for the movie, and the amount of virtual resources (e.g., the number of coins) stored in the account address is the box office statistics of the movie.
Fig. 2 is a flowchart of a resource transfer method according to an embodiment of the present invention. Referring to fig. 2, the method may be applied to a node device in a blockchain system, and the method includes:
201. the first node device receives order generation information of a first resource order, wherein the first resource order corresponds to a resource.
The order completion information comprises a user identifier for initiating order transaction, a user public key, resource information of resources, an order number, an order denomination and a transaction flow identifier. The user identifier may be a user identifier used by the user when placing an order, the resource may refer to any resource to be counted, and the resource information may refer to a resource identifier (e.g., a resource number) of the resource, an effective time (e.g., a playing time of a movie), a location identifier (e.g., a number of a movie theater) of the resource, and so on. The order number may refer to information used in an order system to uniquely identify the order, the order denomination may be used to indicate actual consumption of the resource, and the transaction flow identifier may refer to a bank flow identifier or a flow identifier of any transaction platform, and is used to uniquely identify resource conversion of the resource order.
For example, when a User1 purchases a movie ticket for movie "XXX" on a ticket purchasing platform, the server of the ticket purchasing platform may send ticket purchasing information (i.e., order generation information) of the User1 to a virtual resource statistics system after the transaction is successful, and a node device, such as a first node device, in the virtual resource statistics system receives the ticket purchasing information.
202. The first node device converts the user identifier of the transaction initiator in the order generation information into a user account address in the blockchain system to obtain transaction data of the first resource order.
In one possible implementation, the transaction data includes an account address of a user initiating the transaction for the order, an account address of a resource corresponding to the first resource order, a location identification of the resource, and a transaction flow identification.
In the embodiment of the invention, for any transaction party, the blockchain system allocates a user account address to the transaction party so as to perform related transactions in the blockchain system based on the user account address. When the node device acquires the order generation information, the user identifier may be extracted, and a user account address may be randomly generated for the user identifier, and of course, the node device may also acquire the user account address having a mapping relationship with the user identifier according to the user identifier. Optionally, for the resource information of the resource in the order generation information, the node device may also convert the resource information to obtain an account address of the resource, so as to perform resource transfer subsequently. Of course, in order to ensure uniformity of data representation in the blockchain system, other data in the order information may be correspondingly converted, which is not specifically limited in the embodiment of the present invention.
203. The first node device broadcasts transaction data of the first resource order in a blockchain system.
The first node device may propagate the transaction data to a plurality of second node devices in the blockchain system in a broadcast manner, and after receiving the transaction data of the first resource order, each second node device may participate in a subsequent consensus process based on the transaction data of the first resource order.
204. The first node device generates a target virtual resource in the user account address corresponding to the first resource order according to the transaction data, and executes steps 205 and 206, where the amount of the target virtual resource corresponds to the order denomination in the transaction data.
The step 204 may specifically include: and generating target virtual resources according to the order denomination in the transaction data, and storing the target virtual resources into the user account address, wherein the quantity of the target virtual resources is equal to the order denomination. For the purpose of virtual resource statistics, after any resource order is generated, the first node device may generate a virtual resource equal to the order denomination for the resource order in the blockchain system. Of course, to avoid the number of statistical hours being too large, the amount of the target virtual resource corresponds to the order denomination in the transaction data, e.g., the amount of the target virtual resource is proportional to the order denomination. For example, if the movie ticket is 100 yuan, the number of generated movie coins is 10 according to the ratio of 10: 1.
The order denomination in the transaction data is represented by the number of the target virtual resources, so that the actual denomination of the order can be reflected by the virtual resource number counted in the block chain system, the virtual resource number counted subsequently is accurate, and the condition of inaccurate counting due to price floating is avoided.
In a possible implementation manner, after the target virtual resource is generated, the generation information of the target virtual resource may also be broadcast to other node devices, and verification of the basis is performed by each node device, and after the verification passes, the verification process in step 206 may be performed to determine the validity of the generation of the virtual resource.
205. The first node device generates first contract data in the blockchain system, the first contract data including the transaction data, a first contract account address and transfer conditions of the target virtual resource, the first contract account address being used to provide virtual resource storage services for the first resource order.
The resource related to the embodiment of the invention has certain timeliness, that is, after the booking action occurs, the scheduled participation right of a certain activity which is started to be performed at a certain future time point is the participation right of the certain activity, and then, before the time point is reached, the condition of unsubscribing is possible to occur, so that based on the resource characteristic, corresponding steps can be executed on the basis of the processing of the resource order through an intelligent contract on a block chain.
The first contract account address in the embodiment of the present invention may be a contract account address generated for the first contract data, where the first contract account address is used to provide a virtual resource storage service for the first resource order, and the first contract account address refers to: the first contract account address is used for temporarily storing the transferred target virtual resource and executing the transfer-out operation or the invalidation operation of the target virtual resource according to the state of the first resource order corresponding to the first contract data.
It should be noted that the first contract account address may also be a certain pre-generated contract account address in the blockchain system, and for any resource order, the corresponding contract account addresses are the same, and each resource order shares one contract account address, thereby avoiding waste of address resources.
In this embodiment of the present invention, the transfer condition of the target virtual resource may be: when the resource playing time in the first resource order is reached, the order state of the first resource order is order valid. That is, before the resource playing time in the first resource order is reached, the unsubscribe data of the first resource order is not received, and then the resource transferring step is executed. The transfer condition can restrict the resource transfer, and the resource transfer can be carried out only if the resource order is still valid and is not unsubscribed during the resource playing time, thereby avoiding data counterfeiting. Taking a movie box office as an example, through the constraint of the first contract data on the transfer conditions, if someone refunds a ticket by using the time difference between the buying ticket and the opening, the buying ticket of the time cannot be counted, so that false box offices can be avoided, and real box offices can be reflected.
Of course, the first contract data may also include an order status, e.g., when the unsubscribe data is received, the order status in the first contract data is placed in the unsubscribed status to indicate that the resource order has been unsubscribed.
206. The first node device sends a first verification request to a target server, the first verification request is used for requesting verification of the first resource order, and the target server stores the generated first resource order.
207. When the target server receives the first verification request, the first resource order is verified, and when the target server passes the verification of the first resource order, the target server sends a verification passing message to the first node device.
208. And when the first node equipment receives the verification passing message, transferring the target virtual resource from the user account address to the first contract account address.
In a possible implementation manner, the target server may verify according to the stored transaction flow identifier of the first resource order, and when the transaction flow identifier of the first resource order carried in the first verification request is the same as the stored transaction flow identifier of the first resource order, it is determined that the first resource order is a real order, and a verification passing message is returned to the first node device, so that the first node device may perform transfer of the target virtual resource, and the first contract account address performs an intermediate function, and may temporarily store the target virtual resource. If the transaction flow identifiers are different, the resource order is not a real order, and the first node device does not perform the step of transferring the target virtual resource to the first contract account address, so that the condition of inaccuracy in statistics is avoided. Optionally, the verification process may include: the target server extracts the order identification and the transaction flow identification carried in the first verification request, acquires the related information corresponding to the order identification from the stored related information of the resource order according to the order identification, and compares the transaction flow identification carried in the first verification request with the transaction flow identification in the related information corresponding to the order identification. Of course, the verification may also be performed through an order identifier, for example, the target server may verify the order identifier carried in the first verification request, and when the target server already stores the order identifier carried in the first verification request, it is determined that the first resource order is a real order, and a verification passing message is returned to the first node device.
It should be noted that, in the blockchain system, any node device that receives the transaction data may perform the verification process of the above steps 206 to 208, so as to verify the authenticity of the transaction data received by the own lock.
The verification through the transaction flow identification or the order identification can avoid the influence of means such as ticket swiping on the virtual resource statistical process, and greatly improve the statistical accuracy. Of course, in a possible implementation manner, the step of transferring the target virtual resource to the first contract account address may be directly performed without performing the verification process described above, so as to simplify the overall virtual resource statistics flow.
209. And when the order state of the first resource order meets the transfer condition of the target virtual resource in the first contract data, transferring the target virtual resource in the first contract account address into the account address of the resource.
The order state comprises an order effective state and an order unsubscribing state, if the order state is the order effective state, the order state is determined to meet the transfer condition of the target virtual resource in the first contract data, the target virtual resource corresponding to the order state is real and effective, and the target virtual resource in the first contract account address can be transferred to the account address of the resource.
The process of determining whether the order state meets the transfer condition may have various implementation manners, for example, when the resource playing time of the resource is reached, each contract data associated with the resource may be polled to determine whether the order state meets the transfer condition in the contract data, and for example, an order state table may be maintained for each resource, when the order data is received before the resource playing time of the resource is reached, the order state of each resource order in the order state table is marked based on the order data, and when the resource playing time of the resource is reached, the order state table may be queried to determine whether the order state meets the transfer condition in the contract data, which is not specifically limited in the embodiment of the present invention.
In order to avoid the abuse of virtual resources, in the blockchain system, the user account address initiating the order transaction does not have the function of virtual resource transfer to account addresses other than the first contract account address, except the function of storing the target virtual resources and performing virtual resource transfer to the first contract account address, that is, the user account address can only perform the one-time transfer as the order initiating transaction party, the transferred target account can only be the first contract account address, in order to avoid the abuse of virtual resources in the user address by the resource issuer, after the account address of the resource is generated, the public key of the account address is only stored on the resource issuer side without storing the private key thereof, the confirmation of the private key is lacked, and the account address of the resource does not have the function of transferring out the virtual resources, without any roll-out transactions.
The transaction data storage process of the blockchain system also relates to a consensus process, for example, a block is generated by packaging the transaction data and a chain linking process after the block consensus passes, the packaging and other processes can be realized by adopting any consensus mechanism, and detailed description is omitted in the present invention.
According to the embodiment of the invention, the resource orders in real life are converted into the virtual resources and the contract data in the block chain system by using the block chain, and the transfer of the virtual resources is constrained by using the transfer conditions in the contract data. Furthermore, the real-time order denomination is reflected by the quantity of the virtual resources, so that the statistics of the virtual resources is based on real-time transaction, and the accuracy of the statistics is further improved. Furthermore, verification of authenticity of the resource order based on the transaction flow identification is provided, influence of manual means is avoided, and accuracy of virtual resource statistics can be provided.
In the above embodiment, it is described by taking an example that the first resource order is not unsubscribed, that is, if the order status of the first resource order is that the order is valid, the target virtual resource is transferred to the account address of the resource, and in some embodiments, an order unsubscribe may occur, and for such a case, the following description takes an embodiment shown in fig. 3 as an example:
301. the second node device receives an unsubscribe request for the second resource order.
The order identifier of the second resource order is at least carried by the unsubscribe request, and the second node device can query second contract data corresponding to the order identifier according to the order identifier.
The second node device may be a server of the ticket ordering system, that is, the user may initiate a ticket ordering action for the second resource order through the ticket ordering system, so as to trigger an unsubscribe request of the second resource order. Of course, the second node device may not belong to the booking system, but perform step 302 based on the unsubscribe request sent by the booking system, and is not limited in this respect.
302. And the second node equipment initiates a cancellation transaction of the second resource order according to the cancellation request, wherein a target transaction account of the cancellation transaction is a second contract account address, and the second contract account address is used for providing virtual resource storage service for the second resource order.
The initiator of the unsubscribe transaction may be a user account address in the second resource order and the recipient may be a second contract account address in second contract data corresponding to the second resource order. The second node device may generate a preset number of virtual resources upon receiving the unsubscribe request, and initiate an unsubscribe transaction based on the generated virtual resources. It should be noted that the virtual resource does not represent any actual value, but is only used to express a certain amount in the blockchain system.
For example, when the user refunds the ticket, the second node device automatically generates a 0.01 shadow, initiating a transaction to the second contract account address.
It should be noted that the first contract account address and the second contract account address may be the same address, that is, one contract account address may be shared for any resource order, so as to ensure that a specific transaction target account can be determined when initiating an unsubscribe transaction. Of course, the second contract account address may also be different from the first contract account address, which is not limited in this embodiment of the present invention.
303. The second node device broadcasts the unsubscribe transaction in the blockchain system, and other node devices in the blockchain system receive the unsubscribe transaction and perform a consensus process on the unsubscribe transaction.
304. And when the blockchain system passes the identification of the unsubscribed transaction, sending a second verification request to a target server, wherein the second verification request is used for requesting the verification of the second resource order.
305. And when the target server receives the second verification request, verifying the second resource order, and when the target server passes the verification of the second resource order, sending a verification passing message to the second node equipment by the target server.
The information carried in the second authentication request may be the same as the information carried in the first authentication request, which is not limited in the embodiment of the present invention. The verification process of the steps 304 to 305 is similar to that in the above embodiments, and will not be described herein.
306. And after receiving the verification passing message, the second node equipment verifies the unsubscribed transaction according to the second contract data.
Because the transaction data of the resource order is stored in the second contract data, the unsubscribed transaction can be further verified based on the second contract data to ensure that no statistical errors occur, optionally, information such as a transaction initiator of the unsubscribed transaction can be compared with the transaction data in the second contract data, when the comparison is consistent, for example, the user account addresses are the same, the transaction flow identifiers are the same, and the resource information is the same, the unsubscribed transaction is determined to be verified to be passed, if any item of information is different, the virtual resource tampering condition may occur, the unsubscribed transaction is recorded to trace the tampering behavior, and the verification is determined to be failed.
307. When the verification is passed, the second node device marks second contract data associated with the second resource order as an unsubscribed state, and invalidates the target virtual resource in the second contract account address of the second contract data.
Because the second contract data stores the transaction data of the resource order, the unsubscribed transaction can be further verified based on the second contract data to ensure that no statistical errors occur, optionally, information such as a transaction initiator of the unsubscribed transaction can be compared with the transaction data in the second contract data, when the comparison is consistent, for example, the user account addresses are the same, the transaction flow identifiers are the same, and the resource information is the same, it is determined that the unsubscribed transaction is verified to be passed, the order state in the second contract data can be set as the unsubscribed state, and the target virtual resource in the second contract account address is invalidated to avoid the target virtual resource from being counted incorrectly.
By the resource transfer method, the transfer of the virtual resources to the account addresses of the resources can be realized, so that the virtual resources belonging to a certain resource can be collected, and therefore, a real-time query method can also be provided, which is introduced by the process shown in fig. 4 as follows:
401. and the third node equipment receives a first query request, wherein the query request carries the resource identifier to be queried.
The resource identifier is used for uniquely identifying one resource, and the resource identifier may be in any expression mode, which is not limited in the embodiment of the present invention.
402. And the third node equipment maps the resource identifier carried by the first query request into a resource account address in a block chain system to obtain a second query request.
Since the virtual resource amount of each resource is maintained in the blockchain system in the form of a resource account address, the third node device may convert the first query request in a mapping manner to obtain a second query request applicable to the blockchain system.
403. And the third node equipment responds to the second query request and acquires the virtual resource allowance in the resource account address.
The third node device may perform query on the blockchain of the blockchain system according to the resource account address carried in the second query request to obtain the virtual resource allowance of the resource account address, and certainly, when an account table is maintained on the third node device, query may also be performed from the account table based on the resource account address, since the account balance maintained in the account table is updated based on the data stored in the block that has passed through in common recognition, the data in the account table also has a characteristic of being not falsified, and the accuracy of the virtual resource allowance can be ensured, which is not specifically limited in the embodiment of the present invention.
404. The third node device outputs a query result based on the virtual resource margin.
The third node device may provide the query result for the user based on the virtual resource margin obtained by the query, so as to provide the query of the virtual resource for the user in real time and intuitively.
Of course, for the third node device, the query of the resource account address may be based on a certain authority, for example, if the query authority is public, any user may obtain a statistical result of the virtual resource through the query, and if the query authority is only directed to a certain user, for example, an issuer user of the resource, the process of verifying the authority and the like may also be involved in the query, which is not described in detail in the embodiment of the present invention.
The query process provides a real-time accurate virtual resource query method, and the authenticity and reliability of query can be ensured due to the non-falsification characteristic of the block chain system.
All the above-mentioned optional technical solutions can be combined arbitrarily to form the optional embodiments of the present invention, and are not described herein again.
For more clearly explaining the present invention, the overall implementation flow of the resource transfer method is described as an example below, referring to fig. 5, where fig. 5 is a movie ticket as an example, when a movie distributor issues a movie, the movie distributor may issue the movie through a client with a movie box office function to create a movie account address of the movie, and a user may purchase a ticket through the client with an order function, so that generation of a movie coin and a contract is triggered through the order function, transaction data generated in the above process may be stored in a block chain, and generation of a movie coin may also be confirmed through interaction between the block chain and a verification function, and when a user performs a logoff, the client with the order function may perform a logoff, and trigger an intelligence to change an order state and invalidate the generated movie coin, in this process, the checking function module also verifies the order which is unsubscribed based on the instruction of the block chain. Of course, if the user normally views the film and does not trigger the unsubscription, when the film opening time is reached, the film money can be transferred to the film account address, and the film issuer can perform the box office query through the film box office function, so that the real-time box office is obtained based on the account balance in the film account address.
Fig. 6 is a schematic structural diagram of a resource transfer apparatus according to an embodiment of the present invention, applied to a node device in a block chain system, and referring to fig. 6, the apparatus includes:
an obtaining module 601, configured to obtain transaction data of a first resource order, where the first resource order corresponds to a resource;
a generating module 602, configured to generate a target virtual resource in a user account address corresponding to the first resource order according to the transaction data, where the amount of the target virtual resource corresponds to an order denomination in the transaction data;
the generating module 602 is further configured to generate first contract data in the blockchain system, where the first contract data includes the transaction data, a first contract account address, and a transfer condition of the target virtual resource, and the first contract account address is used to provide virtual resource storage service for the first resource order;
a transfer module 603, configured to transfer the target virtual resource from the user account address to the first contract account address;
the transfer module 603 is further configured to transfer the target virtual resource in the first contract account address to the account address of the resource when the order status of the first resource order satisfies the transfer condition of the target virtual resource in the first contract data.
Optionally, the generating module 602 is configured to generate a target virtual resource according to the order denomination in the transaction data, and store the target virtual resource in the user account address, where the number of the target virtual resource is equal to the order denomination.
Optionally, the obtaining module 601 is configured to receive order generation information of the first resource order; and converting the user identification of the transaction initiator in the order generation information into a user account address in the blockchain system to obtain the transaction data of the first resource order.
Optionally, the apparatus further includes a first verification module, configured to send a first verification request to a target server, where the first verification request is used to request verification of the first resource order, and the target server stores the generated first resource order;
when the target server verifies the first resource order, performing the step of transferring the target virtual resource from the user account address to the first contract account address.
Optionally, the transfer condition of the target virtual resource is: and when the resource playing time in the first resource order is reached, the order state of the first resource order is that the order is valid.
Optionally, the apparatus further comprises: the unsubscribing module is used for receiving an unsubscribing request of the second resource order; initiating a de-subscription transaction of the second resource order according to the de-subscription request, wherein a target transaction account of the de-subscription transaction is a second contract account address, and the second contract account address is used for providing virtual resource storage service for the second resource order; marking second contract data associated with the second resource order as a unsubscribed state based on the unsubscribed transaction, and voiding the target virtual resource in the second contract account address.
Optionally, the apparatus further comprises: the second verification module is used for sending a second verification request to the target server, wherein the second verification request is used for requesting to verify the second resource order; when the target server verifies the second resource order, the step of marking second contract data associated with the second resource order as a unsubscribed state and invalidating the target virtual resource in the second contract account address based on the unsubscribed transaction is executed.
Optionally, the apparatus further includes a third verification module, configured to verify the unsubscribe data according to the second contract data, and when the verification is passed, perform the step of marking the second contract data associated with the second resource order as an unsubscribed state based on the unsubscribed transaction, and revoking the target virtual resource in the second contract account address.
Optionally, the transaction data includes an account address of a user initiating an order transaction, an account address of a resource corresponding to the first resource order, a location identifier of the resource, and a transaction flow identifier.
Optionally, the user account address initiating the order transaction has only functionality to transfer the target virtual resource into the first contract account address; the account address of the resource only has the function of accepting the transfer of the virtual resource.
It should be noted that: in the resource transfer device provided in the foregoing embodiment, only the division of the functional modules is illustrated in the foregoing, and in practical applications, the function allocation may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the embodiments of the resource transfer method provided by the foregoing embodiments belong to the same concept, and specific implementation processes thereof are described in the embodiments of the method for details, which are not described herein again.
Fig. 7 is a schematic structural diagram of a resource query apparatus according to an embodiment of the present invention, applied to a node device in a block chain system, and referring to fig. 7, the apparatus includes:
a receiving module 701, configured to receive a first query request, where the query request carries a resource identifier to be queried;
a mapping module 702, configured to map the resource identifier carried in the first query request to a resource account address in a blockchain system, so as to obtain a second query request;
an obtaining module 703, configured to obtain, in response to the second query request, a virtual resource allowance in the resource account address;
an output module 704, configured to output a query result based on the virtual resource allowance.
Optionally, the apparatus further includes a publishing module, configured to receive a resource publishing request, where the resource publishing request carries a resource identifier; generating a resource account address corresponding to the resource identifier in a blockchain system; and establishing a mapping relation between the resource account address and the resource identifier.
Fig. 8 is a schematic structural diagram of a computer device 800 according to an embodiment of the present invention, where the computer device 800 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 801 and one or more memories 802, where the memory 802 stores at least one instruction, and the at least one instruction is loaded and executed by the processors 801 to implement the methods provided by the method embodiments. Certainly, the computer device may further have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input and output, and the computer device may further include other components for implementing the functions of the device, which is not described herein again.
In an exemplary embodiment, there is also provided a computer readable storage medium, such as a memory, comprising instructions executable by a processor in a terminal to perform the resource transfer method or the resource query method in the above embodiments. For example, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present invention and should not be taken as limiting the invention, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (14)
1. A resource transfer method is applied to a node device in a blockchain system, and the method comprises the following steps:
acquiring transaction data of a first resource order, wherein the first resource order corresponds to a resource;
generating target virtual resources in a user account address corresponding to the first resource order according to the transaction data, wherein the quantity of the target virtual resources corresponds to the order denomination in the transaction data;
generating first contract data in the blockchain system, the first contract data including an order status of the first resource order, the trade data, a first contract account address, and a transfer condition of the target virtual resource, the first contract account address being used to provide virtual resource storage services for the first resource order;
transferring the target virtual resource from the user account address into the first contract account address;
when the order state of the first resource order is order effective, transferring the target virtual resource in the first contract account address to the account address of the resource, wherein when the resource playing time in the first resource order is reached, the order state of the first resource order is order effective;
and when the order state of the first resource order is an unsubscribed state, invalidating the target virtual resource in the first contract account address, wherein the unsubscribed state is used for indicating that the first resource order is unsubscribed.
2. The method of claim 1, wherein generating, according to the transaction data, a target virtual resource in a user account address corresponding to the first resource order, the amount of the target virtual resource corresponding to an order denomination in the transaction data comprises:
and generating target virtual resources according to the order denomination in the transaction data, and storing the target virtual resources into the user account address, wherein the number of the target virtual resources is equal to the order denomination in the transaction data.
3. The method of claim 1, wherein the obtaining transactional data for a first resource order comprises:
receiving order generation information of the first resource order;
and converting the user identification of the transaction initiator in the order generation information into a user account address in the blockchain system to obtain the transaction data of the first resource order.
4. The method of claim 1, further comprising:
sending a first verification request to a target server, wherein the first verification request is used for requesting to verify the first resource order, and the target server stores the generated first resource order;
when the target server verifies the first resource order, performing the step of transferring the target virtual resource from the user account address to the first contract account address.
5. The method of claim 1, further comprising:
receiving an unsubscribe request of a second resource order;
initiating a de-subscription transaction of the second resource order according to the de-subscription request, wherein a target transaction account of the de-subscription transaction is a second contract account address, and the second contract account address is used for providing virtual resource storage service for the second resource order;
marking second contract data associated with the second resource order as a unsubscribed state based on the unsubscribed transaction, and voiding the target virtual resource in the second contract account address.
6. The method of claim 5, further comprising:
sending a second verification request to a target server, wherein the second verification request is used for requesting to verify the second resource order;
when the target server verifies the second resource order, the step of marking second contract data associated with the second resource order as a unsubscribed state and invalidating the target virtual resource in the second contract account address based on the unsubscribed transaction is executed.
7. The method of claim 5, further comprising:
and verifying the unsubscribe data according to the second contract data, and when the verification is passed, executing the steps of marking the second contract data associated with the second resource order as an unsubscribed state and invalidating the target virtual resource in the second contract account address based on the unsubscribe transaction.
8. The method of claim 1, wherein the transaction data comprises an account address of a user initiating an order transaction, an account address of a resource corresponding to the first resource order, a location identifier of the resource, and a transaction flow identifier.
9. The method of claim 1, wherein the user account address does not have a function of virtual resource transfer to an account address other than the first contract account address; the account address of the resource does not have a virtual resource roll-out function.
10. A resource query method applied to a node device in a blockchain system includes:
receiving a first query request, wherein the query request carries a resource identifier to be queried, and the resource identifier is used for uniquely identifying a resource;
mapping the resource identifier carried by the first query request to a resource account address in a block chain system to obtain a second query request;
in response to the second query request, obtaining a virtual resource margin in the resource account address, where the virtual resource in the resource account address includes a target virtual resource transferred from first contract data, and the first contract data includes an order status of a first resource order, transaction data, a first contract account address, and a transfer condition of the target virtual resource, where the target virtual resource in the first contract account address is transferred into the account address of the resource when the order status of the first resource order is order valid, and the target virtual resource in the first contract account address is invalidated when the order status of the first resource order is unsubscribed, and the first contract account address is used to provide a virtual resource storage service for the first resource order, and when a resource play time in the first resource order is reached, the order state of the first resource order is order effective, and the unsubscribe state is used for indicating that the first resource order is unsubscribed;
and outputting a query result based on the virtual resource allowance.
11. The method of claim 10, further comprising:
receiving a resource issuing request, wherein the resource issuing request carries a resource identifier;
generating a resource account address corresponding to the resource identifier in the blockchain system;
and establishing a mapping relation between the resource account address and the resource identifier.
12. An apparatus for resource transfer, applied to a node device in a blockchain system, the apparatus comprising:
an acquisition module for acquiring transaction data of a first resource order, the first resource order corresponding to a resource;
a generating module, configured to generate a target virtual resource in a user account address corresponding to the first resource order according to the transaction data, where the number of the target virtual resource corresponds to an order denomination in the transaction data;
the generation module is further configured to generate first contract data in the blockchain system, where the first contract data includes an order status of the first resource order, the transaction data, a first contract account address, and a transfer condition of the target virtual resource, and the first contract account address is used to provide virtual resource storage service for the first resource order;
a transfer module for transferring the target virtual resource from the user account address to the first contract account address;
the transfer module is further configured to transfer the target virtual resource in the first contract account address to the account address of the resource when the order status of the first resource order is that the order is valid, where the order status of the first resource order is that the order is valid when the resource playing time in the first resource order is reached;
the apparatus is further configured to invalidate the target virtual resource in the first contract account address when the order status of the first resource order is an unsubscribed status, where the unsubscribed status is used to indicate that the first resource order has been unsubscribed.
13. A computer device comprising a processor and a memory, the memory having stored therein at least one instruction that is loaded and executed by the processor to perform an operation performed by the resource transfer method of any one of claims 1 to 9 or the resource query method of any one of claims 10 and 11.
14. A computer-readable storage medium having stored therein at least one instruction, which is loaded and executed by a processor to perform an operation performed by the resource transfer method of any one of claims 1 to 9 or the resource query method of any one of claims 10 and 11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811446276.7A CN109559228B (en) | 2018-11-29 | 2018-11-29 | Resource transfer method, device, computer equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811446276.7A CN109559228B (en) | 2018-11-29 | 2018-11-29 | Resource transfer method, device, computer equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109559228A CN109559228A (en) | 2019-04-02 |
CN109559228B true CN109559228B (en) | 2021-06-11 |
Family
ID=65867889
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811446276.7A Active CN109559228B (en) | 2018-11-29 | 2018-11-29 | Resource transfer method, device, computer equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109559228B (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110070435A (en) * | 2019-04-03 | 2019-07-30 | 平安普惠企业管理有限公司 | A kind of data transfering method and relevant device |
CN110221919B (en) * | 2019-05-31 | 2023-08-01 | 创新先进技术有限公司 | Virtual resource allocation method and device based on block chain |
CN110363526A (en) * | 2019-06-21 | 2019-10-22 | 深圳市元征科技股份有限公司 | A kind of information processing method and device |
CN110599323B (en) * | 2019-09-24 | 2024-02-20 | 腾讯科技(深圳)有限公司 | Resource processing method and processing equipment |
CN111738473B (en) * | 2020-07-31 | 2020-12-18 | 支付宝(杭州)信息技术有限公司 | Processing method, device, equipment and system for ticket booking service |
CN114257383B (en) * | 2020-09-10 | 2024-04-12 | 中国电信股份有限公司 | Data processing method, blockchain node and computer readable storage medium |
CN111966538B (en) * | 2020-10-20 | 2021-04-27 | 支付宝(杭州)信息技术有限公司 | Block chain data recovery method and device |
CN112633953B (en) * | 2021-03-08 | 2021-07-06 | 支付宝(杭州)信息技术有限公司 | Service processing method and system based on block chain |
CN116151968A (en) * | 2021-11-22 | 2023-05-23 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and readable storage medium |
CN117176737A (en) * | 2022-05-27 | 2023-12-05 | 腾讯科技(深圳)有限公司 | Block chain-based data processing method, device, equipment and readable storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107220820A (en) * | 2017-05-16 | 2017-09-29 | 腾讯科技(深圳)有限公司 | Resource transfers method, device and storage medium |
CN107301536A (en) * | 2017-06-12 | 2017-10-27 | 腾讯科技(深圳)有限公司 | Resource transfers method and device |
CN107992621A (en) * | 2017-12-22 | 2018-05-04 | 杭州云象网络技术有限公司 | A kind of intelligent cinematic industry service system based on block chain multichain technological incorporation |
CN108074081A (en) * | 2017-12-08 | 2018-05-25 | 上海策赢网络科技有限公司 | The transfer method and device of a kind of virtual resource |
CN108876497A (en) * | 2017-05-11 | 2018-11-23 | 腾讯科技(深圳)有限公司 | Resource transfers method, apparatus and third-party server |
-
2018
- 2018-11-29 CN CN201811446276.7A patent/CN109559228B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108876497A (en) * | 2017-05-11 | 2018-11-23 | 腾讯科技(深圳)有限公司 | Resource transfers method, apparatus and third-party server |
CN107220820A (en) * | 2017-05-16 | 2017-09-29 | 腾讯科技(深圳)有限公司 | Resource transfers method, device and storage medium |
CN107301536A (en) * | 2017-06-12 | 2017-10-27 | 腾讯科技(深圳)有限公司 | Resource transfers method and device |
CN108074081A (en) * | 2017-12-08 | 2018-05-25 | 上海策赢网络科技有限公司 | The transfer method and device of a kind of virtual resource |
CN107992621A (en) * | 2017-12-22 | 2018-05-04 | 杭州云象网络技术有限公司 | A kind of intelligent cinematic industry service system based on block chain multichain technological incorporation |
Also Published As
Publication number | Publication date |
---|---|
CN109559228A (en) | 2019-04-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109559228B (en) | Resource transfer method, device, computer equipment and readable storage medium | |
CN112600841B (en) | Credit record sharing method and device based on block chain and electronic equipment | |
TWI768163B (en) | Method and device for generating smart contracts | |
CN109102269B (en) | Transfer method and device based on block chain, block chain node and storage medium | |
US11636450B2 (en) | Blockchain system to which proof-of-transaction consensus algorithm is applied, and method therefor | |
CN109035019B (en) | Bill transaction method, system, computer device and storage medium | |
CN111444209B (en) | Data processing method, device, equipment and medium based on block chain | |
CN109598147B (en) | Data processing method and device based on block chain and electronic equipment | |
US20190114707A1 (en) | Distribution of Blockchain Tokens | |
CN105719172A (en) | Information issuing method and device | |
CN110852730B (en) | Transaction processing method and device based on digital currency and electronic equipment | |
CN111738725A (en) | Cross-border resource transfer authenticity auditing method and device and electronic equipment | |
WO2020119293A1 (en) | Content pushing method and apparatus, and electronic device | |
CN110263092A (en) | Rent method and device based on block chain | |
CN112232813A (en) | Renewable energy power consumption voucher management method and device based on block chain | |
CN111709817A (en) | Order data processing method and device, computer readable medium and electronic equipment | |
CN113221191A (en) | Block chain-based data evidence storage method, device, equipment and storage medium | |
CN110838067A (en) | Real estate transaction data processing method, device, server and storage medium | |
CN112200568A (en) | Block chain based account creation method and device and electronic equipment | |
CN111737765A (en) | Method and device for managing block chain resources | |
CN115701078B (en) | Cross-chain transaction processing method, device, electronic equipment and storage medium | |
CN110322612B (en) | Business data processing method and device, computing equipment and storage medium | |
CN112418819A (en) | Block chain system for integrity management of building enterprise | |
CN112308563B (en) | Guest-obtaining data processing method and node | |
CN114297293A (en) | Method and system for sharing cash-in record of commercial acceptance draft |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |