An invitation code storage and reading method, device, equipment and storage medium
By randomly selecting operation nodes on the blockchain to store and read VRF invitation codes, the problems of poor user experience and low promotion efficiency caused by manual filling of invitation codes are solved, and automation and security protection are achieved.
Patent Information
- Application Number
- CN202111372161.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-18
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2041-11-18
AI Technical Summary
The promotion method of invitation code in the prior art requires the invitee to fill in the invitation code manually, resulting in a poor user experience and reduced promotion efficiency.
By receiving the invitation page link, a verifiable random VRF invitation code and the IP address of the invitee are obtained. Multiple operation nodes are randomly selected from the blockchain, and the VRF invitation code is stored after legitimacy verification. The legitimacy is verified when reading to achieve automatic storage and reading.
The automatic storage and reading of invitation codes are realized, which improves the user experience, and the security is improved by preventing modification by randomly selecting operation nodes.
Smart Images

Figure CN114168868B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the blockchain technology, and particularly to an invitation code storage and reading method and device, equipment and a storage medium. BACKGROUND
[0002] In the prior art, when a new application (APP) is promoted, an inviting party usually sends a link containing an invitation code to an invited party, and the invited party needs to fill in the invitation code when downloading the APP through the link, so that the inviting party completes the promotion of the APP. However, this method requires the invited party to manually fill in the invitation code, which reduces the user experience of the invited party and also reduces the APP promotion efficiency. SUMMARY
[0003] To solve the above technical problems, the present application aims to provide an invitation code storage and reading method, device, equipment and storage medium.
[0004] The technical solution of the present application is implemented as follows:
[0005] In a first aspect, an invitation code storage method is provided, and the method comprises:
[0006] receiving an invitation page link sent by an inviting party, and obtaining a verifiable random (VRF) invitation code and an Internet protocol (IP) address of an invited party from the invitation page link;
[0007] According to the IP address, a plurality of first operation nodes for storing the invitation code are randomly selected from all nodes on a blockchain;
[0008] The VRF invitation code is sent to each first operation node respectively;
[0009] When the legality of the first operation node is verified, the VRF invitation code is stored in the first operation node, so that the invited party reads the VRF invitation code from the first operation node for invitation code verification.
[0010] In the above solution, the plurality of first operation nodes for storing the invitation code are randomly selected from all nodes on the blockchain according to the IP address, which comprises: obtaining attribute information of all nodes on the blockchain from a block of any node on the blockchain; determining a plurality of second operation nodes for storing the invitation code according to the attribute information of the nodes; and selecting the plurality of first operation nodes from the plurality of second operation nodes based on the IP address.
[0011] In the scheme, the selecting the first operation nodes from the second operation nodes based on the IP address comprises: taking the IP address and each second operation node identifier as input of a preset hash function, outputting a corresponding first hash value; screening the first hash value meeting a first screening condition; taking the second operation node corresponding to the screened first hash value as a preselected operation node; and taking the preselected operation nodes as the first operation nodes if the number of the preselected operation nodes is within a preset node number range.
[0012] In the scheme, the method further comprises: taking the first hash value as input of the preset hash function, outputting a corresponding second hash value if the number of the preselected operation nodes is outside the preset node number range; screening the second hash value meeting a second screening condition; and taking the second operation node corresponding to the screened second hash value as a preselected operation node.
[0013] In the scheme, the method further comprises: obtaining the block height of the invited party and the latest block height of the blockchain from the blockchain; determining that the legality verification of the first operation node passes when the relevancy between the block height of the invited party and the latest block height meets a preset relevancy range; and determining that the legality verification of the first operation node fails when the relevancy between the block height of the invited party and the latest block height does not meet the preset relevancy range.
[0014] In a second aspect, an invitation code reading method is provided, and the method comprises:
[0015] Obtaining the IP address of the invited party from the invitation page link;
[0016] Randomly selecting a plurality of first operation nodes for storing the invitation code from all nodes on the blockchain according to the IP address;
[0017] Sending a VRF invitation code obtaining request to each first operation node; wherein the request comprises the IP address;
[0018] Receiving the VRF invitation code read based on the IP address returned by the first operation node in response to the request;
[0019] When the legality verification of the plurality of VRF invitation codes passes, the VRF invitation code is valid.
[0020] In the scheme, the method further comprises: verifying that the plurality of VRF invitation codes are all consistent, obtaining an original invitation code of the inviting party and a verifiable proof; and verifying, based on the VRF invitation code, the original invitation code and the verifiable proof, that the VRF invitation code is an invitation code generated by the inviting party, to indicate that the legality verification of the VRF invitation code is passed.
[0021] In the scheme, the method further comprises: taking the original invitation code and the verifiable proof as inputs of a VRF function, and outputting a third hash value; and when the third hash value is consistent with the VRF invitation code, indicating that the VRF invitation code is an invitation code generated by the inviting party.
[0022] In the scheme, the obtaining of the original invitation code of the inviting party and the verifiable proof comprises: broadcasting the VRF invitation code on the blockchain; and receiving the original invitation code and the verifiable proof sent by the inviting party when the inviting party receives the broadcast.
[0023] In a third aspect, an invitation code storage device is provided, and the device comprises:
[0024] A first obtaining unit is configured to receive an invitation page link sent by an inviting party, and obtain a verifiable random VRF invitation code and an Internet Protocol (IP) address of a invited party from the invitation page link.
[0025] A first selecting unit is configured to randomly select, according to the IP address, a plurality of first operation nodes for storing invitation codes from all nodes on a blockchain.
[0026] A first sending unit is configured to send the VRF invitation code to each first operation node.
[0027] A storage unit is configured to store the VRF invitation code in the first operation node when the legality verification of the first operation node is passed, so that the invited party reads the VRF invitation code from the first operation node for verification of the invitation code.
[0028] In a fourth aspect, an invitation code reading device is provided, and the device comprises:
[0029] A second obtaining unit is configured to obtain an IP address of a invited party from an invitation page link.
[0030] A second selecting unit is configured to randomly select, according to the IP address, a plurality of first operation nodes for storing invitation codes from all nodes on a blockchain.
[0031] A second sending unit is configured to send a VRF invitation code obtaining request to each first operation node, and the request includes the IP address.
[0032] a reading unit configured to receive a VRF invitation code read based on the IP address returned by the first operation node in response to the request; and a verification unit configured to verify the VRF invitation code as valid when the VRF invitation code is read by the reading unit and the plurality of VRF invitation codes are verified as valid.
[0033] In a fifth aspect, an invitation code storage device is provided, comprising a processor and a memory configured to store a computer program capable of running on the processor, wherein the processor is configured to execute the steps of the aforementioned method when running the computer program.
[0034] In a sixth aspect, an invitation code reading device is provided, comprising a processor and a memory configured to store a computer program capable of running on the processor, wherein the processor is configured to execute the steps of the aforementioned method when running the computer program.
[0035] In a seventh aspect, a computer readable storage medium is provided, having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the aforementioned method.
[0036] With the above technical solution, the VRF invitation code is stored in the first operation node, so that the invited party reads the VRF invitation code from the first operation node for verification of the invitation code, thereby realizing automatic storage and reading of the invitation code. In addition, since the number of nodes on the block chain varies randomly at different time periods, the selected plurality of first operation nodes also vary randomly, preventing the possibility of modifying the VRF invitation code using fixed first operation nodes, thereby achieving the purpose of security protection of the VRF invitation code. BRIEF DESCRIPTION OF DRAWINGS
[0037] Figure 1 a first flowchart of the invitation code storage method in the embodiments of the present application;
[0038] Figure 2 a second flowchart of the invitation code storage method in the embodiments of the present application;
[0039] Figure 3 a first flowchart of the invitation code reading method in the embodiments of the present application;
[0040] Figure 4 a structural diagram of the invitation code storage device in the embodiments of the present application;
[0041] Figure 5 a structural diagram of the invitation code reading device in the embodiments of the present application;
[0042] Figure 6 a structural diagram of the invitation code storage device in the embodiments of the present application;
[0043] Figure 7 A structural schematic diagram of an invitation code reading device in the embodiment of the present application. DETAILED DESCRIPTION
[0044] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below with reference to the accompanying drawings, which are only used for reference and do not limit the embodiments of the present application.
[0045] The embodiments of the present application provide an invitation code storage method, Figure 1 A first flowchart of the invitation code storage method in the embodiments of the present application is shown in FIG. 1, and the execution subject of the invitation code storage method is the invited party, and the specific steps can include: Figure 1
[0046] Step 101: receiving an invitation page link sent by an inviting party, and obtaining a verifiable random VRF invitation code and an Internet protocol address IP address of the invited party from the invitation page link.
[0047] Here, the generation of the invitation page link is performed by the inviting party. For example, in some embodiments, the invitation page link is a link generated by the inviting party based on a key pair of an account of the inviting party and a block height of the inviting party, using a verifiable random function VRF.
[0048] Specifically, the inviting party obtains the key pair of the account and the block height from the blockchain, and takes the key pair and the block height of the inviting party as the input of the verifiable random function (VRF), and outputs the invitation page link containing the VRF invitation code.
[0049] Here, for the acquisition of the Internet protocol address (Internet Protocol, IP) of the invited party, for example, the invitation page link is opened, and a certain uniform resource locator (Uniform Resource Locator, URL) is requested in the invitation page corresponding to the invitation page link to obtain the IP address of the invited party.
[0050] Step 102: according to the IP address, randomly selecting a plurality of first operation nodes for storing the invitation code from all nodes on the blockchain.
[0051] It should be noted that, due to the random change of the number of nodes on the blockchain in different time periods, which may increase or decrease, the number of first operation nodes selected by the invited party from all nodes on the blockchain in different time periods also changes randomly. That is, the first operation nodes selected by the same inviter in different time periods are not the same. The selection method of the present application can effectively prevent the modification of the VRF invitation code by using fixed first operation nodes, and achieve the purpose of security protection of the VRF invitation code.
[0052] Step 103: Send the VRF invitation code to each first operation node respectively.
[0053] Step 104: When the legality verification of the first operation node is passed, store the VRF invitation code to the first operation node, so that the invited party reads the VRF invitation code from the first operation node for verification of the invitation code.
[0054] Here, the legality verification operation mentioned in step 104 is performed by the first operation node. When the first operation node verifies that it is the legal processor of the invitation code of the current invited party, i.e. the legality verification of the first operation node is passed, the first operation node stores the received VRF invitation code at this time. When the first operation node verifies that it is not the legal processor of the invitation code of the current invited party, i.e. the legality verification of the first operation node is not passed, the first operation node can refuse to store the service at this time.
[0055] As to how to perform the legality verification, for example, in some embodiments, the method further comprises: obtaining the block height of the invited party and the latest block height of the current blockchain from the blockchain; when the relevance of the block height of the invited party and the latest block height meets a preset relevance range, determining that the legality verification of the first operation node is passed; when the relevance of the block height of the invited party and the latest block height does not meet the preset relevance range, determining that the legality verification of the first operation node is not passed.
[0056] It should be noted that the block height is the height of the block, and the relevance here can be understood as the interval difference between the block height of the invited party and the latest block height of the blockchain. If the interval difference between the two is within the preset relevance range, it is determined that the legality verification of the first operation node is passed. If the interval difference between the two is outside the preset relevance range, it is determined that the legality verification of the first operation node is not passed.
[0057] For example, if the block height of the invited party is 1, the latest block height of the blockchain is 15, and the preset correlation range is less than or equal to 50, the legality verification of the first operation node is passed. If the block height of the invited party is 1, the latest block height of the blockchain is 100, and the preset correlation range is less than or equal to 50, the legality verification of the first operation node is not passed.
[0058] In some embodiments, the storing the VRF invitation code to the first operation node comprises: storing the IP address as a Key and the VRF invitation code as a Value to the first operation node.
[0059] Here, the data is stored in the Key-Value data storage format, which facilitates subsequent quick query of the corresponding Value according to the Key.
[0060] This embodiment means that the IP address of the invited party and the corresponding VRF invitation code are stored to the first operation node in the Key-Value data storage format, which facilitates the invited party to quickly query the corresponding VRF invitation code according to the IP address for the verification of the invitation code.
[0061] Here, the execution subject of steps 101 to 104 can be a processor of the invitation code storage device.
[0062] By storing the VRF invitation code to the first operation node, the invited party reads the VRF invitation code from the first operation node for the verification of the invitation code, so as to realize the automatic storage and reading of the invitation code. In addition, since the number of nodes on the blockchain varies randomly at different time periods, the selected multiple first operation nodes also vary randomly, which prevents the case that the VRF invitation code is modified by using a fixed first operation node, and achieves the purpose of security protection of the VRF invitation code.
[0063] Based on the above embodiment, the present embodiment specifically provides an invitation code storage method, Figure 2 For the second flowchart of the invitation code storage method in the present embodiment, as shown in the figure, the execution subject of the invitation code storage method is the invited party, and the specific steps can include: Figure 2
[0064] Step 201: receiving an invitation page link sent by an invitation party, and obtaining a VRF invitation code and an IP address of an invited party from the invitation page link.
[0065] In some embodiments, the invitation page link is a link generated by a verifiable random function VRF based on a key pair of an account of the invitation party and a block height of the invitation party.
[0066] Specifically, the inviter obtains a key pair and a block height of the account from the blockchain, takes the key pair and the block height of the inviter as inputs of a VRF verifiable random function, and outputs an invitation page link containing a VRF invitation code.
[0067] Here, for obtaining the IP address of the invitee, exemplary, open the invitation page link, and request a certain URL in the invitation page corresponding to the invitation page link to obtain the IP address of the invitee.
[0068] Step 202: Obtain attribute information of all nodes on the blockchain from a block of any node on the blockchain.
[0069] Here, the information stored in the block of each node on the blockchain is the same, so the attribute information of all nodes stored in the block of any node on the blockchain is requested. The attribute information of the node is used to identify the functional characteristics of the node, for example, some nodes are specially used for operating invitation codes, including receiving, storing and returning functions.
[0070] Step 203: Determine a plurality of second operation nodes for storing invitation codes according to the attribute information of the nodes.
[0071] Here, the second operation node refers to any node on the blockchain for storing invitation codes.
[0072] Step 204: Select the plurality of first operation nodes from the plurality of second operation nodes based on the IP address.
[0073] Here, according to the IP address of the invitee, the first operation node for processing the VRF invitation code of the invitee is selected from the plurality of second operation nodes on the blockchain.
[0074] For specific ways of selecting the plurality of first operation nodes from the plurality of second operation nodes, exemplary, in some embodiments, the IP address and the identifier of each second operation node are taken as inputs of a preset hash function, and the corresponding first hash value is output; the first hash value satisfying the first screening condition is screened out; the second operation node corresponding to the screened first hash value is taken as a preselected operation node; if the number of preselected operation nodes is within a preset node number range, the preselected operation node is taken as the first operation node.
[0075] In some embodiments, the method further comprises: if the number of preselected operation nodes is outside the preset node number range, taking the first hash value as an input of the preset hash function, outputting a corresponding second hash value; screening out a second hash value satisfying a second screening condition; and taking the second operation node corresponding to the screened second hash value as a preselected operation node.
[0076] Here, the application obtains a first hash value by hashing the IP address of the invited party and the second operation node, and then screens the first hash value meeting the first screening condition according to the first screening condition, takes the second operation node corresponding to the screened first hash value as a preselected operation node, and determines whether to directly take the preselected operation node as the first operation node according to the number of the preselected operation node.
[0077] Here, the first screening condition can be a specific limitation on the first digit of the hash value, for example, the first digit of the hash value is zero. Therefore, the first hash value with the first digit of zero is selected from the plurality of first hash values, and the second operation node corresponding to the screened first hash value is taken as the preselected operation node.
[0078] As to how to determine whether to directly take the preselected operation node as the first operation node according to the number of the preselected operation node, the application here predefines the optimal operation node number range when processing the VRF invitation code, i.e., the preset node number range, and further determines whether the number of the preselected operation node is within the preset node number range. If yes, the preselected second operation node is directly taken as the first operation node. If no, it means that the number of the preselected operation node is too large or too small. When the number is too large, it may affect the use experience of the invited party. When the number is too small, it may increase the possibility of collusion between operation nodes, and thus may modify the VRF invitation code. Therefore, it is necessary to reselect the second operation node.
[0079] As to the reselection of the second operation node, the first hash value calculated in the last preselection process can be hashed again to obtain a second hash value, the second hash value meeting the first screening condition is screened according to the first screening condition, the second operation node corresponding to the screened second hash value is taken as the preselected operation node, and the preselected operation node is taken as the first operation node until the number of the preselected operation node is within the preset node number range.
[0080] Step 205: The VRF invitation code is sent to each first operation node.
[0081] Step 206: When the legality of the first operation node is verified, the VRF invitation code is stored in the first operation node, so that the invited party reads the VRF invitation code from the first operation node for verification of the invitation code.
[0082] In some embodiments, the method further includes: obtaining the block height of the invitee and the latest block height of the current blockchain from the blockchain; when the correlation between the block height of the invitee and the latest block height satisfies a preset correlation range, determining that the legitimacy verification of the first operation node has passed; when the correlation between the block height of the invitee and the latest block height does not satisfy the preset correlation range, determining that the legitimacy verification of the first operation node has failed.
[0083] In some embodiments, storing the VRF invitation code to the first operation node includes: using the IP address as a key and the VRF invitation code as a value to store them to the first operation node.
[0084] The above technical solution stores the VRF invitation code on the first operation node, allowing the invitee to read the VRF invitation code from the first operation node for invitation code verification, thus achieving automatic storage and reading of the invitation code. Furthermore, since the number of nodes on the blockchain fluctuates randomly over time, the selected multiple first operation nodes also fluctuate randomly. This prevents the VRF invitation code from being modified by a fixed first operation node, thereby achieving the purpose of protecting the security of the VRF invitation code.
[0085] Based on the above embodiments, this application proposes a method for reading an invitation code. Figure 3 This is a first flow chart of the invitation code reading method in an embodiment of the present application.
[0086] like Figure 3 As shown, the execution subject of the invitation code reading method is the invitee, and the specific steps may include:
[0087] Step 301: Obtain the IP address of the invitee from the invitation page link.
[0088] For example, after the application (Application, APP) in the invitation page corresponding to the invitation page link is installed and started, a URL is requested to obtain the IP address of the invitee.
[0089] Step 302: Based on the IP address, a plurality of first operation nodes for storing the invitation code are randomly selected from all nodes on the blockchain.
[0090] Here, the method for selecting the first operation node has been described in the previous embodiment. Please refer to the previous embodiment for details and will not be elaborated here.
[0091] Step 303: Send a VRF invitation code acquisition request to each first operation node; wherein the request includes the IP address.
[0092] Step 304: receiving the VRF invitation code read based on the IP address returned by the first operation node in response to the request.
[0093] It should be noted that in actual application, the number of nodes on the blockchain varies at different time periods, which may increase or decrease, so the multiple first operation nodes selected from all nodes on the blockchain according to the IP address of the invited party at different time periods also vary. It is further explained that when the invitation code storage process and the invitation code reading process are in the same time period, the first operation nodes selected in the two processes are the same; when the invitation code storage process and the invitation code reading process are in different time periods (for example, the invitation code storage process is in the last time period, and the invitation code reading process is in the next time period), the first operation nodes selected in the two processes are different, which may cause the subsequent VRF invitation code cannot be obtained from the first operation node. To avoid this situation, when the first operation node receives the VRF invitation code obtaining request and responds, the legality verification operation of the operation node selected in the current time period will be performed (the legality verification of the operation node in the above-mentioned embodiment, which will not be described here). If the verification is passed, it means that the operation node selected in the current time period is the operation node for storing the invitation code, and the VRF invitation code read based on the IP address by the first operation node in the current time period is directly obtained. If the verification is not passed, the operation node information of the multiple operation nodes selected in the last time period for storing the invitation code is obtained from the block of the node on the blockchain, and the operation node selected in the last time period is the operation node for storing the invitation code. The VRF invitation code read based on the IP address by the operation node selected in the last time period is received.
[0094] Step 305: when the legality verification of the multiple VRF invitation codes is passed, it means that the VRF invitation code is valid.
[0095] Here, when each first operation node reads the VRF invitation code, the first operation node will verify whether the VRF invitation code is the invitation code generated by the inviting party. If yes, it means that the legality verification of the VRF invitation code is passed, and the read VRF invitation code is valid. If not, it means that the legality verification of the VRF invitation code is not passed, and the read VRF invitation code is invalid.
[0096] As for how to verify whether the VRF invitation code is the invitation code generated by the inviting party, exemplarily, in some embodiments, first, it is verified whether the multiple VRF invitation codes are consistent; if consistent, the original invitation code of the inviting party and the verifiable proof are obtained; second, based on the VRF invitation code, the original invitation code and the verifiable proof, it is verified whether the VRF invitation code is the invitation code generated by the inviting party. If not consistent, it means that the read VRF invitation code is invalid.
[0097] Specifically, in some embodiments, the original invitation code and the verifiable proof are taken as inputs of a VRF function, and a third hash value is output; when the third hash value is consistent with the VRF invitation code, it is indicated that the VRF invitation code is the invitation code generated by the inviter.
[0098] In some embodiments, the original invitation code and the verifiable proof of the inviter are obtained by broadcasting the VRF invitation code on the blockchain, and receiving the original invitation code and the verifiable proof sent by the inviter when the inviter receives the broadcast.
[0099] That is, the VRF invitation code is broadcasted on the blockchain so that the inviter obtains the VRF invitation code, and at the same time, the original invitation code and the verifiable proof of the inviter are broadcasted on the blockchain so that the invitee receives the original invitation code and the verifiable proof of the inviter.
[0100] By sending an invitation code obtaining request to a first operation node on the blockchain, and receiving a VRF invitation code read based on an IP address returned by the first operation node in response to the request, automatic reading of the invitation code is realized. The read VRF invitation code is verified for legality, and when the verification is passed, it is proved that the read VRF invitation code is valid.
[0101] To implement the method of the embodiments of the present application, based on the same inventive concept, the embodiments of the present application also provide an invitation code storage device, Figure 4 For the structural schematic diagram of the invitation code storage device of the embodiments of the present application, as shown in Figure 4 The invitation code storage device comprises:
[0102] A first obtaining unit 401 is configured to receive an invitation page link sent by an inviter, and obtain a verifiable random VRF invitation code and an Internet Protocol address IP address of an invitee from the invitation page link.
[0103] A first selecting unit 402 is configured to randomly select a plurality of first operation nodes for storing invitation codes from all nodes on the blockchain according to the IP address.
[0104] A first sending unit 403 is configured to send the VRF invitation code to each first operation node respectively.
[0105] A storage unit 404 is configured to store the VRF invitation code to the first operation node when the legality verification of the first operation node is passed, so that the invitee reads the VRF invitation code from the first operation node for verification of the invitation code.
[0106] According to the technical scheme, the VRF invitation code is stored in the first operation node, so that the invited party reads the VRF invitation code from the first operation node for verification of the invitation code, and automatic storage and reading of the invitation code are realized. In addition, since the number of nodes on the block chain changes randomly at different time periods, the selected plurality of first operation nodes also change randomly, preventing the case that the VRF invitation code is modified by using a fixed first operation node, and achieving the purpose of security protection of the VRF invitation code.
[0107] In some embodiments, the first selecting unit 402 is specifically configured to obtain attribute information of all nodes on the block chain from a block of any node on the block chain; determine a plurality of second operation nodes for storing the invitation code according to the attribute information of the nodes; and select the plurality of first operation nodes from the plurality of second operation nodes based on the IP address.
[0108] In some embodiments, the selecting the plurality of first operation nodes from the plurality of second operation nodes based on the IP address comprises: taking the IP address and an identifier of each second operation node as inputs of a preset random function, and outputting a corresponding first hash value; screening out a first hash value satisfying a first screening condition; taking a second operation node corresponding to the screened first hash value as a preselected operation node; and if a number of the preselected operation nodes is within a preset node number range, taking the preselected operation nodes as the first operation nodes.
[0109] In some embodiments, if the number of the preselected operation nodes is outside the preset node number range, taking the first hash value as an input of the preset random function, outputting a corresponding second hash value, screening out a second hash value satisfying a second screening condition, and taking a second operation node corresponding to the screened second hash value as a preselected operation node.
[0110] In some embodiments, the block height of the invited party and the latest block height of the block chain are obtained from the block chain; when a correlation degree between the block height of the invited party and the latest block height satisfies a preset correlation degree range, it is determined that the legality verification of the first operation node is passed; and when the correlation degree between the block height of the invited party and the latest block height does not satisfy the preset correlation degree range, it is determined that the legality verification of the first operation node is not passed.
[0111] To implement the method of the embodiments of the present application, based on the same inventive concept, the embodiments of the present application also provide an invitation code reading device, Figure 5 As shown in the structural schematic diagram of the invitation code reading device of the embodiments of the present application, Figure 5 The invitation code reading device comprises:
[0112] The second acquisition unit 501 is configured to acquire an IP address of the invited party from the invitation page link.
[0113] The second selection unit 502 is configured to randomly select, according to the IP address, a plurality of first operation nodes for storing the invitation code from all nodes on the block chain.
[0114] The second sending unit 503 is configured to send a VRF invitation code acquisition request to each first operation node, wherein the request includes the IP address.
[0115] The reading unit 504 is configured to receive a VRF invitation code read based on the IP address returned by the first operation node in response to the request; and when the plurality of VRF invitation codes pass the legality verification, it is indicated that the VRF invitation code is valid.
[0116] By sending the invitation code acquisition request to the first operation node on the block chain and receiving the VRF invitation code read based on the IP address returned by the first operation node in response to the request, the automatic reading of the invitation code is realized. Then, the legality of the read VRF invitation code is verified, and when the verification is passed, it is proved that the read VRF invitation code is valid.
[0117] In some embodiments, when the plurality of VRF invitation codes are all consistent, the original invitation code of the inviter and the verifiable proof are acquired; when the VRF invitation code is verified as the invitation code generated by the inviter based on the VRF invitation code, the original invitation code and the verifiable proof, it is indicated that the VRF invitation code passes the legality verification.
[0118] In some embodiments, the original invitation code and the verifiable proof are taken as inputs of a VRF function, and a third hash value is output; when the third hash value is consistent with the VRF invitation code, it is indicated that the VRF invitation code is the invitation code generated by the inviter.
[0119] In some embodiments, the original invitation code of the inviter and the verifiable proof are acquired by broadcasting the VRF invitation code on the block chain; and the original invitation code and the verifiable proof sent by the inviter when receiving the broadcast are received.
[0120] The present application also provides another invitation code storage device, Figure 6 As shown in the structural diagram of the invitation code storage device in the present application embodiment, Figure 6 The invitation code storage device includes a processor 601 and a memory 602 configured to store computer programs capable of running on the processor.
[0121] The processor 601 is configured to execute the computer program to perform the method steps in the foregoing embodiments.
[0122] Of course, in actual applications, as shown in Figure 6 , various components in the invitation code reading device are coupled together through a bus system 703. It can be understood that the bus system 703 is used to realize the connection and communication between the components. In addition to including a data bus, the bus system 703 also includes a power bus, a control bus and a status signal bus. However, for the purpose of clear illustration, all the buses are marked as the bus system 703 in the Figure 6 .
[0123] The embodiment of the present application further provides another invitation code reading device, Figure 7 , which is a structural schematic diagram of the invitation code reading device in the embodiment of the present application. As shown in Figure 7 , the invitation code reading device comprises a processor 701 and a memory 702 configured to store a computer program capable of running on the processor.
[0124] The processor 701 is configured to execute the computer program to perform the method steps in the foregoing embodiments.
[0125] Of course, in actual applications, as shown in Figure 7 , various components in the invitation code reading device are coupled together through a bus system 703. It can be understood that the bus system 703 is used to realize the connection and communication between the components. In addition to including a data bus, the bus system 703 also includes a power bus, a control bus and a status signal bus. However, for the purpose of clear illustration, all the buses are marked as the bus system 703 in the Figure 7 .
[0126] In actual applications, the processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, and a microprocessor. It can be understood that, for different devices, the electronic device used to realize the function of the processor can also be other devices, and the embodiment of the present application is not limited in this regard.
[0127] The above memory can be a volatile memory, such as a random-access memory (RAM), or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state disk (SSD), or a combination of the above kinds of memories, and provides instructions and data to the processor.
[0128] In the example embodiments, the application also provides a computer readable storage medium for storing the computer program.
[0129] Optionally, the computer readable storage medium can be applied to any of the methods in the embodiments of the application, and the computer program causes the computer to execute the corresponding procedures realized by the processor in the various methods of the embodiments of the application. For brevity, details are not repeated here.
[0130] In several embodiments provided in the application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division, and actual implementation can have another division manner, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the various components shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0131] The units described above as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. can be located in one place or distributed on multiple network units; part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0132] In addition, each function unit in each embodiment of the present application can be integrated in one processing module, or each unit can be separately as a unit, or two or more units can be integrated in one unit; the integrated unit can be realized in the form of hardware or in the form of hardware plus software function unit. Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware, and the foregoing program can be stored in a computer readable storage medium, and the program executes the steps of the above-mentioned method embodiments when executed; and the foregoing storage medium includes mobile storage equipment, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and various storage program codes.
[0133] The methods disclosed in the several method embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments.
[0134] The features disclosed in the several product embodiments provided by the present application can be combined arbitrarily without conflict to obtain new product embodiments.
[0135] The features disclosed in the several method or device embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments or device embodiments.
[0136] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited to this, any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for storing invitation codes, characterized in that: The method comprises: Receive an invitation page link sent by the inviter, and obtain a verifiable random VRF invitation code and the invitee's Internet Protocol address (IP address) from the invitation page link; Obtain attribute information of all nodes on the blockchain from the block of any node on the blockchain; Determining, based on the attribute information of the node, a plurality of second operation nodes for storing the invitation code; Using the IP address and each second operation node identifier as input to a preset hash function, and outputting a corresponding first hash value; Filter out a first hash value that meets a first filtering condition; The second operation node corresponding to the filtered first hash value is used as a pre-selected operation node; If the number of the pre-selected operation nodes is within a preset node number range, the pre-selected operation node is used as the first operation node; Send the VRF invitation code to each first operation node respectively; When the legitimacy verification of the first operation node passes, the VRF invitation code is stored in the first operation node, so that the invited party reads the VRF invitation code from the first operation node for verification of the invitation code.
2. The method according to claim 1, characterized in that The method further comprises: If the number of the preselected operation nodes is outside the preset node number range, using the first hash value as input to the preset hash function and outputting a corresponding second hash value; Filter out the second hash value that meets the second filtering condition; The second operation node corresponding to the filtered second hash value is used as the pre-selected operation node.
3. The method according to claim 1, characterized in that The method further comprises: Obtaining the block height of the invitee and the latest block height of the current blockchain from the blockchain; When the correlation between the block height of the invited party and the latest block height meets a preset correlation range, determining that the legitimacy verification of the first operating node has passed; When the correlation between the block height of the invited party and the latest block height does not satisfy the preset correlation range, it is determined that the legitimacy verification of the first operation node has failed.
4. A method for reading an invitation code, characterized in that: The method comprises: Get the IP address of the invitee from the invitation page link; Based on the IP address, a plurality of first operation nodes for storing the invitation code are randomly selected from all nodes on the blockchain; wherein the first operation nodes are pre-selected operation nodes, the number of the pre-selected operation nodes is within a preset node number range, the pre-selected operation nodes are second operation nodes corresponding to a first hash value that meets a first screening condition, the first hash value being obtained by processing the IP address and each second operation node identifier using a preset hash function, and the second operation nodes are operation nodes for storing the invitation code determined based on attribute information of all nodes on the blockchain; Sending a VRF invitation code acquisition request to each first operation node; wherein the request includes the IP address; receiving a VRF invitation code read based on the IP address and returned by the first operation node in response to the request; When the legitimacy verification of multiple VRF invitation codes is passed, it indicates that the VRF invitation codes are valid.
5. The method according to claim 4, characterized in that The method further comprises: When verifying that the multiple VRF invitation codes are all consistent, obtaining the original invitation code and verifiable proof from the inviter; When the VRF invitation code is verified to be the invitation code generated by the inviting party based on the VRF invitation code, the original invitation code and the verifiable proof, the legitimacy verification of the VRF invitation code is passed.
6. The method according to claim 5, characterized in that The method further comprises: Using the original invitation code and the verifiable proof as inputs to a VRF function, and outputting a third hash value; When the third hash value is consistent with the VRF invitation code, it indicates that the VRF invitation code is an invitation code generated by the inviting party.
7. The method according to claim 5, characterized in that The original invitation code and verifiable proof obtained from the inviting party include: Broadcasting the VRF invitation code on the blockchain; The original invitation code and the verifiable certificate sent by the inviting party when receiving the broadcast are received.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Block chain verification code application method and device and storage medium
CN109995775A
Node synchronization method and device based on block chain, storage medium and server
CN113364874A
Promoter determination method and device and storage medium
CN113487345A
Blockchain-based information processing method and apparatus, and device
US20200202356A1