CN110363512B - Processing, creating and getting method and device for block chain red packet, medium and computer program - Google Patents

Processing, creating and getting method and device for block chain red packet, medium and computer program Download PDF

Info

Publication number
CN110363512B
CN110363512B CN201910632133.3A CN201910632133A CN110363512B CN 110363512 B CN110363512 B CN 110363512B CN 201910632133 A CN201910632133 A CN 201910632133A CN 110363512 B CN110363512 B CN 110363512B
Authority
CN
China
Prior art keywords
red packet
red
clause
address
witness
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
Application number
CN201910632133.3A
Other languages
Chinese (zh)
Other versions
CN110363512A (en
Inventor
耿强乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Weilian Information Technology Co Ltd
Original Assignee
Shanghai Weilian Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shanghai Weilian Information Technology Co Ltd filed Critical Shanghai Weilian Information Technology Co Ltd
Priority to CN201910632133.3A priority Critical patent/CN110363512B/en
Publication of CN110363512A publication Critical patent/CN110363512A/en
Application granted granted Critical
Publication of CN110363512B publication Critical patent/CN110363512B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/04Payment circuits
    • G06Q20/06Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme
    • G06Q20/065Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme using e-cash
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The disclosure provides a method and a device for processing, creating and obtaining a block chain red packet, a medium and a computer program. The method for processing the blockchain red packet comprises the following steps that at a node of a blockchain network: receiving a red packet issuing transaction request sent by a red packet initiator terminal; processing the red packet issuing transaction request, and responding to the successful processing to return a red packet ID to the red packet initiator terminal; receiving a red envelope getting transaction request sent by a red envelope getting person terminal; verifying the pickup signature; and in response to the receiving signature verification passing and the address of the red packet receiver not being in the received address list, calculating the red packet share of the red packet receiver and sending the red packet share to the red packet receiver. The method disclosed by the invention does not need a centralized server, realizes the creation and the distribution of the non-centralized red packet based on the block chain, and improves the safety of the red packet distribution and pickup process.

Description

Processing, creating and getting method and device for block chain red packet, medium and computer program
Technical Field
The invention relates to the field of block chains, in particular to a method and a device for processing, creating and obtaining a block chain red packet, a medium and a computer program.
Background
An important feature of the blockchain technology is that the information is completely open and transparent, and all people can view and download the data stored in the blocks at any time. The block chain technology has been developed into the 2.0 era, and the concept of intelligent contracts is introduced. Smart contracts provide the ability to implement data processing and business logic, enabling more and more extensive decentralized applications.
In conventional centralized applications, such as WeChat, the red envelope function has been implemented. A micro credit user can individually issue a red envelope to a specific contact or all members in a group, and the specific contact or any member in the group can obtain all or part of the money of the red envelope through a drawing operation.
However, in a tiled environment, it is not so easy to implement a fully decentralized and secure red packet application. This is because the red envelope application has a potential usage requirement that the issuing and retrieving of the red envelope need to be done in a scene controlled by the initiator of the red envelope, and only a specific object or group member can retrieve the red envelope. In other words, the red envelope creator does not want his red envelope to be taken away by other "irrelevant" people or even program scripts, causing a loss of funds on its own. This is easily solved in a centralized system, but becomes a problem in an open system with decentralized block chains.
Chinese patent application publication No. CN 108921525A discloses a processing method of block chain red packets, in which a server is introduced as an intermediary for performing task interaction between a client and an intelligent contract, and the block chain red packets are issued and received through the server.
However, in the above solution, the issue and the reception of the blockchain red packet by the server are equivalent to introducing a centralized server in the blockchain, which is contrary to the decentralized nature of the blockchain. Moreover, due to the introduction of the centralized server, the anti-crawling insect capability of the whole application is weak, and the fund safety is difficult to guarantee.
In addition, other schemes for implementing blockchain red packet applications are also contemplated including:
the method comprises the steps that a password is utilized, namely a red packet initiator sets a pickup password when creating a red packet, the pickup password is informed to a target crowd, and only a person who knows the pickup password can pick up the share of the red packet; or alternatively
With white lists, i.e. the red packet originator sets the white list when creating the red packet, so that only the user addresses in the white list can get away the share of the red packet.
However, for the above mentioned cryptographic scheme, the blockchain needs to store the password for verification when getting, and the information on the blockchain is publicly transparent (including transaction data body and intelligent contract storage), which means that all people, including malicious attackers, can obtain the information on the chain and even maliciously get away the red packet of other people.
On the other hand, for the white list scheme, although the problem of a malicious attacker can be solved, the work of collecting the white list is inefficient and troublesome, and does not conform to the use logic of the red packet, thereby hindering the popularization and use of the application.
Therefore, there is a need in the art for a blockchain red packet processing method and apparatus that can solve the above problems and directly interact between a client and a smart contract.
Disclosure of Invention
In order to solve at least one problem, the invention provides a block chain red packet solution for encryption under a chain and check on the chain.
Briefly, by asymmetric encryption techniques, a red envelope is created under a chain while a public-private key pair is generated, the public key is used for on-chain signature verification, and the private key is shared and propagated under the chain for a retriever to request shares of the red envelope from the chain.
Specifically, the present invention provides a method for processing blockchain red packets, the method comprising, at a node of a blockchain network:
receiving a red packet issuing transaction request sent by a red packet initiator terminal, wherein the red packet issuing transaction request is created based on red packet information input by a red packet initiator and a witness public key generated by the red packet initiator terminal;
processing the red packet issuing transaction request, and responding to the red packet issuing transaction request, and returning a red packet ID to the red packet initiator terminal after the processing is successful;
receiving a red packet getting transaction request sent by a red packet taker terminal, wherein the red packet getting transaction request comprises the red packet ID, the address of the red packet taker and a getting signature, and the getting signature is generated by the red packet taker terminal by signing the hash values of the red packet ID and the address of the red packet taker by using a witness private key which is shared by the red packet initiator and corresponds to the witness public key;
performing a hash operation on the red packet ID and the address of the red packet retriever to generate a first hash value, decrypting the retrievable signature by using the witness public key to obtain a second hash value, and comparing the first hash value and the second hash value to verify the retrievable signature; and
and in response to the receiving signature verification passing and the address of the red packet receiver not being in a received address list saved at the node of the block chain network, calculating the red packet share of the red packet receiver according to the red packet information and sending the red packet share to the red packet receiver.
In a preferred embodiment, the red packet information includes a total amount of red packets, a total number of red packet shares, and a red packet type.
In a preferred embodiment, the red packet information further includes message information of the red packet originator and/or a nickname of the red packet originator.
In a preferred embodiment, after said receiving said red envelope pickup transaction request, said method further comprises:
it is checked whether the red packet status is valid,
wherein checking whether the red packet status is valid comprises at least one of:
checking whether the red packet ID exists, checking whether the red packet is overdue, checking whether the number of the shares of the red packet which are not received is 0, and checking whether the address of the red packet receiver is in a received address list.
In a preferred embodiment, after calculating the red packet shares according to the red packet information and sending the red packet shares to the red packet retriever, the method further comprises:
recording the address of the red packet retriever into the retrieved address list; and
and updating the remaining total amount of the red packet and the number of the remaining red packet shares based on the red packet shares.
The invention also provides a method for creating a blockchain red packet, which comprises the following steps that at a red packet initiator terminal:
receiving red packet information input by a red packet initiator;
generating a witness key pair comprising a witness public key and a witness private key based on an asymmetric key generation algorithm;
creating a red packet issuing transaction request based on the red packet information and the witness public key and sending the red packet issuing transaction request to a blockchain network;
receiving a successful confirmation message for the red packet issuance transaction request from the blockchain network, the successful confirmation message including a red packet ID; and
sharing the red envelope ID and the witness private key with at least one candidate red envelope retriever.
In a preferred embodiment, the red packet information includes a total amount of red packets, a total number of red packet shares, and a red packet type.
In a preferred embodiment, the red packet information further includes message information of the red packet originator and/or a nickname of the red packet originator.
In a preferred embodiment, after receiving the red envelope information input by the red envelope initiator, the method further comprises:
and verifying the red envelope information input by the red envelope initiator to determine whether the red envelope information meets red envelope rules and/or whether the account balance of the red envelope initiator is greater than the total amount of the red envelope in the red envelope information.
In a preferred embodiment, the red envelope rules include at least one of total amount rules, quantity rules, and currency rules.
In a preferred embodiment, the method further comprises:
uploading the message information to an interplanetary file system to obtain a message link of the message information, wherein sharing the red packet ID and the witness private key with a plurality of candidate red packet retrievers further comprises:
and sharing the nickname of the red packet initiator and/or the message link of the message information to the candidate red packet retrievers.
In a preferred embodiment, the red packet issuance transaction request includes a first clause for indicating to a red packet contract on a node of the blockchain network a red packet in a first type of digital currency, the first clause including a first field, a second field, and a third field, wherein,
a first field of the first clause is configured to include an address of the red envelope contract to indicate a destination address of the first clause;
a second field of the first clause is configured to include a total red envelope amount in the red envelope information indicating a first type of digital currency to transfer the total red envelope amount to an address of the red envelope contract;
a third field of the first clause is configured to include a red packet type, a total number of red packets, and the witness public key or a witness address derived from the witness public key in the red packet information.
In a preferred embodiment, the red packet issuance transaction request includes a first clause and a second clause of an atomic operation, wherein the first clause is for indicating a red packet in the form of a second type of digital currency to a red packet contract on a node of the blockchain network, the second clause is for transferring the second type of digital currency of the total amount of the red packet to an address of the red packet contract, the first and second clauses each include a first field, a second field, and a third field, wherein,
a first field of the first clause is configured to include an address of the red envelope contract to indicate a destination address of the first clause;
the second field of the first clause is configured to a first predetermined value for indicating that the red packet issuance transaction request is not in the first type of digital currency;
a third field of the first clause is configured to include a red packet type, a total number of red packet shares, and the witness public key or a witness address derived from the witness public key in the red packet information;
the first field of the second clause is configured to include a contract address of the second type of digital currency to indicate a destination address of the second clause;
a second field of the second clause is configured to a second predetermined value for indicating that the second clause is not performing a transfer to a contract address of the second type of digital currency;
the third field of the second clause is configured to include the address of the red-envelope contract and the total amount of red-envelope money in the red-envelope information, and is used for indicating the second type of digital money of the total amount of red-envelope money transferred from the intelligent contract corresponding to the contract address of the second type of digital money to the address of the red-envelope contract.
In a preferred embodiment, the red packet issuance transaction request further includes a third clause, operating atomically with the first clause, for executing a transaction fee for a red packet pickup transaction submitted by a red packet retriever to an address of the red packet contract in the first type of digital currency, the third clause including a first field, a second field, and a third field, wherein,
the first field of the third clause is configured to include an address of the red envelope contract to indicate a destination address of the third clause;
a second field of the third clause is configured to receive a total transaction fee required for the red envelope, indicating a first type of digital currency to transfer the total transaction fee to an address of the red envelope contract;
the third field of the third clause is empty or configured to any default value.
In a preferred embodiment, the red packet issuance transaction request further includes a third clause, operating atomically with the first clause, for executing a payment of a transaction fee for a red packet pickup transaction submitted by a red packet retriever to an address of the red packet contract in a third type of digital currency, the third clause including a first field, a second field, and a third field, wherein,
the first field of the third clause is configured to include a contract address of the third type of digital currency to indicate a destination address of the third clause;
the second field of the third clause is configured to a third predetermined value for indicating that the third clause does not perform a transfer to a contract address of the third type of digital currency;
a third field of the third clause is configured to include a total transaction fee required for drawing the red envelope and the witness public key or a witness address derived from the witness public key, and is used for indicating that the intelligent contract corresponding to the contract address of the third type of digital currency transfers the third type of digital currency equal to the total transaction fee to the witness address.
The invention also provides a block chain red envelope pickup method, which is characterized by comprising the following steps that at a red envelope pickup terminal:
acquiring a red envelope ID and a witness private key shared by a red envelope initiator;
determining whether credible red packet information exists on the blockchain network or not based on the red packet ID and the witness private key;
in response to determining that trusted red packet information exists on the blockchain network, calculating a hash value for the red packet ID and an address of a red packet retriever, and signing the hash value with the witness private key to generate a retrievable signature;
creating a red envelope pickup transaction request based on the red envelope ID and the pickup signature, and sending the red envelope pickup transaction request to the blockchain network to pick up the red envelope.
In a preferred embodiment, determining whether trusted red envelope information exists on the blockchain network based on the red envelope ID and the witness key comprises:
calculating a first witness public key according to the witness private key;
acquiring a second witness public key corresponding to the red packet ID from the block chain network according to the red packet ID; and
and comparing the first witness public key and the second witness public key, and determining that the credible red packet information exists on the blockchain network when the first witness public key and the second witness public key are consistent.
In a preferred embodiment, determining whether trusted red envelope information exists on the blockchain network based on the red envelope ID and the witness key comprises:
calculating a first witness public key according to the witness private key, and calculating a first witness address according to the first witness public key;
acquiring a second witness address corresponding to the red packet ID from the block chain network according to the red packet ID;
comparing the first witness address and the second witness address and confirming the existence of authentic red packet information on the blockchain network when the two are identical.
In a preferred embodiment, the red envelope pickup transaction request includes a fourth clause for transferring an amount of digital currency from an address of a red envelope contract to an address of a red envelope picker, the fourth clause including a first field, a second field, and a third field, wherein,
the first field of the fourth clause is configured to include an address of a red envelope contract to indicate a destination address of the fourth clause;
the second field of the fourth clause is configured to a fourth predetermined value for indicating that the fourth clause does not perform a transfer to an address of the red envelope contract;
a third field of the fourth clause is configured to include the red envelope ID, the address of the red envelope retriever, and the retrieval signature.
The invention also provides a block chain red packet processing device, which comprises: a memory and a processor coupled to the memory, the memory having stored therein machine-executable instructions that, when executed by the processor, cause the processing device to perform the operations of the processing method described above.
The invention also provides a device for creating the block chain red packet, which comprises the following components: a memory and a processor coupled to the memory, the memory having stored therein machine-executable instructions that, when executed by the processor, cause the creation apparatus to perform the operations of the creation method described above.
The invention also provides a block chain red packet getting device, which comprises: a memory and a processor coupled to the memory, the memory having stored therein machine-executable instructions that, when executed by the processor, cause the fetcher to perform the operations of the fetcher method described above.
The present invention also provides a non-transitory computer readable storage medium having stored thereon machine executable instructions that, when executed by a computer, perform any one of the above-described blockchain red packet processing method, creation method, or extraction method.
The present invention also provides a computer program comprising machine executable instructions which, when executed, perform any one of the above-described blockchain red packet processing methods, creation methods or extraction methods.
The block chain red packet processing method, the device, the medium and the program realize the block chain transaction containing various digital currencies, and enrich the types of the block chain transaction so as to attract more people to participate in the use and development of the block chain.
Drawings
Fig. 1 shows a block diagram of a red packet processing system based on a blockchain according to an embodiment of the present disclosure.
Fig. 2 shows a flow chart of a processing method of blockchain red packets according to an embodiment of the present disclosure.
Fig. 3 illustrates a flow diagram of an exemplary method of processing a red packet issuance transaction request at a node of a blockchain network in accordance with an embodiment of the present disclosure.
Detailed Description
The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings so that the objects, features and advantages of the invention can be more clearly understood. It should be understood that the embodiments shown in the drawings are not intended to limit the scope of the present invention, but are merely intended to illustrate the essential spirit of the technical solution of the present invention.
In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the various disclosed embodiments. One skilled in the relevant art will recognize, however, that an embodiment can be practiced without one or more of the specific details. In other instances, well-known devices, structures and techniques associated with this application may not be shown or described in detail to avoid unnecessarily obscuring the description of the embodiments.
Throughout the specification and claims, the word "comprise" and variations thereof, such as "comprises" and "comprising," are to be understood as an open, inclusive meaning, i.e., as being interpreted to mean "including, but not limited to," unless the context requires otherwise.
Reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
As used in this specification and the appended claims, the singular forms "a", "an", and "the" include plural referents unless the context clearly dictates otherwise. It should be noted that the term "or" is generally employed in its sense including "and/or" unless the context clearly dictates otherwise.
Furthermore, the first, second, third and fourth elements used herein are merely used to indicate different elements and are not used to limit the order in which the elements appear in the scheme of the present invention. Indeed, the first, second, third and fourth herein may be replaced by any other distinctive language.
The following describes the block chain red packet processing method according to the present invention with reference to the drawings. The method is completed through interaction among the red packet initiator terminal, the block chain network and the red packet retriever terminal.
Fig. 1 shows a block diagram of a blockchain-based red packet processing system 10 according to an embodiment of the present disclosure. As shown in fig. 1, the red envelope processing system 10 includes a red envelope initiator terminal 100, at least one red envelope retriever terminal 110, and a blockchain network 120. The red envelope initiator terminal 100, the red envelope retriever terminal 110 and the blockchain network 120 may communicate with each other through a wired or wireless network.
The red envelope initiator terminal 100 and the red envelope retriever terminal 110 may be various types of devices including a memory and a processor, such as a desktop computer, a portable computer, a smart terminal, and the like.
Blockchain network 120 is a Peer-to-Peer (P2P) network that includes a plurality of interconnected Peer nodes 121-1, 121-2 through 121-N, each of which may be various types of devices including memory and processors. Each node of the blockchain network 120 runs a corresponding blockchain network protocol, thereby cooperatively realizing various functions of the whole blockchain network 120.
Fig. 2 shows a flowchart of a method 20 for processing blockchain red packets according to an embodiment of the present disclosure, which may be applied to the red packet processing system 10 shown in fig. 1 and executed by the red packet originator terminal 100, the red packet retriever terminal 110 and the blockchain network 120, respectively.
The method 20 includes a step 201 in which the red envelope originator terminal 100 receives red envelope information input by a user, i.e., a red envelope originator.
Specifically, the user may utilize the input interface of the red packet initiator terminal to operate in the interface of the red packet initiator terminal, so as to input red packet information, which may include a total amount of red packets, a total number of red packet shares, and a type of red packets. The total amount of the red packets refers to a total amount of the red packets sent by the red packet initiator this time and represented by a currency type of a certain digital currency, where the currency type of the digital currency may be a default currency of the blockchain network 120, which is also referred to as a native currency, or a contract currency supported by the blockchain network 120, that is, a digital currency managed by an intelligent contract in the blockchain network 120. Each red envelope retriever may receive a portion of the total amount of the red envelope, referred to as the red envelope share of the retriever. The total number of the red packet shares refers to the number of shares into which the total amount of the red packets sent this time can be split, that is, the number of red packet shares which can be received by the red packet receiver at most. The red envelope type may include, for example, evenly divided red envelopes or random red envelopes, depending on the manner in which each red envelope retriever may retrieve the share of the red envelope. The red packet sharing means that the red packet shares received by each receiver are the same, namely each red packet share is equal to the total amount of the red packets divided by the total number of the red packet shares; the random red envelope means that the share of the red envelope that each retriever receives is randomly determined by a red envelope contract on the blockchain network 120 or randomly determined according to a predetermined rule.
In some embodiments, the red envelope information may further include a red envelope validity period, the red envelope validity period defining a valid time of the red envelope, and the red envelope retriever may only retrieve the red envelope within the red envelope validity period. Those skilled in the art will appreciate that the present invention is not limited thereto, and in different implementations, the valid period of the red packet may be specified by the red packet issuer as described above, or may be preset by the system 10, for example, preset in the red packet contract of the red packet originator terminal 100 or the block chain network 120.
In some embodiments, the red packet information may also include message information and/or a nickname, etc. of the originator of the red packet. The message may be used to provide the recipient of the red envelope with some additional text message, such as a blessing message or an advertisement for a commercial company. The nickname allows the red packet retriever to know the identity of the red packet originator and not just the blockchain address.
In some embodiments, the red envelope information may also include the currency of the red envelope entered by the red envelope originator. The currency of the red envelope refers to the type of digital currency used to dispense the red envelope. In one implementation, system 10 supports only one type of digital currency, in which case the red envelope information received in step 201 may not include the currency. In other implementations, the system 10 supports multiple types of digital currency, including, for example, digital currency generated by the system 10 itself (also referred to as native currency) or generated and/or managed by respective intelligent contracts in the blockchain network 120 (also referred to as tokens or contracts). In this case, the red envelope information received in step 201 may include the currency of the red envelope entered by the red envelope originator.
In some implementations, step 201 may further include: the red envelope originator terminal 100 verifies the red envelope information input by the user after receiving the red envelope information, thereby determining whether the red envelope information conforms to the red envelope rule and/or determining whether the account balance of the red envelope originator is greater than or equal to the total amount of the red envelope in the red envelope information (not shown in the figure). For example, the red envelope rules may include one or any combination of total amount rules, quantity rules, and currency rules. The red envelope rule refers to a restriction on the content of the red envelope information input by the user. In particular, the total amount rules may include upper and/or lower limits on the total amount of the red-envelope, the quantity rules may include upper and/or lower limits on the total number of red-envelope shares, and the currency rules may include the digital currency type of the red-envelope supported by system 10. In some examples of the disclosure, the digital currency type of the red pack may be limited to, for example, native currency or tokens supported by the system 10.
In this case, step 201 may further include: if the red packet initiator terminal 100 determines that the red packet information input by the user does not conform to the red packet rule or the account balance of the red packet initiator is less than the total amount of the red packet in the red packet information, corresponding prompt information can be provided to the red packet issuer through the interface of the red packet initiator terminal 100.
In step 203, the red envelope originator terminal 100 generates a witness key pair including a witness public key and a witness private key based on an asymmetric key generation algorithm.
The asymmetric key generation algorithm in the present disclosure may include an RSA algorithm, an elliptic curve algorithm, etc. commonly used in the block chain technique, or other various types of asymmetric key generation algorithms. It will be appreciated that the method of generating a key pair comprising a witness public key and a witness private key may be any algorithm currently known in the blockchain art or developed in the future, and that implementations of the invention are not limited to any particular algorithm or method.
Preferably, the red envelope initiator terminal 100 may generate a witness key pair including a witness public key and a witness private key based on an Elliptic Curve Cryptography (ECC) algorithm, such as the secp256k1 algorithm. Compared with other asymmetric encryption algorithms such as RSA and the like, the elliptic curve encryption algorithm has a shorter private key and a faster speed under the same security strength, and the shorter private key means that the sharing and the spreading are easier.
In step 205, the red envelope initiator terminal 100 creates a red envelope issuance transaction request based on the received red envelope information and the generated witness public key.
The red packet issuance transaction request is used by the red packet initiator terminal 100 to initiate a red packet issuance transaction to the blockchain network 120, and the red packet issuance transaction request includes at least one clause, each clause being used to transmit different parameters to the blockchain network 120 to perform different functions. These at least one clause operates atomically, i.e., the request execution succeeds only if all clauses execute successfully, and conversely fails if any clause executes unsuccessfully.
According to the embodiment of the disclosure, the red packet issuing transaction request can be created in different manners according to different currencies of the red packets. Those skilled in the art will appreciate that the currency of the red envelope may be predetermined by the system 10 or may be entered by the originator of the red envelope.
In some embodiments, where the currency of the red packet is the default currency, i.e., the native currency of the blockchain network 120, the red packet issuance transaction request may include a first clause for indicating the red packet in the native currency to the red packet contract on the blockchain network. For example, the first clause may indicate in the Data field described below that the currency of the red packet is the native currency. Alternatively, the red packet may be indicated in other fields of the red packet issuance transaction request as being in the native currency. The red envelope contract is an intelligent contract deployed on a node of the blockchain network 120 for executing the red envelope processing method 20 according to the present invention, and the specific content thereof will be further described below. The first clause may include, for example, a To field, a Value field, and a Data field. Wherein the To field is configured To include an address of a red packet contract indicating To blockchain network 120 a destination address of a red packet issue transaction request; the Value field is configured to include a total amount of the red envelope in the red envelope information for indicating a native currency of the total amount of the red envelope transferred from the address of the originator of the red envelope to the address of the red envelope contract; the Data field is configured to include the red packet type, the total number of red packet shares, and the witness public key or witness address derived from the witness public key in the red packet information.
In other embodiments, where the currency of the red pack is a token, i.e., a contract currency managed by a corresponding intelligent contract supported by the blockchain network 120, the red pack issuance transaction request also requires authorization of the contract address of the token to perform the red pack issuance operation. In this case, two clauses may be included in the red packet issuance transaction request, one for implementing the red packet function and the other for implementing token authorization. Specifically, the red-envelope issuance transaction request may include a first clause and a second clause of an atomic operation, wherein the first clause is for indicating a red envelope in the form of a token to a red-envelope contract on the block chain network, and the second clause is for transferring the token of a total amount of the red envelope to an address of the red-envelope contract. The first clause and the second clause may each include a To field, a Value field, and a Data field. For example, the first clause may indicate in the Data field described below that the currency of the red envelope is a contract currency and/or a specific type of contract currency. Alternatively, the red envelope may be indicated in other fields of the red envelope issuance transaction request as being in the form of a contractual currency and/or a specific type of contractual currency.
Wherein the To field of the first clause is configured To include an address of a red envelope contract To indicate a destination address of the first clause; the Value field of the first clause is configured to a first predetermined Value, e.g., zero, for indicating that the red packet issuance transaction request is not in the form of a native currency; the Data field of the first clause is configured to include the red packet type, the total number of red packet shares, and the witness public key or a witness address derived from the witness public key in the red packet information. The witness address is derived from the witness public key, and for example, the witness address may be obtained by cutting a part of bits from the witness public key. Since witness public keys are typically long, witness addresses may be used to further reduce the amount of data for transactions sent to blockchain network 120, reducing the cost of blockchain transactions. In some embodiments, the Data field may also be configured to include one or more of a red packet expiration time or period, a nickname, message information, or a message link generated from message information. And after receiving the red packet issuing transaction request, the red packet contract processes the red packet issuing transaction request based on the content of the Data field of the first clause.
The To field of the second clause of the red envelope issuance transaction request is configured To include a contract address of the token for indicating a destination address of the second clause; the Value field of the second clause is configured to a second predetermined Value, such as zero, for indicating that the second clause does not perform a transfer to the contract address of the token; the Data field of the second clause is configured to include an address of the red-envelope contract and a total amount of red-envelope money in the red-envelope information, and is used for indicating the token of which the intelligent contract corresponding to the contract address of the token transfers the total amount of red-envelope money to the address of the red-envelope contract. The contract address of a token is the address of a token contract on blockchain network 120, the specific content of which will be further described below.
Typically, in a blockchain network, since processing transactions at blockchain nodes consumes certain code execution resources and memory resources, the corresponding processing nodes of the blockchain network charge a certain transaction fee in return. In a typical blockchain implementation, the transaction fee is paid by the transaction initiator and charged by the transaction processing node, and the transaction fee charged by the transaction processing node may be less than or equal to the transaction fee paid by the transaction initiator. In this case, the blockchain network 120 deducts a transaction fee required to perform the red packet issuing transaction from the account of the red packet originator when processing the red packet issuing transaction request transmitted from the red packet originator terminal 100, and deducts a transaction fee required to perform the red packet getting transaction from the account of the red packet taker when processing the red packet getting transaction request transmitted from the red packet taker terminal 110.
However, in some implementations of the present disclosure, the transaction fees for the red envelope issuance transaction and the red envelope pickup transaction may both be paid by the red envelope initiator, i.e., the red envelope issuer pays the transaction fee resulting from the red envelope pickup share by the red envelope pickup on behalf of the red envelope pickup. In this case, the red packet issuing transaction request may further include a third clause for paying the transaction fee to the red packet retriever, where the third clause is atomic operation with other clauses in the red packet issuing transaction request.
The third clause has various implementations depending on the currency of the transaction fee and the manner in which the transaction fee is obtained by the block chain node that processes the transaction.
In some implementations, the transaction fee is paid in the form of a native currency and the transaction fee obtained by processing the block link points of the transaction is from the red pack issuer. In this case, the third clause is used To execute a transaction fee for a red envelope pickup transaction submitted by a red envelope retriever To an address of a red envelope contract in native currency, and includes a To field, a Value field, and a Data field. Wherein the To field of the third clause is configured To include an address of a red envelope contract for indicating a destination address of the third clause; the Value field of the third clause is configured to draw the total transaction fee required for the red envelope, indicating the native currency of the total transaction fee to be transferred to the address of the red envelope contract; the Data field of the third clause may be configured as null or any default value.
In other implementations, the transaction fee is paid in the form of tokens and the transaction fee obtained by processing the block link points of the transaction is from the red envelope issuer. In this case, the third clause is used to perform a transaction fee for a red envelope pickup transaction submitted by a red envelope picker to an address of a red envelope contract with tokens. The token may be the same token as a token of the red-pack currency or may be a different token. For convenience of expression, a token for paying a transaction fee is hereinafter referred to as a transaction fee coin. The third clause includes a To field, a Value field, and a Data field, wherein the To field of the third clause is configured To include a contract address for a transaction fee To indicate a destination address of the third clause; the Value field of the third clause is configured to a third predetermined Value for indicating that the third clause does not perform a transfer to a contract address of the transaction fee; the Data field of the third clause is configured to include an address of the red envelope contract, a red envelope ID, and a total transaction fee required to pick up the red envelope, and is used for indicating that the transaction fee money contract transfers a transaction fee money equal to the total transaction fee from the address of the red envelope initiator to the address of the red envelope contract, and the transaction fee money contract is an intelligent contract corresponding to the contract address of the transaction fee money.
In still other implementations, transaction fees are paid in the form of tokens and obtained for the blockchain nodes that process the transaction are not from the red packet issuer but are automatically generated according to the underlying protocol of blockchain network 120. In this case, the transaction fee contained in the third clause by the transaction initiator is destroyed by the blockchain network 120, and the transaction fee for the node processing the transaction is regenerated for that node by the blockchain network 120. For this case, the third clause is used to perform payment of a transaction fee of the red envelope pickup transaction submitted by the red envelope pickup person to the witness address in a transaction fee. The third clause includes a To field, a Value field, and a Data field, wherein the To field of the third clause is configured To include a contract address for a transaction fee To indicate a destination address of the third clause; the Value field of the third clause is configured to a third predetermined Value for indicating that the third clause does not perform a transfer to a contract address of a transaction fee; the Data field of the third clause is configured to include a total transaction fee and a witness public key required for taking the red envelope or a witness address derived from the witness public key, and is used for indicating that the transaction fee money contract transfers the transaction fee money equal to the total transaction fee from the address of the initiator of the red envelope to the witness address, and the transaction fee money contract is an intelligent contract corresponding to the contract address of the transaction fee money. Here, since the witness address is only used for the issue and pickup process of the specific red envelope, it can be considered that this field is only used for indicating which transaction fee of the red envelope transaction is paid.
It should be appreciated that the first, second and third clauses described above in the red packet issuance transaction request represent three separate blockchain tasks. In other blockchain systems, the red envelope issuance transaction request may be implemented by two or three transaction requests that together include the corresponding tasks in the first, second, and third clauses described above. Further, those skilled in the art will appreciate that the order of the first, second, and third clauses described above is not limited to the order described above, but may appear in the red envelope issuance transaction request in any order.
After the red packet issuance transaction request is created, in step 207, the red packet originator terminal 100 sends the red packet issuance transaction request to the blockchain network 120 for processing by the blockchain network 120.
As described above, in some implementations, message information and/or nicknames of the originator of the red packet may be included with other red packet information in the red packet issuance transaction request, e.g., in the Data field of the first clause, and sent to blockchain network 120. However, in the case of the message content being too long, it would be costly to store it on the blockchain network. On the other hand, the left message often has no security requirement, so that the necessity of storing the left message on the blockchain network is not high. In this case, in some implementations of the method 20, the red packet issuance transaction request may not include the message information, but the red packet initiator terminal 100 uploads the message information to an external interplanetary file system (IPFS), the IPFS generates a message link of the message information, and shares the nickname of the red packet issuer and/or the message link of the message information with a plurality of candidate red packet retrievers, so that the receiver can see the nickname of the issuer and/or the message information by accessing the IPFS.
After receiving the red packet issuance transaction request sent by the red packet originator terminal 100, the blockchain network 120 processes the red packet issuance transaction request in step 209.
Intelligent contracts for implementing various functions are deployed on the blockchain network 120, the intelligent contracts run on various nodes of the blockchain network 120 according to underlying logic of the blockchain to execute the corresponding functions, and each intelligent contract can be called by an external node or other intelligent contracts to execute specific operations. Each intelligent contract has a unique address in the blockchain network 120, and nodes of the blockchain network 120 invoke the corresponding intelligent contract for processing in accordance with the destination address of each clause in the transaction request (e.g., the address indicated by the To field of the clause in the transaction request) when processing the transaction request.
Fig. 3 illustrates a flow chart of an exemplary method of processing a red packet issuance transaction request (step 209) at a node of a blockchain network according to an embodiment of the present disclosure.
Such as
As shown in fig. 3, after receiving the red packet issuance transaction request (step 2091), a node (e.g., node 121-1 of fig. 1) of the blockchain network 120 first determines whether the red packet is a red packet in the form of a native coin or a token based on the first clause of the red packet issuance transaction request (step 2092). For example, a node of blockchain network 120 may determine the currency of a red packet by the contents in the Data field of the first sentence. Alternatively, nodes of blockchain network 120 may determine the currency of the red packet by other fields in the red packet issuance transaction request. For a red packet in the form of a native currency, the nodes of the blockchain network 120 invoke a red packet contract for processing. The red envelope contract processes the red envelope issuance transaction request based on the Value field of the first clause and the parameters of the Data, including storing information such as the type of red envelope, the total number of red envelope shares, and the witness public key or witness address, and transferring the native currency from the address of the sender of the red envelope to the address of the red envelope contract (step 2093). For a red packet in token form, the nodes of blockchain network 120 invoke a red packet contract to store information such as the type of red packet, the total number of red packet shares, and a witness public key or witness address in response to the first clause; in response to the second clause invoking the token contract, i.e., the intelligent contract corresponding to the contract address of the token, an operation is performed to transfer the token from the address of the red envelope sender to the address of the red envelope contract (step 2094).
In some embodiments, the node of blockchain network 120 may also determine whether the transaction fee for the red envelope retriever to collect the share of the red envelope is paid by the red envelope initiator (step 2095), e.g., whether the third clause described above is included in the red envelope issuance transaction request. In response To determining that the transaction fee was paid by the red packet originator ("yes" decision at step 2095), it may be determined from the destination address in the To field of the third clause whether the transaction fee was paid in the form of a native currency or a transaction fee currency (step 2096), wherein the transaction fee currency may be the same type of digital currency as the red packet of tokens or a different type of digital currency supported by the block chain network 120 but different from the red packet of tokens. For transaction fees paid in the form of native coins, the nodes of the blockchain network 120 may invoke the red envelope contract to perform an operation of transferring the native coins of the total transaction fee from the address of the red envelope initiator to the address of the red envelope contract (step 2097). For transaction fees paid in the form of transaction fees, the nodes of the blockchain network 120 may invoke the transaction fee currency contract to perform an operation of transferring the transaction fee currency of the total transaction fee from the address of the red envelope initiator to the address of the red envelope contract (step 2098). Alternatively, in some other implementations, at step 2098, blockchain network 120 does not directly transfer the transaction fee from the address of the red envelope initiator to the address of the red envelope contract, but rather destroys the transaction fee in the red envelope initiator's red envelope issuance transaction request throughout blockchain network 120 and regenerates a certain number of transaction fee currencies in return for the node that processed the transaction. In this case, the transaction fee paid by the transaction initiator may be unrelated to the transaction fee obtained by the nodes of the blockchain network 120 processing the transaction.
In response to determining that the transaction fee is not paid by the red envelope originator (no, decision 2095), or that either of steps 2097 or 2098 performed successfully,
the flow of fig. 3 proceeds to step 2099, indicating that the execution of step 209 was successful. Conversely, if any of steps 2091 to 2098 fails to be executed, for example, due to a network failure, an insufficient account balance, etc., step 2099 may indicate that step 209 fails to be executed, which is not described in detail in this disclosure.
Those skilled in the art will appreciate that the flow of fig. 3 is merely exemplary and that the processing of the red packet issuance transaction request is not limited to the above-described sequence. For example, in many blockchain systems, the blockchain nexus first performs the process of charging a transaction fee, in which case steps 2095 through 2098 may be performed before step 2092.
After the process of fig. 3 is completed, the blockchain network 120 may perform consensus on the processing result and record the transaction in the distributed ledger stored in each node, which is not described herein again.
Returning to fig. 2, in response to successful processing of the red packet issuance transaction request by the blockchain network 120, in step 211, the red packet initiator terminal 100 obtains a successful confirmation message for the red packet issuance transaction request from the blockchain network 120. The successful confirmation message includes a red packet ID that uniquely corresponds to the red packet issuance transaction request.
Here, in some implementations, the red packet originator terminal 100 can query the blockchain network 120 for the processing result (success or failure) of the red packet issuance transaction request in a polling manner. Alternatively, in other implementations, the processing result may also be sent to the red packet originator terminal 100 by the blockchain network 120, for example, the processing result feedback mode is set to "subscribe" in advance by the red packet originator terminal 100 or the system 10.
After the red envelope originator terminal 100 obtains the successful confirmation message, in step 213, the red envelope ID included in the successful confirmation message and the witness secret key generated in step 203 are shared with at least one candidate red envelope retriever.
Specifically, the red envelope initiator terminal 100 may generate the pickup link and/or the two-dimensional code according to the red envelope ID and the witness private key, and then share the pickup link and/or the two-dimensional code with the candidate red envelope pickup.
The red envelope retriever uses the red envelope retriever terminal 110 to parse the two-dimensional code or the picking link by, for example, scanning the two-dimensional code or directly inputting the picking link to obtain the red envelope ID and the witness secret key shared by the red envelope initiator terminal 100.
Optionally, in some embodiments, the red envelope retriever terminal 110 may determine whether trusted red envelope information exists on the blockchain network 120 based on the red envelope ID and the witness key. Specifically, in one embodiment, the red packet retriever terminal 110 calculates a first witness public key according to the obtained witness private key, and obtains a second witness public key corresponding to the red packet ID from the blockchain network 120 according to the red packet ID. The red packet retriever terminal 110 then compares the first witness public key with the second witness public key, and when the first witness public key and the second witness public key are consistent, it is determined that trusted red packet information exists on the blockchain network 120, that is, it is determined that the red packet shared by the red packet issuer to the red packet retriever actually exists on the blockchain network 120. In another embodiment, the red envelope acquirer terminal 110 calculates the first witness public key according to the obtained witness private key, and thus calculates the first witness address corresponding to the first witness public key according to the first witness public key. In addition, the red packet retriever terminal 110 further obtains a second witness address corresponding to the red packet ID from the blockchain network 120 according to the red packet ID. The red packet retriever terminal 110 compares the first witness address with the second witness address, and when the first witness address and the second witness address are consistent, it is determined that the trusted red packet information exists on the block chain network 120, that is, it is determined that the red packet shared by the red packet issuer to the red packet retriever actually exists on the block chain network 120. Specifically, whether the object of comparison is a witness address or a witness public key depends on the settings of the system 10 to which the object of comparison corresponds.
In this context, the method of generating a public key from a private key and/or the method of generating an address from a public key may be any algorithm currently known in the blockchain art or developed in the future, and implementations of the invention are not limited to any particular algorithm or method.
After obtaining the red envelope ID and the witness private key, in step 215, the red envelope retriever terminal 110 may calculate a hash value for the red envelope ID and the address of the red envelope retriever through a hash algorithm, such as the keccak256 algorithm, and sign the hash value with the witness private key shared by the red envelope initiator to generate a retrievable signature. It should be noted that calculating the hash value for the red packet ID and the address of the red packet retriever refers to calculating the hash value for the combination of the red packet ID and the address of the red packet retriever, and no limitation is imposed on the manner of combination or the hash algorithm used for calculating the hash value.
Then, in step 217, the red envelope acquirer terminal 110 creates a red envelope acquisition transaction request based on the red envelope ID and the acquisition signature.
The red envelope pick-up transaction request may include a fourth clause for transferring an amount of digital currency from an address of a red envelope contract To an address of a red envelope picker, the fourth clause including a To field, a Value field, and a Data field, wherein the To field of the fourth clause is configured To include the address of the red envelope contract for indicating a destination address of the red envelope pick-up transaction request; the Value field of the fourth clause is configured to a fourth predetermined Value, such as zero, for indicating that the fourth clause is not used to perform a transfer to an address of a red envelope contract; the Data field of the fourth clause is configured to include the red packet ID, the address of the red packet retriever, and the retrieval signature.
In step 219, the red packet retriever terminal 110 sends a red packet retrieval transaction request to the blockchain network 120 to request retrieval of the red packet share of the red packet.
Here, in step 219 or before step 219, the red packet retriever terminal 110 may also sign the created red packet retriever transaction request with the witness private key and send the red packet retriever transaction request with the signature to the blockchain network 120 (not shown in the figure). In this case, the signature generated using the witness private key may be used directly to verify whether the red envelope pickup transaction request is a legitimate red envelope pickup request. For example, a node of blockchain network 120 may, after receiving the red packet pickup transaction request, decrypt the witness address based on the signature in the red packet pickup transaction request and compare the witness address to witness addresses stored on blockchain network 120 to verify whether the red packet pickup transaction request is from a legitimate address.
Upon receiving the red envelope pickup transaction request, a node of blockchain network 120 (e.g., node 121-2 shown in fig. 1) verifies the pickup signature in step 223.
Specifically, the nodes of the blockchain network 120 invoke the red envelope contract To verify the pickup signature based on the red envelope contract address in the To field of the fourth clause. For example, a red envelope contract may first hash a red envelope ID and an address of a red envelope retriever to generate a first hash value, decrypt the above-mentioned retrieval signature corresponding to a red envelope retrieval transaction request using a stored witness public key to obtain a second hash value, compare the first hash value with the second hash value to verify the retrieval signature. And when the first hash value is consistent with the second hash value, the claiming signature passes the verification, otherwise, the claiming signature does not pass the verification. If the claim signature verification fails, a transaction failure is returned to the red envelope retriever terminal 110.
Preferably, before verifying the pickup signature after the nodes of the blockchain network 120 receive the red packet pickup transaction request, the method 20 may further include: it is checked whether the red packet status is valid (step 221). In particular, a node of the blockchain network 120 may perform one or more of the following operations: checking whether the red packet ID exists, checking whether the red packet is overdue, checking whether the number of the shares of the red packet which are not received is 0, and judging whether the red packet receiver does not receive the shares of the red packet. In some embodiments, a red envelope contract for blockchain network 120 may set a picked address list and add the address of a red envelope picker that successfully picked a red envelope share to the picked address list. When a red packet getting transaction request is received, whether the address of the red packet taker is in the accepted address list or not is checked, and if the address of the red packet taker is not in the accepted address list, the red packet taker is determined not to have picked the red packet share.
Next, the red envelope contract on the blockchain network 120 calculates the red envelope share that should be taken by the red envelope retriever according to the red envelope information (step 225). For example, in one implementation, a red envelope contract may determine that the red envelope type of the red envelope is an evenly divided red envelope based on a red envelope ID. In this case, the red envelope contract calculates a quotient of the total amount of the red envelope divided by the total number of the red envelope shares in the red envelope information as the red envelope share of each red envelope, that is, the red envelope share that the red envelope retriever should take. For another example, in another implementation, a red envelope contract may determine that the red envelope type of the red envelope is a random red envelope based on the red envelope ID. In this case, the red envelope contract determines the red envelope share that should be allocated to the red envelope retriever according to the number of the remaining red envelope shares stored at the nodes of the blockchain network 120 and the remaining total amount of the red envelope. For example, specifically, when the number of remaining red pack shares is 1, the total amount of remaining red packs is allocated to the red pack retriever. And in the case that the number of the remaining red packages is more than 1, randomly taking a value from the total amount of the remaining red packages as the red package share to be distributed to the red package retriever.
Next, at step 227, the red envelope contract of the blockchain network 120 transfers the digital currency of the red envelope share determined at step 225 to the address of the red envelope retriever.
The method 20 may further include step 229, wherein after transferring the red packet shares that the red packet retriever should take to the address of the red packet retriever, the red packet contract of the blockchain network 120 records the address of the red packet retriever in the received address list and updates the remaining total amount of red packets and the number of remaining red packet shares.
The invention also provides a processing device of the block chain red packet, which comprises a memory and a processor, wherein the processor is coupled with the memory. The processor is configured to perform the steps performed by the blockchain network in the red packet processing method. The processing means may be or may be implemented, for example, in a node (e.g., nodes 121-1, 121-2, etc. shown in fig. 1) of the blockchain network 120 as described above in connection with fig. 1-3.
The invention also provides a device for creating the block chain red packet, which comprises a memory and a processor, wherein the processor is coupled with the memory. The processor is configured to perform the steps performed by the red packet originator terminal in the red packet handling method. The creating means may be or may be implemented in, for example, the red packet originator terminal 100 as described above in connection with fig. 1 to 3.
The invention also provides a device for getting the red packet of the block chain, which comprises a memory and a processor, wherein the processor is coupled with the memory. The processor is configured to perform the steps of the red envelope processing method performed by the red envelope retriever terminal. The retriever means may be or may be implemented in a red envelope retriever terminal 110 as described above in connection with fig. 1 to 3, for example.
According to the processing method 20 of the blockchain red packet, a centralized server is not needed, the creation and the distribution of the non-centralized red packet based on the blockchain are realized, and the safety of the red packet distribution and receiving process is improved. On the other hand, the method enriches the types of blockchain transactions, and can attract more people to participate in the use and development of blockchains.
In one or more exemplary embodiments, there is also provided a non-transitory computer readable storage medium comprising machine executable instructions executable by a computer to perform the steps performed by the red packet originator terminal 100, the red packet retriever terminal 110, or the nodes of the blockchain network 120 of the red packet processing method 20 of the present disclosure.
In one or more exemplary embodiments, there is also provided a computer program comprising machine executable instructions which, when executed, perform the steps performed by a red envelope initiator terminal 100, a red envelope retriever terminal 110 or a node of a blockchain network 120 in the red envelope processing method 20 of the present disclosure.
In one or more exemplary designs, the functions described in this disclosure may be implemented in hardware, software, firmware, or any combination thereof. For example, if implemented in software or firmware, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable storage medium.
The various components of the systems disclosed herein may be implemented using discrete hardware components or may be integrally implemented in a single hardware component. For example, the various exemplary components described in connection with the present disclosure may be implemented or performed with a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or a combination thereof.
These and other changes can be made to the embodiments in light of the above detailed description. In general, in the claims, the terms used should not be construed to be limited to the specific embodiments disclosed in the specification and the claims, but should be construed to include all possible embodiments along with the full scope of equivalents to which such claims are entitled.

Claims (26)

1. A method of processing blockchain red packets, the method comprising, at a node of a blockchain network:
receiving a red packet issuing transaction request sent by a red packet initiator terminal, wherein the red packet issuing transaction request is created based on red packet information input by a red packet initiator and a witness public key generated by the red packet initiator terminal;
processing the red packet issuing transaction request, and responding to the red packet issuing transaction request, and returning a red packet ID to the red packet initiator terminal after the processing is successful;
receiving a red packet pickup transaction request sent by a red packet picker terminal, wherein the red packet pickup transaction request comprises the red packet ID, an address of the red packet picker and a pickup signature, and the pickup signature is generated by the red packet picker terminal by signing hash values of the red packet ID and the address of the red packet picker by using a witness private key which is shared by the red packet initiator and corresponds to the witness public key;
performing a hash operation on the red packet ID and the address of the red packet retriever to generate a first hash value, decrypting the retrievable signature using the witness public key to obtain a second hash value, and comparing the first hash value and the second hash value to verify the retrievable signature; and
and in response to the picking signature verification passing and the address of the red packet picker not being in a picked address list saved at the node of the block chain network, calculating the red packet share of the red packet picker according to the red packet information and sending the red packet share to the red packet picker.
2. The method of claim 1, wherein the processing of blockchain red packets,
the red packet information comprises the total amount of the red packets, the total number of the red packet shares and the type of the red packets.
3. The method of claim 2, wherein the processing of the blockchain red packet,
the red packet information also comprises message information of the red packet initiator and/or a nickname of the red packet initiator.
4. The method of processing blockchain red packets according to claim 1, wherein after receiving the red packet pickup transaction request, the method further comprises:
it is checked whether the red packet status is valid,
wherein checking whether the red packet status is valid comprises at least one of:
checking whether the red packet ID exists, checking whether the red packet is expired, checking whether the number of shares of the red packet which are not received is 0, and checking whether the address of the red packet receiver is in the received address list.
5. The method of processing blockchain red packets according to claim 1, wherein after calculating a red packet share according to the red packet information and sending the red packet share to the red packet retriever, the method further comprises:
recording the address of the red packet retriever into the retrieved address list; and
and updating the remaining total amount of the red packet and the number of the remaining red packet shares based on the red packet shares.
6. A method of blockchain red packet creation, the method comprising, at a red packet originator terminal:
receiving red packet information input by a red packet initiator;
generating a witness key pair comprising a witness public key and a witness private key based on an asymmetric key generation algorithm;
creating a red packet issuing transaction request based on the red packet information and the witness public key and sending the red packet issuing transaction request to a blockchain network;
receiving a successful confirmation message for the red packet issuance transaction request from the blockchain network, the successful confirmation message including a red packet ID; and
sharing the red envelope ID and the witness private key with at least one candidate red envelope retriever.
7. The method of claim 6, wherein the block chain red packet is created by a special packet creation method,
the red packet information comprises the total amount of the red packets, the total number of the red packet shares and the type of the red packets.
8. The method of claim 7, wherein the block chain red packet,
the red packet information also comprises message information of the red packet initiator and/or a nickname of the red packet initiator.
9. The method of creating a blockchain red packet according to claim 6, wherein after receiving the red packet information inputted by the red packet initiator, the method further comprises:
and verifying the red packet information input by the red packet initiator to determine whether the red packet information meets a red packet rule and/or whether the account balance of the red packet initiator is greater than the total amount of the red packet in the red packet information.
10. The method of claim 9, wherein the block chain red packet,
the red packet rule comprises at least one of a total amount rule, a quantity rule and a currency rule.
11. The method of claim 8, further comprising:
uploading the message information to an interplanetary file system to obtain a message link of the message information, and sharing the red envelope ID and the witness private key with a plurality of candidate red envelope retrievers further comprises:
and sharing the nickname of the red packet initiator and/or the message link of the message information to the candidate red packet retrievers.
12. The method of blockchain red packet creation of claim 7 wherein the red packet information further includes a currency of a red packet indicating a first type of digital currency, the red packet issue transaction request including a first clause indicating a red packet in the first type of digital currency to a red packet contract on a node of the blockchain network, the first clause including a first field, a second field, and a third field, wherein,
a first field of the first clause is configured to include an address of the red envelope contract to indicate a destination address of the first clause;
a second field of the first clause is configured to include a total amount of red-envelope in the red-envelope information indicating a first type of digital currency to transfer the total amount of red-envelope to an address of the red-envelope contract; and
a third field of the first clause is configured to include a red packet type, a total number of red packet shares, and the witness public key or a witness address derived from the witness public key in the red packet information.
13. The method of creating a blockchain red packet according to claim 7, wherein the red packet information further includes a currency type of the red packet for indicating a second type of digital currency, the red packet issuance transaction request includes a first clause and a second clause of an atomic operation, wherein the first clause is used for indicating a red packet in the form of the second type of digital currency to a red packet contract on a node of the blockchain network, the second clause is used for transferring the second type of digital currency of the total amount of the red packet to an address of the red packet contract, the first clause and the second clause each include a first field, a second field, and a third field, wherein,
a first field of the first clause is configured to include an address of the red envelope contract to indicate a destination address of the first clause;
a second field of the first clause is configured to be a first predetermined value for indicating that the red envelope issuance transaction request is not in a first type of digital currency;
a third field of the first clause is configured to include a red packet type, a total number of red packet shares, and the witness public key or a witness address derived from the witness public key in the red packet information;
the first field of the second clause is configured to include a contract address of the second type of digital currency to indicate a destination address of the second clause;
a second field of the second clause is configured to a second predetermined value for indicating that the second clause is not performing a transfer to a contract address of the second type of digital currency; and
the third field of the second clause is configured to include an address of the red envelope contract and a total red envelope amount in the red envelope information, and is used for indicating the second type of digital currency of the total red envelope amount transferred by the intelligent contract corresponding to the contract address of the second type of digital currency to the address of the red envelope contract.
14. The method of creating a blockchain red packet according to claim 12 or 13, wherein the red packet issuance transaction request further includes a third clause operating atomically with the first clause, the third clause being for performing payment of a transaction fee for a red packet pickup transaction submitted by a red packet retriever to an address of the red packet contract in the first type of digital currency, the third clause including a first field, a second field, and a third field, wherein,
the first field of the third clause is configured to include an address of the red envelope contract to indicate a destination address of the third clause;
a second field of the third clause is configured to receive a total transaction fee required for the red envelope, indicating a first type of digital currency to transfer the total transaction fee to an address of the red envelope contract; and
the third field of the third clause is configured as null or any default value.
15. The method of creating a blockchain red packet according to claim 12 or 13, wherein the red packet issuance transaction request further includes a third clause operating atomically with the first clause, the third clause being for executing a transaction fee for a red packet pickup transaction submitted by a red packet taker to an address of the red packet contract in a third type of digital currency, the third clause including a first field, a second field, and a third field, wherein,
the first field of the third clause is configured to include a contract address of the third type of digital currency to indicate a destination address of the third clause;
the second field of the third clause is configured to a third predetermined value for indicating that the third clause does not perform a transfer to a contract address of the third type of digital currency;
a third field of the third clause is configured to include an address of the red envelope contract, the red envelope ID, and a total transaction fee required to earn the red envelope, for indicating that the smart contract to which the contract address of the third type of digital currency corresponds transfers the third type of digital currency to the address of the red envelope contract that is equal to the total transaction fee.
16. The method of creating a blockchain red packet according to claim 12 or 13, wherein the red packet issuance transaction request further includes a third clause operating atomically with the first clause, the third clause being for performing a payment of a transaction fee for a red packet pickup transaction submitted by a red packet taker to the witness address in a third type of digital currency, the third clause including a first field, a second field, and a third field, wherein,
the first field of the third clause is configured to include a contract address of the third type of digital currency to indicate a destination address of the third clause;
the second field of the third clause is configured to a third predetermined value for indicating that the third clause is not performing a transfer to a contract address of the third type of digital currency;
a third field of the third clause is configured to include a total transaction fee required for drawing the red envelope and the witness public key or a witness address derived from the witness public key, and is used for indicating that the intelligent contract corresponding to the contract address of the third type of digital currency transfers the third type of digital currency equal to the total transaction fee to the witness address.
17. A block chain red envelope pickup method, the method comprising, at a red envelope pickup terminal:
obtaining a red envelope ID and a witness private key shared by a red envelope initiator;
determining whether credible red packet information exists on the blockchain network based on the red packet ID and the witness private key;
in response to determining that trusted red packet information exists on the blockchain network, calculating a hash value for the red packet ID and an address of a red packet retriever, and signing the hash value with the witness private key to generate a retrievable signature; and
creating a red packet pickup transaction request based on the red packet ID and the pickup signature, and sending the red packet pickup transaction request to the blockchain network to pick up a red packet share of the red packet.
18. The method of claim 17, wherein determining whether trusted red packet information exists on a blockchain network based on the red packet ID and the witness key comprises:
calculating a first witness public key according to the witness private key;
acquiring a second witness public key corresponding to the red packet ID from the block chain network according to the red packet ID; and
comparing the first witness public key and the second witness public key and determining that trusted red envelope information exists on the blockchain network when the first witness public key and the second witness public key are identical.
19. The method of claim 17, wherein determining whether trusted red packet information exists on a blockchain network based on the red packet ID and the witness key comprises:
calculating a first witness public key according to the witness private key, and calculating a first witness address according to the first witness public key;
acquiring a second witness address corresponding to the red packet ID from the block chain network according to the red packet ID; and
comparing the first witness address and the second witness address and confirming the existence of authentic red packet information on the blockchain network when the two are consistent.
20. The method of claim 17, wherein the red envelope pickup transaction request includes a fourth clause for transferring an amount of digital currency from an address of a red envelope contract to an address of a red envelope picker, the fourth clause including a first field, a second field, and a third field, wherein,
the first field of the fourth clause is configured to include an address of the red envelope contract to indicate a destination address of the fourth clause;
the second field of the fourth clause is configured to a fourth predetermined value for indicating that the fourth clause does not perform a transfer to an address of the red envelope contract; and
a third field of the fourth clause is configured to include the red packet ID, the address of the red packet retriever, and the pickup signature.
21. The method of claim 17, wherein creating a red envelope pickup transaction request based on the red envelope ID and the pickup signature further comprises:
signing the red packet pickup transaction request by using the witness private key to generate the red packet pickup transaction request with the signature.
22. A device for processing blockchain red packets, comprising:
a memory and a processor coupled to the memory, the memory having stored therein machine-executable instructions that, when executed by the processor, cause the processing device to perform the method of any of claims 1-5.
23. An apparatus for creating a blockchain red packet, comprising:
a memory and a processor coupled to the memory, the memory having stored therein machine-executable instructions that, when executed by the processor, cause the creation apparatus to perform the method of any of claims 6-16.
24. A block chain red envelope getting device, comprising:
a memory and a processor coupled to the memory, the memory having stored therein machine-executable instructions that, when executed by the processor, cause the claiming device to perform the method of any of claims 17-21.
25. A non-transitory computer readable storage medium having stored thereon machine executable instructions which, when executed by a computer, perform the method of any one of claims 1-21.
26. A computer program product comprising machine executable instructions which when executed perform the method of any one of claims 1 to 21.
CN201910632133.3A 2019-07-12 2019-07-12 Processing, creating and getting method and device for block chain red packet, medium and computer program Active CN110363512B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910632133.3A CN110363512B (en) 2019-07-12 2019-07-12 Processing, creating and getting method and device for block chain red packet, medium and computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910632133.3A CN110363512B (en) 2019-07-12 2019-07-12 Processing, creating and getting method and device for block chain red packet, medium and computer program

Publications (2)

Publication Number Publication Date
CN110363512A CN110363512A (en) 2019-10-22
CN110363512B true CN110363512B (en) 2022-12-20

Family

ID=68219071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910632133.3A Active CN110363512B (en) 2019-07-12 2019-07-12 Processing, creating and getting method and device for block chain red packet, medium and computer program

Country Status (1)

Country Link
CN (1) CN110363512B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110827006A (en) * 2019-11-06 2020-02-21 杭州复杂美科技有限公司 Code scanning red packet generating method, equipment and storage medium
CN110912974A (en) * 2019-11-11 2020-03-24 深圳市亦区科技有限公司 Resource processing method and device, electronic equipment and computer readable storage medium
CN113379404A (en) * 2020-03-10 2021-09-10 本无链科技(深圳)有限公司 Bracelet-based hand-qi red envelope system and method
CN113205323A (en) * 2021-05-28 2021-08-03 中国工商银行股份有限公司 Red packet circulation method and device based on block chain
CN113592469A (en) * 2021-08-02 2021-11-02 杭州复杂美科技有限公司 Red packet processing method based on zero knowledge proof, computer equipment and storage medium
CN113627911A (en) * 2021-09-03 2021-11-09 杭州复杂美科技有限公司 Method, device and storage medium for anonymously receiving and sending red packet based on block chain
CN116452200B (en) * 2022-12-29 2024-05-31 胖迪科技(深圳)有限公司 Red packet receiving and sending method and device, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107220820A (en) * 2017-05-16 2017-09-29 腾讯科技(深圳)有限公司 Resource transfers method, device and storage medium
CN108108964A (en) * 2017-12-27 2018-06-01 上海唯链信息科技有限公司 A kind of Third-party payment based on block chain technology interconnects method
CN108921525A (en) * 2018-06-29 2018-11-30 北京金山安全软件有限公司 Processing method and device for block chain red packet, electronic equipment and medium
CN108985760A (en) * 2018-06-15 2018-12-11 杭州复杂美科技有限公司 Method of payment and system, equipment and storage medium
CN109741052A (en) * 2019-01-28 2019-05-10 杭州复杂美科技有限公司 Red packet processing method, equipment and storage medium
CN109784888A (en) * 2019-01-28 2019-05-21 杭州复杂美科技有限公司 Red packet processing method, equipment and storage medium
CN109919687A (en) * 2019-03-26 2019-06-21 阿里巴巴集团控股有限公司 Method and system are checked and write off in electronic ticket granting based on block chain and real-name authentication

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107146101A (en) * 2017-04-24 2017-09-08 杭州趣链科技有限公司 A kind of universal electric issuing preferential tickets method based on block chain
CN109711836A (en) * 2018-11-15 2019-05-03 远光软件股份有限公司 A kind of storage method of transaction, storage network and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107220820A (en) * 2017-05-16 2017-09-29 腾讯科技(深圳)有限公司 Resource transfers method, device and storage medium
CN108108964A (en) * 2017-12-27 2018-06-01 上海唯链信息科技有限公司 A kind of Third-party payment based on block chain technology interconnects method
CN108985760A (en) * 2018-06-15 2018-12-11 杭州复杂美科技有限公司 Method of payment and system, equipment and storage medium
CN108921525A (en) * 2018-06-29 2018-11-30 北京金山安全软件有限公司 Processing method and device for block chain red packet, electronic equipment and medium
CN109741052A (en) * 2019-01-28 2019-05-10 杭州复杂美科技有限公司 Red packet processing method, equipment and storage medium
CN109784888A (en) * 2019-01-28 2019-05-21 杭州复杂美科技有限公司 Red packet processing method, equipment and storage medium
CN109919687A (en) * 2019-03-26 2019-06-21 阿里巴巴集团控股有限公司 Method and system are checked and write off in electronic ticket granting based on block chain and real-name authentication

Also Published As

Publication number Publication date
CN110363512A (en) 2019-10-22

Similar Documents

Publication Publication Date Title
CN110363512B (en) Processing, creating and getting method and device for block chain red packet, medium and computer program
CN109075964B (en) Block chaining supporting multiple one-way functions for block verification
JP7364724B2 (en) Operating system for blockchain IoT devices
JP7436568B2 (en) Methods and systems realized by blockchain
TWI836003B (en) Computer-implemented systems and methods for implementing transfers over a blockchain network
US10747721B2 (en) File management/search system and file management/search method based on block chain
KR101857223B1 (en) Method and system for user identification based block chain token
KR101795695B1 (en) Method for providing archiving service and verification service of data transceived via messenger service and server using the same
US11228439B2 (en) Scale out blockchain with asynchronized consensus zones
US11551205B2 (en) Method for producing a cryptographical signed transaction
CN110770770A (en) Method and system for mining blockchain transactions provided by verifier nodes
CN113052599B (en) Method, device, equipment and system for generating, verifying and storing transaction certificates
WO2020160391A1 (en) An efficient, environmental and consumer friendly consensus method for cryptographic transactions
CN110910000A (en) Block chain asset management method and device
KR20220012344A (en) Blockchain transactions containing executable code for hash-based verification
CN111062717B (en) Data transfer processing method, device and computer readable storage medium
Kumar et al. The blockchain technology for secure and smart applications across industry verticals
JP7512294B2 (en) COMPUTER-IMPLEMENTED SYSTEM AND METHOD FOR PERFORMING TRANSFERS VIA A BLOCKCHAIN NETWORK
CN115836314A (en) Probabilistic membership testing of blockchain transaction outputs
CN117350715A (en) Payment method, account configuration method, system, device, equipment and medium
KR20220078254A (en) Method for processing transaction
Rubasinghe Transaction Verification Model for Peer-to-Peer Service-Oriented Digital Currency Transactions Based on the Foundation of Blockchain Architecture
JP2012104090A (en) Method for confirming identification information, server device for confirming identification information and system for confirming identification information
US20170180375A1 (en) System and method for push authorization
WO2016178076A1 (en) Load control of a transferable value or rights token

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