Summary of The Invention
The inventor finds that a first specified interface which can be called can be provided at a network node of the block chain network, so that a user can send an export request for exporting user credit to the first specified interface through a client, and the user credit is transferred to an account of the block chain network. After transferring the first user credit to the first account in the blockchain network, the user credit is not left on the server side as spam data. For a user, the user credit can be freely transferred in a wider range of a block chain network, and even if a server side corresponding to a client stops service, the benefit of the user is not damaged, so that better experience is brought to the user.
Having described the general principles of the invention, various non-limiting embodiments of the invention are described in detail below.
Application scene overview
Referring to fig. 1, fig. 1 is a schematic diagram of a network system structure of a possible application scenario according to an embodiment of the present invention. As shown in fig. 1, a first user credit of a user at the network game client 101 may be stored in a primary account of the network game server side 102 at the blockchain network. The user sends a export request for exporting the first user credit to the first account to the network game server side 102 through the network game client side 101. The network game server side 102 issues the export request to the network node 103 of the blockchain network 100 by calling the first designated interface. Network node 103 receives the export request via the first specified interface. Network node 103 broadcasts the export request among other network nodes of block chain network 100. If the network node 103 receives confirmation of the export request by other network nodes, the first user credit involved in the export request is transferred to the first account of the block chain network 100 and the first user credit is deducted from the original account.
One of the exemplary methods
In the following, in connection with the application scenario of fig. 1, a method applied to any network node of a block chain network according to an exemplary embodiment of the present invention is described with reference to fig. 2. It should be noted that the above application scenarios are merely illustrated for the convenience of understanding the spirit and principles of the present invention, and the embodiments of the present invention are not limited in this respect. Rather, embodiments of the present invention may be applied to any scenario where applicable.
In order to make the embodiments of the present invention easier to understand, a brief description of a block chain network is first given. The blockchain network 100 shown in fig. 1 is a Peer-to-Peer network composed of a plurality of network nodes and based on P2P (Peer-to-Peer) technology decentralization. Wherein a network node may appear as an application or client running on top of the terminal device. Each network node in a blockchain network maintains a string of blockchains that are cryptographically related, and a list of accounts. The latest block number and block information are acquired by broadcasting among the network nodes, so that the synchronous maintenance of the block chain and the account list among the network nodes is ensured. For example, the implementation of a blockchain as shown in fig. 2 on program code may be as follows:
struct Block{
hash HASH(S[n])
hash S[n-1]
};
wherein the header in each block of the block chain contains a HASH (S [ n ]), where S [ n ] is the key that will be generated the next time the block is produced. While the current block also contains the key S n-1 of the previous block. Since the user credit transfer history item which is proved to be the owner of the user credit is stored in the confirmed blocks in the block chain, the block head generated later contains the block hash value generated by the previous block and cannot be reversed, and thus, the block chain with the irreversible user credit transfer history is formed.
Next, with reference to fig. 3, a flow of a method for processing user data, which is applied to any network node of a block chain network according to an embodiment of the present invention, is described. As shown in fig. 3, the method may include:
s310, receiving a exporting request sent by a user through a first client through a first designated interface, wherein the exporting request relates to exporting a first user credit of the user at the first client to a first account of the block chain network.
The first specified interface is an application program interface provided by a network node to which the method provided by the embodiment of the present invention is applied, and is an abstraction of functions implemented by the method provided by the embodiment of the present invention. The related definition and the content of the protocol of the first designated interface are not limited. For example, the protocol of the first designated interface may specify data content that the export request should carry, such as a first user credit amount, related information of the first account, such as an account number of the first account, and the like, and a format of the data content, such as a data length, and the like.
Wherein the first user credit of the user at the first client may be saved in the primary account of the block chain network before exporting to the first account. The primary account may be created when the block chain network is initially created, wherein a certain amount of user credit may be set as a base credit.
In some possible embodiments, the owner of the user credit in the primary account may be the server side. When the user gives the first user credit to the user at the first client side through a certain mode, such as an exchange mode, etc., the first user credit is the first user credit of the user at the first client side. Furthermore, the user can send an export request for exporting the first user credit to a first account of the block chain network to the server side through the first client. And the server side sends the export request to the network node applying the method of the embodiment of the invention by calling the first specified interface. The network node applying the method of the embodiment of the invention receives the export request through the first specified interface, and determines that the first user credit in the original account at the server side needs to be transferred to the first account required by the first user. Taking an online game scene as an example, the first client may be an online game client. The network node applying the method of the embodiment of the invention can be configured at the side of the network game server. The export request sent by the user through the first client is received through the first specified interface, and specifically, the export request sent by the user through the network game client forwarded by the network game server side may be received through the first specified interface.
In other possible embodiments, the owner of the user credit in the primary account may be the first client. Furthermore, the user can directly send a export request for exporting the first user credit to the first account of the block chain network to the network node applying the method of the embodiment of the invention through the first client. Wherein the first account may be a record in a list of accounts maintained by a network node of the blockchain network. The first account may be an account of the user who made the export request, or may be an account of another user. Taking an online game scene as an example, the first client may be an online game client. The network node applying the method of the embodiment of the invention can be configured on the same terminal equipment with the network game client. Alternatively, the network node to which the method of the embodiment of the present invention is applied may be configured on different terminal devices that can be connected through a network with the network game client.
The first user credit may be presented in various forms, such as, for example, a game piece, a user credit, a legal piece in a real financial system such as a RMB, a dollar, and the like.
In some possible implementations, the method provided in this embodiment of the present invention may further include a gateway that interconverts the user credits of different credit types. For example, different credit types may include: gaming chips, user credits, french chips, and the like. The gateway can convert the game coins into the user credits according to a certain proportion, or convert the user credits into the french coins according to a certain proportion, and the like. For example, the conversion relationship set by the gateway may be: and (2) the user credit corresponding to the credit type circulating in the block link network is (total deposit amount of the block link network/total deposit amount of the system corresponding to the first client) the first user credit. When receiving a export request sent by a user through a first client, the gateway may be utilized to convert the first user credit into a user credit corresponding to a credit type circulating in the block chain network. In this embodiment, the user credits of different credit types corresponding to different clients may be converted into the user credits of the same credit type by scaling the gateway, so that the user credits have universality in the blockchain network.
S320, broadcasting the export request among other network nodes of the block chain network.
The specific implementation manner of broadcasting the export request among other network nodes of the block chain network is not limited, and may be implemented by referring to a general implementation manner of broadcasting a message in a peer-to-peer network based on the P2P technology. For example, the export request may be broadcast to the full block chain network in a manner that the neighboring network nodes relay.
S330, in response to receiving confirmation of other network nodes to the export request, transferring the first user credit of the user at the first client to the first account of the block chain network.
For example, if the user has 100 user points at the first client, and the user wants to transfer 20 user points stored in the account a of the first client to the account B in the block chain network, the user may send a request for exporting 20 user points to the account B through the first client, and the network node applying the method according to the embodiment of the present invention may transfer 20 user points in the account a to the account B through the above-mentioned S310 to S330, so that 20 user points are deducted from the account a, and 80 user points remain, so that 20 user points are added to the account B.
As can be seen, since the network node to which the method according to the embodiment of the present invention is applied provides the first designated interface for invocation, the export request relating to exporting the user credit to the first account of the block chain network, which is sent by the user through the first client, may be received via the first designated interface, and the export request is broadcast among other network nodes of the block chain network. Because the history record of transferring the user credit in the block chain of the block chain network is irreversible, other network nodes can calculate whether the transfer of the user credit related to the export request is identifiable or not according to the history record in the block chain, so that the network node applying the method of the embodiment of the invention can determine that the phenomenon of double spending does not occur when transferring the first user credit to the first account of the block chain network when receiving the confirmation of the export request by other network nodes. After transferring the first user credit to the first account in the blockchain network, the user credit is not left on the server side as spam data. For a user, the user credit can be freely transferred among accounts of the block chain network, a server side is not needed for management, even if the server side corresponding to the client stops service, the benefit of the user is not damaged, and better experience is brought to the user.
In some possible implementations, the method provided in this embodiment of the present invention may further include:
and S340, receiving an import request sent by a second client through a second designated interface, wherein the import request relates to importing the second user credit of the first account into a second account of the second client.
In some possible implementations, the method provided in this embodiment of the present invention may further include a gateway that interconverts the user credits of different credit types. And when an import request sent by a user through a second client is received, converting the second user credit into the user credit corresponding to the credit type circulating in the second client by using the gateway.
S341, broadcasting the import request among other network nodes of the block chain network.
And S342, in response to receiving confirmation of other network nodes on the import request, deducting the second user credit from the first account, and sending a confirmation message for importing the second user credit into a second account of a second client to the second client.
It should be noted that steps S340, S341 and S342 mentioned in the embodiment of the present invention are drawn by dotted lines in fig. 3 to indicate that these steps are not essential steps of the method provided in the embodiment of the present invention. However, it can be understood that, when the method provided by the embodiment of the present invention includes these steps, the network node applying the method according to the embodiment of the present invention may access, through the second specified interface, third party applications such as an online shopping mall, a telephone charge charging, and the like to the block link network, and further transfer the user credit to these third party applications for use according to a protocol defined by the second specified interface.
In some possible embodiments of the present invention, in order to ensure the security of the accounts in the block network, each account has a corresponding pair of public key and private key. When the user credit needs to be transferred from one account of the block chain network to another account of the block chain network due to the confirmation of the other network node to the export request or the import request, the public key carried by the user credit can be obtained from the export request or the import request. The public key can be obtained by encrypting information such as the amount of user credit to be transferred, an account number of another account to be transferred and the like through a plurality of encryption algorithms such as md5, sha256 and the like. All network nodes in the blockchain network that receive the broadcast can transfer the user credit in one account recorded in the account list to another account according to the public key. The owner of another account can use the user credit in the account by proving that the owner is the real owner of the account by using the private key corresponding to the public key.
It should be noted that, in the embodiment of the present invention, a specific implementation manner of the other network node for confirming the export request or the import request is not limited. For example, a general workload Proof mechanism (Proof of Work) implementation may be undertaken. For another example, the node attestation mechanism provided by the embodiments of the present invention may be adopted for implementation. The following describes a Node Proof mechanism (Proof of Node) provided in the embodiment of the present invention in detail.
In the node attestation mechanism, after the import request or export request is broadcast to all network nodes of the block chain network, each active network node receives the broadcast and puts the import request or export request into the current tail block, and performs validity check calculation on the request in the tail block. For example, the performing validity check calculation on the request in the tail chunk may include: whether an export request or an import request is valid is determined by proving whether the requesting user is the owner of the user credits that need to be transferred in the request. The network node which completes the validity check calculation of all the requests in the current tail block and calculates the next block firstly broadcasts the current tail block which completes the calculation to the full-block chain network, and the full-block chain network only synchronizes the current tail block according to the network node which calculates the next block firstly, thereby ensuring the uniqueness of the effective export request or import request. For the network nodes which do not complete the calculation, when the current tail block broadcasted by the network node which calculates the next block firstly is received, the calculation can be abandoned, and the current tail block of the network node can be synchronously updated according to the received current tail block. During the validity check calculation of all the requests in the current tail block by the network node, valid export requests or import requests are retained in the current tail block, and invalid export requests or import requests are discarded.
As can be seen, in the node attestation mechanism implemented in the embodiment of the present invention, the export request or the import request is broadcasted among other network nodes of the block chain network, so that the network node in the block chain network that receives the broadcast can add the export request or the import request to the tail block of its own block chain, and perform validity check calculation on the export request or the import request. Wherein the confirmation process of the export request or the import request may include: the network node applying the method of the embodiment of the invention responds to the received tail block broadcasted by the network node which completes the check calculation of all the requests in the tail block firstly, synchronously updates the tail block of the self block chain according to the received tail block, and if the export request or the import request is contained in the received effective request of the tail block, confirms that the export request or the import request is confirmed by other network nodes.
Because even an attacker with super-high computing power is not necessarily the network node which completes the current tail block computation at first, the node certification mechanism provided by the embodiment of the invention can prevent the attacker with super-high computing power from attacking the request and ensure the safety of the block chain network.
One of the exemplary devices
Having described one of the methods of the exemplary embodiments of the present invention, an apparatus for processing user data, which is configured in any network node of a blockchain network, of the exemplary embodiments of the present invention will be described next with reference to fig. 4.
For example, referring to fig. 4, a schematic structural diagram of an apparatus configured at any network node of a blockchain network for processing user data according to an embodiment of the present invention is provided. As shown in fig. 4, the apparatus may include:
the request receiving unit 410 may be configured to receive, via a first designated interface, an export request issued by a user through a first client, where the export request relates to exporting a first user credit of the user at the first client to a first account of the blockchain network. The broadcasting unit 420 may be configured to broadcast the derivation request among other network nodes of the block chain network. A transfer unit 430, which may be configured to transfer a first user credit of the user at the first client to the first account of the block chain network in response to receiving confirmation of the export request by the other network node.
In some possible embodiments, the request receiving unit 410 may be further configured to receive an import request issued by a second client via a second specified interface, where the import request relates to importing a second user credit of the first account into a second account of the second client. The broadcasting unit 420 may be further configured to broadcast the import request among other network nodes of the block chain network. The transferring unit 430 may be further configured to, in response to receiving the confirmation of the importing request from the other network node, deduct the second user credit from the first account, and send a confirmation message to the second client to import the second user credit into a second account of the second client.
In some possible embodiments, the apparatus may further include: the gateway setting unit 440 may be configured to set a gateway that converts the user credits of different credit types to each other. The export conversion unit 441 may be configured to, when the receiving unit receives an export request sent by a user through a first client, convert, by using the gateway, the first user credit into a user credit corresponding to a credit type circulating in the block link network. The import conversion unit 442 may be configured to, when the receiving unit receives an import request sent by a user through a second client, convert, by using the gateway, the second user credit into a user credit corresponding to a credit type circulating in the second client.
In some possible embodiments, the export request or import request is broadcasted among other network nodes of the block chain network, so that a network node in the block chain network that receives the broadcast adds the export request or import request to a tail block of its own block chain, and performs validity check calculation on the export request or import request. The transferring unit 430 may be configured to, in response to receiving a tail block broadcasted by a network node that first completes check computation for all requests in the tail block, perform synchronous update on the tail block of its own block chain according to the received tail block, and if the export request or the import request is included in a valid request of the received tail block, determine that an acknowledgement of the export request or the import request by another network node is obtained.
It can be seen that, since the network node configuring the apparatus according to the embodiment of the present invention provides a first designated interface for invoking, the receiving unit 410 may receive, via the first designated interface, an export request issued by a user through a first client and relating to exporting user credits to a first account of the blockchain network, and the broadcasting unit 420 may broadcast the export request among other network nodes of the blockchain network, so that the transferring unit 430 may transfer the first user credits to the first account of the blockchain network without double spending when receiving confirmation of the export request by the other network nodes. After transferring the first user credit to the first account in the blockchain network, the user credit is not left on the server side as spam data. For a user, the user credit can be freely transferred among accounts of the block chain network, a server side is not needed for management, even if the server side corresponding to the client stops service, the benefit of the user is not damaged, and better experience is brought to the user.
It should be noted that the gateway setting unit 440, the export conversion unit 441, and the import conversion unit 442 according to the embodiment of the present invention are drawn by dotted lines in fig. 4 to indicate that these units are not essential units of the apparatus for processing user data according to the embodiment of the present invention.
Second exemplary method
Having described one of the methods of the exemplary embodiment of the present invention, next, a method of the exemplary embodiment of the present invention applied to a first client is described with reference to fig. 5.
For example, referring to fig. 5, a flowchart of a method for processing user data applied to a first client according to an embodiment of the present invention is shown. As shown in fig. 5, the method may include:
and S510, responding to the operation corresponding to the user for exporting the user credit to the block chain network, and sending an export request through a first specified interface provided by a network node of the block chain network.
Wherein the export request involves exporting a first user credit of the user at the first client to a first account of the block chain network for the network node to broadcast the export request among other network nodes of the block chain network and, in response to receiving confirmation of the export request by other network nodes, transferring the first user credit of the user at the first client to the first account of the block chain network.
For example, taking a network game scenario as an example, the first client may be a network game client. The network game client may provide an export button on the interface that displays the user credits. When the user clicks the export button, the operation corresponding to exporting the user credit to the blockchain network is executed, so that the first client sends an export request through a first specified interface provided by a network node of the blockchain network.
S520, responding to the network node to transfer the first user credit to the first account, and correspondingly updating the residual user credit of the first client.
For example, the first client may obtain a message fed back by the network node transferring the first user credit to the first account, and correspondingly update the remaining user credit displayed by the first client according to the fed back message.
Therefore, by applying the method provided by the embodiment of the invention to the first client, the user can transfer the first user credit of the user at the first client to the first account of the block chain network by executing the operation corresponding to exporting the user credit to the block chain network, so that the user credit cannot be left at the server side to become junk data. For a user, the user credit can be freely transferred in a wider range of a block chain network, and even if a server side corresponding to a client stops service, the benefit of the user is not damaged, so that better experience is brought to the user.
Example apparatus two
Having described the second method of the exemplary embodiment of the present invention, next, an apparatus configured at a first client according to the exemplary embodiment of the present invention is described with reference to fig. 6.
For example, referring to fig. 6, a schematic structural diagram of an apparatus configured at a first client for processing user data according to an embodiment of the present invention is provided. As shown in fig. 6, the apparatus may include: the export operation unit 610 may be configured to, in response to a user performing an operation corresponding to exporting a user credit to a blockchain network, issue an export request via a first designated interface provided by a network node of the blockchain network, the export request involving exporting a first user credit of the user at the first client to a first account of the blockchain network, so that the network node broadcasts the export request among other network nodes of the blockchain network, and in response to receiving an acknowledgement of the export request by the other network nodes, transfer the first user credit of the user at the first client to the first account of the blockchain network. The user credit update unit 620 may be configured to update the remaining user credit of the first client in response to the network node transferring the first user credit into the first account.
As can be seen, by configuring the device provided in the embodiment of the present invention at the first client, the user can transfer the first user credit of the user at the first client to the first account of the blockchain network by executing an operation corresponding to exporting the user credit to the blockchain network, so that the user credit is not left at the server side and becomes garbage data. For a user, the user credit can be freely transferred in a wider range of a block chain network, and even if a server side corresponding to a client stops service, the benefit of the user is not damaged, so that better experience is brought to the user.
It should be noted that although in the above detailed description several units of the apparatus for processing user data are mentioned, this division is only not mandatory. Indeed, the features and functions of two or more of the units described above may be embodied in one unit, according to embodiments of the invention. Conversely, the features and functions of one unit described above may be further divided into embodiments by a plurality of units.
Moreover, while the operations of the method of the invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.