CN110363512A - The processing of block chain red packet creates, gets method and apparatus, medium and computer program - Google Patents

The processing of block chain red packet creates, gets method and apparatus, medium and computer program Download PDF

Info

Publication number
CN110363512A
CN110363512A CN201910632133.3A CN201910632133A CN110363512A CN 110363512 A CN110363512 A CN 110363512A CN 201910632133 A CN201910632133 A CN 201910632133A CN 110363512 A CN110363512 A CN 110363512A
Authority
CN
China
Prior art keywords
red packet
clause
address
block chain
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.)
Granted
Application number
CN201910632133.3A
Other languages
Chinese (zh)
Other versions
CN110363512B (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 Weichain Information Technology Co Ltd
Original Assignee
Shanghai Weichain 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 Weichain Information Technology Co Ltd filed Critical Shanghai Weichain 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

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

Abstract

The present disclosure proposes a kind of processing of block chain red packet, creates, gets method and apparatus, medium and computer program.The processing method of block chain red packet includes, at the node of block chain network: receiving the red packet that red packet initiator terminal is sent and provides transaction request;It handles red packet and provides transaction request, successfully return to red packet ID to red packet initiator terminal in response to handling;It receives the red packet that red packet receiver terminal is sent and gets transaction request;Signature is got in verifying;Signature verification passes through and the address of red packet receiver is not in having got address list in response to getting, and the red packet share for calculating red packet receiver simultaneously sends the red packet share to red packet receiver.Disclosed method is not necessarily to the server of centralization, realizes the creation and granting of the red packet of the decentralization based on block chain, improves red packet granting and get the safety of process.

Description

The processing of block chain red packet creates, gets method and apparatus, medium and computer Program
Technical field
The present invention relates to block chain fields, and in particular to a kind of processing of block chain red packet creates, gets method and dress It sets, medium and computer program.
Background technique
One important feature of block chain technology is exactly that information full disclosure is transparent, and owner can check and download at any time Save data within a block.Block chain technology developed to for 2.0 epoch, introduced the concept of intelligent contract.Intelligent contract provides The ability for realizing data processing and service logic, makes it possible more and wider decentralization application.
In conventional centralization application, such as in wechat, have been realized in red packet function.One wechat user can be with Individually all members to its particular contact or in from a group to the group issue red packet, the particular contact or Any member in the person group can obtain all or part of amount of money of the red packet by getting operation.
However, in block chain environment, realize a complete decentralization and safe and reliable red packet apply not that It is easy.This is because red packet application has a potential requirement, i.e., the granting of red packet and needs are got in a red packet It is completed in the controllable scene of promoter, only special object or group member can get the red packet.In other words, red packet is created The person of building is not intended to his red packet to be taken away by the people of other " irrelevant " even procedure script, to cause the monetary losses of oneself. This is easy to solve in centralized system, but becomes a difficulty in the open system of this decentralization of block chain Topic.
The Chinese patent application of 108921525 A of Publication No. CN discloses a kind of processing method of block chain red packet, The middle intermediary for introducing server and interacting as client with intelligent contract progress task, passes through server and realizes block chain red packet It provides and receives.
However, in the above scheme, realizing that the granting of block chain red packet and reception are equivalent in block by server The server of centralization is introduced in chain, the decentralization essence of this and block chain runs in the opposite direction.Also, due to centralization The introducing of server, so that the anti-crawler ability entirely applied is weaker, fund security is difficult to ensure.
Furthermore, it is contemplated that realize block chain red packet application other schemes further include:
Using password, i.e., red packet promoter is arranged when creating red packet gets password, and will get password and inform target person Group, only knows that this is got the talent of password and can take the share of red packet away;Or
Using white list, i.e. white list is arranged when creating red packet in red packet promoter, thus only in the white list Station address in list can just take the share of red packet away.
However, for above-mentioned cryptography scheme, verifying when needing to save password for getting on block chain, and block chain On information be all open and clear (including transaction data body and the storage of intelligent contract), it means that owner, including malice Attacker can obtain information on chain, or even malice takes other people red packet away.
On the other hand, for white list scheme, although the problem of can solve malicious attacker, white name is collected Single work is an inefficient and troublesome thing, does not also meet use the logic of red packet, thus can hinder the popularization applied with It uses.
Therefore, this field needs one kind to be able to solve the above problem, and directly interacts between client and intelligent contract Block chain red packet treating method and apparatus.
Summary of the invention
In order to solve the problems, such as it is above-mentioned at least one, the invention proposes encryption, the block chain verified on chain under a kind of chain are red Packet solution.
In simple terms, by asymmetric encryption techniques, public and private key key pair, public key are generated while red packet is created under chain The share for requesting red packet on chain for receiver is shared under chain and propagated to the sign test on chain, private key.
Specifically, the present invention provides a kind of processing method of block chain red packet, and the method includes in block chain network At node:
It receives the red packet that red packet initiator terminal is sent and provides transaction request, it is based on red that the red packet, which provides transaction request, It wraps the red packet information of promoter's input and the witness public key of red packet initiator terminal generation and creates;
It handles the red packet and provides transaction request, and provide transaction request in response to the red packet and handle successfully to described Red packet initiator terminal returns to red packet ID;
It receives the red packet that red packet receiver terminal is sent and gets transaction request, it includes described that the red packet, which gets transaction request, Red packet ID, the red packet receiver address and get signature, it is described to get signature by the red packet receiver terminal using institute Witness private key that red packet promoter shares, corresponding with the witness public key is stated to the ground of the red packet ID and red packet receiver The cryptographic Hash of both locations is signed and is generated;
Hash operation is carried out to generate the first cryptographic Hash to the address of the red packet ID and the red packet receiver, utilizes institute It states and gets signature described in witness public key decryptions to obtain the second cryptographic Hash, first cryptographic Hash and second cryptographic Hash To get signature described in verifying;And
Get that signature verification passes through and the address of the red packet receiver is not in the block chain network in response to described At node save got in address list, according to the red packet information calculate the red packet receiver red packet share and to The red packet receiver sends the red packet share.
In a preferred embodiment, the red packet information includes red packet total amount, red packet share total number and red packet type.
In a preferred embodiment, the red packet information further includes the message information of the red packet promoter and/or described The pet name of red packet promoter.
In a preferred embodiment, after the reception red packet gets transaction request, the method also includes:
Check whether red packet state is effective,
Wherein, check whether red packet state effectively comprises at least one of the following:
It checks that the red packet ID whether there is, checks whether the red packet is expired, check the red packet does not get share Whether whether number is 0, and check the address of the red packet receiver in having got address list.
In a preferred embodiment, red packet share is being calculated according to the red packet information and is being sent to the red packet receiver After the red packet share, the method also includes:
Described got in address list is recorded in the address of the red packet receiver;And
Remaining red packet total amount and remaining red packet share number are updated based on the red packet share.
The present invention also provides a kind of creation methods of block chain red packet, and the method includes at red packet initiator terminal:
Receive the red packet information of red packet promoter input;
Generated based on unsymmetrical key generating algorithm includes witness public key and the witness key pair for witnessing private key;
Transaction request is provided based on the red packet information and witness public key creation red packet and is sent to block chain network The red packet provides transaction request;
The success confirmation message that transaction request is provided for the red packet is received from the block chain network, the success is true Recognizing message includes red packet ID;And
Share the red packet ID and the witness private key at least one candidate red packet receiver.
In a preferred embodiment, the red packet information includes red packet total amount, red packet share total number and red packet type.
In a preferred embodiment, the red packet information further includes the message information of the red packet promoter and/or described The pet name of red packet promoter.
In a preferred embodiment, after the red packet information for receiving red packet promoter input, the method also includes:
The red packet information of red packet promoter input is verified, whether is met with the determination red packet information Whether the account balance of red packet rule and/or the red packet promoter are greater than the red packet total amount in the red packet information.
In a preferred embodiment, the red packet rule include total amount rule, quantity rule and currency type rule in extremely Few one kind.
In a preferred embodiment, the method also includes:
The message information is uploaded to interspace file system, obtains the message link of the message information, and wherein, Share the red packet ID and the witness private key to multiple candidate red packet receivers further include:
Share the pet name of the red packet promoter and/or disappearing for the message information to the multiple candidate red packet receiver Breath link.
In a preferred embodiment, it includes the first clause that the red packet, which provides transaction request, first clause be used for The red packet of red packet contract instruction first kind digital cash form on the node of the block chain network, the first clause packet Include the first field, the second field and third field, wherein
The first field of first clause is configured to include the address of the red packet contract, is used to indicate described first The destination address of clause;
The second field of first clause is configured to include the red packet total amount in the red packet information, is used to indicate The first kind digital cash of the red packet total amount is shifted to the address of the red packet contract;
The third field of first clause is configured to include red packet type, red packet total number in the red packet information And the witness address for witnessing public key or being derived from according to the witness public key.
In a preferred embodiment, the red packet provides the first clause and the second son that transaction request includes atomic operation Sentence, wherein first clause indicates Second Type digital cash for the red packet contract on the node of the block chain network The red packet of form, second clause are used to shift the Second Type number of the red packet total amount to the address of the red packet contract Word currency, first clause and the second clause include the first field, the second field and third field, wherein
The first field of first clause is configured to include the address of the red packet contract, is used to indicate described first The destination address of clause;
The second field of first clause is configured as first predetermined value, is used to indicate the red packet and provides transaction request It is not first kind digital cash form;
It is total that the third field of first clause is configured to include red packet type, red packet share in the red packet information Number and the witness public key or the witness address derived from according to the witness public key;
The first field of second clause is configured to include the contract address of the Second Type digital cash, is used for Indicate the destination address of second clause;
The second field of second clause is configured as second predetermined value, is used to indicate second clause not to described The contract address of Second Type digital cash executes and transfers accounts;
The third field of second clause is configured to include in the address and the red packet information of the red packet contract Red packet total amount, be used to indicate intelligent contract corresponding to the contract address of the Second Type digital cash to the red packet Shift the Second Type digital cash of the red packet total amount in the address of contract.
In a preferred embodiment, it further includes the with the first clause atomic operation that the red packet, which provides transaction request, Three clauses, the third clause are got with first kind digital cash to the address of red packet contract payment red packet for executing The red packet that person submits gets the transaction fee of transaction, and the third clause includes the first field, the second field and third field, In,
The first field of the third clause is configured to include the address of the red packet contract, is used to indicate the third The destination address of clause;
The second field of the third clause is configured as total transaction fee needed for getting the red packet, is used to indicate to institute Shift the first kind digital cash of total transaction fee in the address for stating red packet contract;
The third field of the third clause is sky or is configured as any default value.
In a preferred embodiment, it further includes the with the first clause atomic operation that the red packet, which provides transaction request, Three clauses, the third clause are got with third type digital cash to the address of red packet contract payment red packet for executing The red packet that person submits gets the transaction fee of transaction, and the third clause includes the first field, the second field and third field, In,
The first field of the third clause is configured to include the contract address of the third type digital cash, is used for Indicate the destination address of the third clause;
The second field of the third clause is configured as third predetermined value, is used to indicate the third clause not to described The contract address of third type digital cash executes and transfers accounts;
The third field of the third clause is configured to include total transaction fee needed for getting the red packet and described sees The witness address demonstrate,proving public key or being derived from according to the witness public key, is used to indicate the contract address of the third type digital cash Corresponding intelligent contract is equal to the third type digital cash of total transaction fee to witness address transfer.
Method is got the present invention also provides a kind of block chain red packet, which is characterized in that the method includes leading in red packet At taker terminal:
Obtain the red packet ID and witness private key that red packet promoter shares;
It is determined in block chain network based on the red packet ID and the witness private key with the presence or absence of believable red packet information;
In response to determining, there are believable red packet information in block chain network, to the ground of the red packet ID and red packet receiver Location calculates cryptographic Hash, and is signed the cryptographic Hash to generate and get signature with the witness private key;
Transaction request is got based on the red packet ID and the signature creation red packet of getting, and is sent out to the block chain network The red packet is sent to get transaction request to get red packet.
In a preferred embodiment, it determines and whether there is in block chain network based on the red packet ID and the witness private key Believable red packet information includes:
The first witness public key is calculated according to the witness private key;
The second witness public key corresponding with the red packet ID is obtained from the block chain network according to the red packet ID;And
Compare the first witness public key and the second witness public key, and determines the block chain when the two is consistent There are believable red packet information on network.
In a preferred embodiment, it determines and whether there is in block chain network based on the red packet ID and the witness private key Believable red packet information includes:
The first witness public key is calculated according to the witness private key, and the first witness is calculated according to the first witness public key Address;
The second witness corresponding with red packet ID address is obtained from the block chain network according to the red packet ID;
Compare the first witness address and second witness address, and confirms the block chain when the two is consistent There are believable red packet information on network.
In a preferred embodiment, it includes for certain from the transfer of the address of red packet contract that the red packet, which gets transaction request, For the digital cash of the amount of money to the 4th clause of the address of red packet receiver, the 4th clause includes the first field, the second field With third field, wherein
The first field of 4th clause is configured to include the address of red packet contract, is used to indicate the 4th clause Destination address;
The second field of 4th clause is configured as the 4th predetermined value, is used to indicate the 4th clause not to described The address of red packet contract executes and transfers accounts;
The third field of 4th clause is configured to include the red packet ID, the address of the red packet receiver and institute It states and gets signature.
The present invention also provides a kind of processing units of block chain red packet, comprising: memory and is couple to the memory Processor is stored with machine-executable instruction in the memory, when the machine-executable instruction is executed by the processor When, so that the processing unit executes the operation of above-mentioned processing method.
The present invention also provides a kind of creating devices of block chain red packet, comprising: memory and is couple to the memory Processor is stored with machine-executable instruction in the memory, when the machine-executable instruction is executed by the processor When, so that the creating device executes the operation of above-mentioned creation method.
Device is got the present invention also provides a kind of block chain red packet, comprising: memory and is couple to the memory Processor is stored with machine-executable instruction in the memory, when the machine-executable instruction is executed by the processor When, so that the device of getting executes the above-mentioned operation for getting method.
The present invention also provides a kind of non-volatile computer readable storage medium storing program for executing, are stored thereon with machine-executable instruction, The machine-executable instruction executes above-mentioned block chain red packet processing method, creation method or gets when being run by computer Any one of method.
The present invention also provides a kind of computer programs comprising machine-executable instruction, the machine-executable instruction exist Any one of execute above-mentioned block chain red packet processing method, creation method when being run or get method.
Above-mentioned block chain red packet processing method, device, medium and program realize the block comprising a variety of digital cash Chain transaction, enriches the type of block chain transaction, to attract more people to participate in the using and develop of block chain.
Detailed description of the invention
Fig. 1 shows the structural block diagram of the red packet processing system according to an embodiment of the present disclosure based on block chain.
Fig. 2 shows the flow charts of the processing method of block chain red packet according to an embodiment of the present disclosure.
Fig. 3 shows processing red packet at the node of block chain network according to an embodiment of the present disclosure and provides transaction request A kind of flow chart of illustrative method.
Specific embodiment
Presently preferred embodiments of the present invention is described in detail below with reference to attached drawing, it is of the invention to be clearer to understand Objects, features and advantages.It should be understood that embodiment shown in the drawings does not limit the scope of the present invention, and only it is Illustrate the connotation of technical solution of the present invention.
In the following description, elaborate certain details to provide for the purpose for illustrating various disclosed embodiments To the thorough understanding of various open embodiments.But it one skilled in the relevant art will recognize that can be in without these details One or more details the case where practice embodiment.Under other circumstances, well known device associated with this application, knot Structure and technology may not be illustrated in detail or describe to avoid unnecessarily obscuring the description of embodiment.
Unless context has other needs, and in the whole instruction and claim, word " comprising " and its modification, such as "comprising" and " having " should be understood meaning that is open, including, that is, should be interpreted that " including, but are not limited to ".
Expression is in conjunction with the embodiments described to be referred to " one embodiment " or " embodiment " throughout the specification Certain features, structure or feature are included at least one embodiment.Therefore, in each position of the whole instruction " at one In embodiment " or " in an embodiment " in appearance without all referring to identical embodiment.In addition, certain features, structure or feature It can combine in any way in one or more embodiments.
The singular as used in the specification and appended " one " and " described " include plural object, are removed It is clearly dictated otherwise in non-text.It should be noted that term "or" is usually used with the meaning that it includes "and/or", unless literary In clearly dictate otherwise.
In addition, used herein first, second, third and fourth is used only for indicating different elements, and do not have to In limiting the sequence that occurs in the solution of the present invention of the element.In fact, herein first, second, third and fourth can To be substituted for any other difference language.
Block chain red packet processing method according to the present invention is described with reference to the accompanying drawing.This method is whole by red packet promoter Interaction between end, block chain network and red packet receiver's terminal is completed.
Fig. 1 shows the structural block diagram of the red packet processing system 10 according to an embodiment of the present disclosure based on block chain.Such as Shown in Fig. 1, red packet processing system 10 includes red packet initiator terminal 100, at least one red packet receiver terminal 110 and block chain Network 120.Red packet initiator terminal 100, between red packet receiver terminal 110 and block chain network 120 can by wired or Wireless network is communicated.
It includes memory and processing that red packet initiator terminal 100 and red packet receiver terminal 110, which can be various types of, Device of device, such as desktop computer, portable computer, intelligent terminal etc..
Block chain network 120 be include multiple peer node 121-1 interconnected, 121-2 to 121-N's is point-to-point (Peer-to-Peer, P2P) network, each node can be various types of devices including memory and processor.Block Operation has corresponding block Network Protocols in Wideband on each node of chain network 120, thus the entire block chain network of cooperative achievement 120 various functions.
Fig. 2 shows the flow charts of the processing method 20 of block chain red packet according to an embodiment of the present disclosure, and this method can Applied in red packet processing system 10 shown in FIG. 1, accordingly by red packet initiator terminal 100,110 He of red packet receiver terminal Block chain network 120 is performed in unison with.
Method 20 includes step 201, wherein red packet initiator terminal 100 receives user, i.e. red packet promoter, input Red packet information.
Specifically, user can use the input interface of red packet initiator terminal in the interface of red packet initiator terminal into Row operation, to input red packet information, which may include red packet total amount, red packet share total number and red packet class Type.Wherein, red packet total amount refers to the total amount that this red packet sent of red packet promoter is indicated with the currency type of certain digital cash, Here the currency type of digital cash can be the default coin of block chain network 120, also referred to as primary coin, or block link network The contract coin that network 120 is supported passes through the digital cash of the intelligent contract administration in block chain network 120.Each red packet is got Person can get a part of the red packet total amount, which is known as the red packet share of the receiver.Red packet share total number refers to The quantity for the share that this red packet total amount sent can be split into, that is, at most get this for how many a red packet receivers The share of red packet.According to the method for determination for the red packet share that each red packet receiver can get, red packet type may include example Such as divide equally red packet or random red packet.Wherein, the red packet share that respectively red packet refers to that every receiver gets is identical, i.e., each red packet part Volume is equal to red packet total amount divided by red packet share total number;Random red packet refers to red packet share that every receiver gets by block chain Red packet contract on network 120 determines at random, or determines according to scheduled regular random.
In some embodiments, red packet information can also include red packet validity period, and red packet validity period is for limiting red packet Effective time, red packet receiver are only capable of getting red packet within red packet validity period.It will be understood by those skilled in the art that the present invention is simultaneously Not limited to this, in different realizations, red packet validity period, which can be, is as described above specified by red packet issuer, is also possible to It is preset by system 10, such as be preset in red packet initiator terminal 100 or the red packet contract of block chain network 120.
In some embodiments, red packet information can also include message information and/or pet name of red packet promoter etc..Its In, message information can be used for providing certain additional word messages, such as blessing language either commercial company to red packet receiver Advertisement.The pet name makes red packet receiver be known that the identity of red packet promoter and be not only block chain address.
In some embodiments, red packet information can also include the currency type of the red packet of red packet promoter input.The coin of red packet Kind refers to the type of the digital cash for providing red packet.In one implementation, system 10 only supports a type of digital goods Coin, in this case, received red packet information can not include currency type in step 201.In other realizations, system 10 Hold a plurality of types of digital cash, for example including system 10 itself generate digital cash (also referred to as primary coin) or by block Corresponding intelligent contract in chain network 120 generates and/or the digital cash (also referred to as token or contract coin) of management.This In the case of, received red packet information may include the currency type of the red packet of red packet promoter input in step 201.
In some implementations, step 201 can also include: that red packet initiator terminal 100 is receiving the red of user's input It is verified after package informatin, so that it is determined that whether the red packet information meets red packet rule and/or determine red packet promoter Account balance whether be greater than or equal to the red packet total amount (not shown) in red packet information.For example, red packet rule can be with Including one of total amount rule, quantity rule and currency type rule or any combination thereof.Red packet rule refers to user's input The limitation of the content of red packet information.Specifically, total amount rule may include the upper limit and/or lower limit of red packet total amount, quantity Rule may include the upper limit and/or lower limit of red packet share total number, and currency type rule may include the red packet that system 10 is supported Digital cash type.In some examples of the disclosure, the digital cash type of red packet can for example be limited to primary coin or be The token that system 10 is supported.
In this case, step 201 may further include: if red packet initiator terminal 100 determines user's input Red packet information do not meet red packet rule or red packet promoter account balance be less than red packet information in red packet total amount, then Corresponding prompt information can be provided to red packet issuer by the interface of red packet initiator terminal 100.
In step 203, red packet initiator terminal 100 be based on unsymmetrical key generating algorithm generate include witness public key and Witness the witness key pair of private key.
Unsymmetrical key generating algorithm in the disclosure may include common RSA Algorithm in block chain technology, oval song Line algorithm etc. or other various types of unsymmetrical key generating algorithms.It is appreciated that herein, generating includes that witness is public The method of the key pair of key and witness private key can be that block chain field is currently known or any algorithm of following exploitation, the present invention Realization be not limited to any specific algorithm or method.
Preferably, red packet initiator terminal 100 can be based on elliptic curve cryptography (ECC) algorithm, such as secp256k1 is calculated It includes witness public key and the witness key pair for witnessing private key that method, which generates,.Compared with other rivest, shamir, adelmans such as RSA, similarly Under security intensity, elliptic curve encryption algorithm has shorter private key and faster speed, and shorter private key means more to hold Easily shared and is propagated.
In step 205, red packet initiator terminal 100 is based on above-mentioned received red packet information and witness public key generated It creates red packet and provides transaction request.
Red packet provides transaction request and initiates red packet granting transaction to block chain network 120 for red packet initiator terminal 100, It includes at least one clause that red packet, which provides transaction request, each clause be used to transmit to block chain network 120 different parameters with Execute different functions.These at least one clauses operate in an atomic manner, that is, only when the equal successful execution of all clauses When, which just runs succeeded, on the contrary, any one clause's execution is unsuccessful, then the request executes failure.
In accordance with an embodiment of the present disclosure, red packet hair can be created according to the difference of the currency type of red packet in different ways Put transaction request.It will be understood by those skilled in the art that the currency type of red packet can be preset by system 10, it is also possible to by red Wrap promoter's input.
In some embodiments, when the currency type of red packet is default coin, the i.e. primary coin of block chain network 120, red packet granting Transaction request may include the first clause, which indicates primary coin form for the red packet contract in block chain network Red packet.For example, first clause can indicate that the currency type of the red packet is primary coin in Data field as described below.Or Person can also indicate that the red packet is primary coin form in other fields that red packet provides transaction request.Red packet contract is area That disposes on the node of block chain network 120 is used to execute the intelligent contract of red packet processing method 20 according to the present invention, Particular content be further described below.First clause for example may include To field, Value field and Data field. Wherein, To field is configured to include the address of red packet contract, for indicating that red packet provides transaction request to block chain network 120 Destination address;Value field is configured to include the red packet total amount in red packet information, is used to indicate from red packet promoter's Primary coin of the address to the address of red packet contract transfer red packet total amount;Data field is configured to include red in red packet information Packet type, red packet share total number and witness public key or the witness address derived from according to witness public key.
In further embodiments, the currency type of red packet be token, i.e., the block chain network 120 supported by corresponding intelligence When the contract coin of energy contract administration, red packet granting transaction request also needs to obtain the authorization of the contract address of the token to execute Red packet granting operation.In this case, it may include two clauses that red packet, which is provided in transaction request, a clause for realizing Red packet function, another clause for realizing token authorization.Specifically, it may include atomic operation that red packet, which provides transaction request, The first clause and the second clause, wherein the first clause for in block chain network red packet contract instruction token form it is red Packet, the second clause are used for the token to the address of red packet contract transfer red packet total amount.First clause and the second clause can be with Including To field, Value field and Data field.For example, first clause can indicate in Data field as described below The currency type of the red packet is the concrete type of contract coin and/or contract coin.Alternatively, can also red packet provide transaction request other Indicate that the red packet is the concrete type of contract coin form and/or contract coin in field.
Wherein, the To field of the first clause is configured to include the address of red packet contract, is used to indicate the mesh of the first clause Address;The Value field of first clause is configured as first predetermined value, such as zero, is used to indicate red packet and provides transaction request It is not primary coin form;It is total that the Data field of first clause is configured to include red packet type, red packet share in red packet information Number and witness public key or the witness address derived from according to witness public key.Wherein, from witness address is derived from by witness public key, Such as witness address can intercept partial bit from witness public key and obtain.It, can since witness public key is usually long To use witness address to be further reduced the data volume of the transaction sent to block chain network 120, the transaction of block chain is reduced Cost.In some embodiments, it includes red packet expired time or validity period which, which can be additionally configured to, the pet name, is stayed One or more of the message link saying information or being generated according to message information.Red packet contract receives red packet granting transaction and asks After asking, the contents processing of the Data field based on first clause red packet provides transaction request.
The To field that red packet provides the second clause of transaction request is configured to include the contract address of token, is used to indicate The destination address of second clause;The Value field of second clause is configured as second predetermined value, such as zero, is used to indicate second Clause does not execute to the contract address of token and transfers accounts;The Data field of second clause be configured to include red packet contract address and Red packet total amount in red packet information is used to indicate intelligent contract corresponding to the contract address of token to the address of red packet contract Shift the token of red packet total amount.The contract address of token is address of the token contract in block chain network 120, about token The particular content of contract will be further elucidated hereinbelow.
In general, executing resource since the transaction of block chain node processing needs to consume certain code in block chain network And storage resource, therefore the respective handling node of block chain network can collect certain tranaction costs as return.Common During block chain is realized, tranaction costs are paid by transaction initiator and are collected by transaction processing node, and transaction processing node is received The tranaction costs taken can be less than or equal to the tranaction costs of transaction initiator's payment.In this case, block chain network 120 When handling the red packet granting transaction request that red packet initiator terminal 100 is sent, deducting execution from the account of red packet promoter should Transaction fee needed for red packet granting transaction, and when the red packet for handling the transmission of red packet receiver terminal 110 gets transaction request, from The account of red packet receiver, which deducts, executes transaction fee needed for the red packet gets transaction.
However, in some realizations of the disclosure, the transaction fee that red packet granting transaction and red packet get transaction can be by Red packet promoter payment, that is, red packet issuer pays for red packet receiver since red packet receiver gets produced by red packet share Transaction fee.In this case, it can also include for taking for red packet receiver payment transaction that red packet, which is provided in transaction request, Third clause, it is atomic operation that third clause and red packet, which provide other clauses in transaction request,.
The mode for obtaining transaction fee depending on the currency type of transaction fee and the block chain node of processing transaction is different, third Sentence has a variety of different ways of realization.
In some implementations, transaction fee pays in the form of primary coin and handles the friendship that the block chain node of transaction obtains Easily take from red packet issuer.In this case, third clause is paid with primary coin to the address of red packet contract for executing The red packet that red packet receiver submits gets the transaction fee of transaction, and third clause includes To field, Value field and Data field. Wherein, the To field of third clause is configured to include the address of red packet contract, is used to indicate the destination address of third clause;The The Value field of three clauses is configured as total transaction fee needed for getting red packet, is used to indicate to the address of red packet contract and shifts The primary coin of total transaction fee;The Data field of third clause can be configured as empty or any default value.
In other realizations, transaction fee pays in the form of token and handles the friendship that the block chain node of transaction obtains Easily take from red packet issuer.In the case where this, third clause is paid with token to the address of red packet contract for executing The red packet that red packet receiver submits gets the transaction fee of transaction.The token can be identical token with the token of red packet currency type, It can be different token.For the sake of expression conveniently, the token for payment transaction expense is hereinafter referred to as transaction fee coin.The third Clause includes To field, Value field and Data field, wherein the To field of third clause is configured to include transaction fee coin Contract address, be used to indicate the destination address of third clause;The Value field of third clause is configured as third predetermined value, Third clause is used to indicate not transfer accounts to the execution of the contract address of transaction fee coin;The Data field of third clause is configured to include The address of red packet contract, red packet ID and total transaction fee needed for red packet is got, is used to indicate transaction fee coin contract and is initiated from red packet The address of person is equal to the transaction fee coin of total transaction fee to the transfer of the address of red packet contract, and transaction fee coin contract is the conjunction of transaction fee coin About intelligent contract corresponding to address.
In still other realization, transaction fee pays in the form of token and handles the friendship that the block chain node of transaction obtains Easily expense is not from red packet issuer but is automatically generated according to the underlying protocol of block chain network 120.In this case, it hands over The transaction fee that easy initiator includes in third clause is destroyed by block chain network 120, and handles the transaction of the node of the transaction Expense is that the node regenerates by block chain network 120.In this case, third clause is for executing with transaction fee coin to seeing The red packet that payment red packet receiver in card address submits gets the transaction fee of transaction.Third clause includes To field, Value field With Data field, wherein the To field of third clause is configured to include the contract address of transaction fee coin, is used to indicate third The destination address of sentence;The Value field of third clause is configured as third predetermined value, is used to indicate third clause not to transaction fee The contract address of coin executes and transfers accounts;The Data field of third clause is configured to include total transaction fee needed for getting red packet and sees The witness address demonstrate,proving public key or being derived from according to witness public key is used to indicate transaction fee coin contract from the address of red packet promoter to seeing The transaction fee coin that address transfer is equal to total transaction fee is demonstrate,proved, transaction fee coin contract is intelligence corresponding to the contract address of transaction fee coin Contract.Herein, since witness address is only used for the granting of the specific red packet and gets process, it can be considered that the field Be only used for instruction payment is the transaction fee of which red packet transaction.
It should be appreciated that above-mentioned first, second, and third clause that red packet is provided in transaction request represents three independent areas Block chain task.In other block catenary system, which, which provides transaction request, can pass through two or three transaction requests It realizes, the two or three transaction requests include the corresponding task in above-mentioned first, second, and third clause together.This Outside, it will be understood by those skilled in the art that the sequence of above-mentioned first, second, and third clause be not limited to it is described above suitable Sequence, but red packet can be appeared in any order and provided in transaction request.
After the red packet provides transaction request creation, in step 207, red packet initiator terminal 100 sends out the red packet It puts transaction request and is sent to block chain network 120 to be handled by block chain network 120.
As described above, in some implementations, the message information and/or the pet name of red packet promoter can be with other red packet information It is included in red packet together to provide in transaction request, such as included in the Data field of the first clause, and is sent to block link network Network 120.However, saving it in block chain network in the case where the information content of leaving a message is too long and will lead to operating cost height. On the other hand, message information is often without security requirement, therefore it is also not high to save it in the necessity in block chain network. In this case, in some realizations of method 20, it can not include message information that red packet, which provides transaction request, but, it is red Message information is uploaded to external interspace file system (IPFS) by packet initiator terminal 100, generates a message letter by IPFS The message of breath links, and shares the pet name of red packet issuer and/or the message of the message information to multiple candidate red packet receivers Link allows recipient to see the pet name and/or message information of issuer by accessing IPFS.
After the red packet that block chain network 120 receives the transmission of red packet initiator terminal 100 provides transaction request, in step 209 Transaction request is provided to the red packet to handle.
The useful intelligent contract in the various functions of realization is disposed in block chain network 120, these intelligent contracts are according to block The Lower level logical of chain is operated in execute corresponding function on each node of block chain network 120, and each intelligence contract can be with It is called by external node or other intelligent contracts thereby executing specific operation.Each intelligence contract is in block chain network 120 In have unique address, the node of block chain network 120 is when handling transaction request, according to clause's each in transaction request Destination address (such as address indicated by the To field of the clause in transaction request) calls corresponding intelligent contract to handle.
Fig. 3 shows processing red packet at the node of block chain network according to an embodiment of the present disclosure and provides transaction request A kind of flow chart of illustrative method of (step 209).
Such as
Shown in Fig. 3, red packet is received in the node (such as node 121-1 of Fig. 1) of block chain network 120 and provides transaction request After (step 2091), judge that the red packet is primary coin or token form according to the first clause that red packet provides transaction request first Red packet (step 2092).For example, the node of block chain network 120 can by the content in the Data field of the first words and expressions come Determine the currency type of red packet.Alternatively, the node of block chain network 120 can by red packet provide transaction request in other fields come Determine the currency type of red packet.For the red packet of primary coin form, the node of block chain network 120 calls red packet contract to be handled. The parameter processing of the Value field and Data red packet of red packet contract based on first clause provides transaction request, including storage The information such as red packet type, red packet share total number and witness public key or witness address, and shifted from the address of red packet sender Address (step 2093) of the primary coin to red packet contract.For the red packet of token form, the node of block chain network 120 in response to First clause calls red packet contract storage red packet type, red packet share total number and the information such as witness public key or witness address;It rings Token contract, i.e. intelligent contract corresponding to the contract address of token should be called in the second clause, executed from red packet sender's Operation (step 2094) of the address to the address of red packet contract transfer token.
In some embodiments, the node of block chain network 120 may also determine whether to pay red packet by red packet promoter Receiver gets the tranaction costs (step 2095) of red packet share, for example, can determine red packet provide transaction request in whether include Above-mentioned third clause.It, can be according to the in response to determining by red packet promoter's payment transaction expense (step 2095 is judged as "Yes") Destination address in the To field of three clauses judges that the tranaction costs are propped up by primary coin or in the form of transaction fee coin (step 2096) is paid, wherein transaction fee coin can be the digital cash with the token same type of red packet, be also possible to block chain Token different types of digital cash that network 120 is supported but with red packet.For in the form of primary coin pay tranaction costs, The node of block chain network 120 can call red packet contract execute from the address of red packet promoter shift the primary coin of total transaction fee to Operation (the step 2097) of the address of red packet contract.For the tranaction costs paid in the form of transaction fee coin, block chain network 120 Node transaction fee coin contract can be called to execute shift the transaction fee coin of total transaction fee from the address of red packet promoter and close to red packet Operation (the step 2098) of address about.Alternatively, in step 2098, block chain network 120 is not straight in some other realizations The address that transaction fee is transferred to red packet contract from the address of red packet promoter is connect, but is sold in entire block chain network 120 The transaction fee in the red packet granting transaction request of red packet promoter is ruined, and regenerates a fixed number to handle the node of the transaction Return of the transaction fee coin of amount as the node.In this case, the transaction fee and block link network that transaction initiator is paid The acquired transaction fee of the node processing transaction of network 120 can be incoherent.
In response to determining not by red packet promoter's payment transaction expense (step 2095 is judged as "No") or step 2097 Or 2098 run succeeded,
The process of Fig. 3 is transferred to step 2099, and instruction step 209 runs succeeded.On the contrary, if either step in 2091 to 2098 Failure is executed, such as due to network failure, account balance deficiency etc., then can indicate that step 209 executes failure in step 2099, To this, it will not go into details in the disclosure.
It will be understood by those skilled in the art that the process of Fig. 3 is only exemplary, the place of transaction request is provided red packet Reason is not limited to said sequence.For example, the place for collecting transaction fee is first carried out in block chain node in many block catenary systems Reason, in this case, step 2095 to 2098 can execute before step 2092.
After the process of Fig. 3 is completed, block chain network 120 can carry out common recognition to processing result and by the transaction record In the distributed account book that each node is saved, to this, it will not go into details herein.
Fig. 2 is returned, the red packet is successfully processed in response to block chain network 120 and provides transaction request, it is in step 211, red Packet initiator terminal 100 obtains the success confirmation message that transaction request is provided for the red packet from block chain network 120.The success Confirmation message includes red packet ID, and red packet ID and red packet granting transaction request are uniquely corresponding.
Here, in some implementations, red packet initiator terminal 100 can be inquired with polling mode to block chain network 120 The processing result (success or failure) of red packet granting transaction request.Alternatively, in other realizations, it can also be by block link network Network 120 sends the processing result to red packet initiator terminal 100, such as preparatory by red packet initiator terminal 100 or system 10 Processing result feedback system is set as " subscribing to ".
After red packet initiator terminal 100 obtains the success confirmation message, in step 213, at least one candidate red packet Receiver shares red packet ID wherein included and in step 203 witness private key generated.
Specifically, red packet initiator terminal 100 can get link and/or two dimension according to red packet ID and witness private key generation Then code will get link and/or two dimensional code be shared with candidate red packet receiver.
Red packet receiver gets link for example, by scanning the two-dimensional code or directly inputting using red packet receiver terminal 110, It parses the two dimensional code or gets link to obtain the red packet ID and witness private key that red packet initiator terminal 100 is shared.
Optionally, in some embodiments, red packet receiver terminal 110 can determine area based on red packet ID and witness private key It whether there is believable red packet information in block chain network 120.Specifically, in one embodiment, 110, red packet receiver terminal The first witness public key is calculated according to the witness private key of acquisition, and is obtained from block chain network 120 and red packet ID according to red packet ID Corresponding second witness public key.Then red packet receiver terminal 110 compares the first witness public key and the second witness public key, when It when the two is consistent, determines that there are believable red packet information in block chain network 120, that is, determines that red packet issuer is shared with red packet neck The red packet of taker necessary being in block chain network 120.In another embodiment, red packet receiver terminal 110 is according to obtaining The witness private key that takes calculates the first witness public key, to calculate the first witness public key corresponding the according to the first witness public key One witness address.In addition, red packet receiver terminal 110 is obtained from block chain network 120 and ID pairs of red packet also according to red packet ID The the second witness address answered.Red packet receiver terminal 110 compares the first witness address with the second witness address, when the two one It when cause, determines that there are believable red packet information in block chain network 120, that is, determines that red packet issuer is shared with red packet receiver's Red packet necessary being in block chain network 120.Specifically, the object compared is witness address or witness public key, is depended on The setting of system 10, the object compared are corresponding with the setting.
Herein, the method for public key is generated according to private key and/or block can be according to the method that public key generates address Chain field is currently known or any algorithm of following exploitation, realization of the invention are not limited to any specific algorithm or method.
Obtain red packet ID and witness private key after, in step 215, red packet receiver terminal 110 can by hash algorithm, Such as keccak256 algorithm is shown in the address calculation cryptographic Hash of red packet ID and red packet receiver, and with what red packet promoter shared Card private key signs to generate and get signature to the cryptographic Hash.It should be noted that the address to red packet ID and red packet receiver is counted Cryptographic Hash is calculated, refers to that the combination to both addresses of red packet ID and red packet receiver calculates cryptographic Hash, herein not to combined side Formula calculates the progress any restrictions of hash algorithm used in cryptographic Hash.
Then, in step 217, red packet receiver terminal 110 is based on red packet ID and gets signature creation red packet and get friendship Easily request.
Red packet get transaction request may include for shifted from the address of red packet contract the digital cash of certain amount of money to 4th clause of the address of red packet receiver, the 4th clause include To field, Value field and Data field, wherein the 4th son The To field of sentence is configured to include the address of red packet contract, is used to indicate the destination address that red packet gets transaction request;4th The Value field of clause is configured as the 4th predetermined value, such as zero, is used to indicate the 4th clause and is not used in ground to red packet contract Location executes and transfers accounts;The Data field of 4th clause be configured to include red packet ID, red packet receiver address and get signature.
In step 219, red packet receiver terminal 110 by red packet get transaction request be sent to block chain network 120 with The red packet share of the red packet is got in request.
Here, in step 219 or before step 219, red packet receiver terminal 110 can also utilize witness private key Transaction request is got to the red packet created to sign, and the red packet with the signature is got into transaction request and is sent to block 120 (not shown) of chain network.In this case, verifying red packet is used directly for using the signature that witness private key generates Get whether transaction request is that legal red packet gets request.For example, the node of block chain network 120 can be to receive this red After packet gets transaction request, the signature in transaction request is got according to the red packet and decrypts witness address, and address will be witnessed It is compared with the witness address stored in block chain network 120 to verify the red packet and whether get transaction request from legal Address.
After receiving the red packet and getting transaction request, in step 223, the node of block chain network 120 (such as Fig. 1 Shown in node 121-2) verify to getting signature.
Specifically, the red packet contract address in To field of the node of block chain network 120 based on the 4th clause is called red Inclusion is about verified to getting signature.For example, red packet contract can the address first to red packet ID and red packet receiver breathe out Operation is wished to generate the first cryptographic Hash, utilizing stored witness public key to get red packet, transaction request is corresponding above-mentioned to get label Name is decrypted to obtain the second cryptographic Hash, is compared to the first cryptographic Hash and the second cryptographic Hash to verify this and gets signature. When the first cryptographic Hash is consistent with the second cryptographic Hash, gets signature verification and pass through, otherwise verify and do not pass through.If getting signature to test Card does not pass through, then returns to Fail Transaction to red packet receiver terminal 110.
Preferably, the node in block chain network 120 receives red packet and gets and carries out to getting signature after transaction request Before verifying, whether effectively method 20 can also include: to examine red packet state (step 221).Specifically, block chain network 120 Node it is executable following operate it is one or more: check that red packet ID whether there is, check whether red packet expired, check red Packet does not get whether share number is 0, and judges whether red packet receiver not yet got the red packet share of the red packet. In some embodiments, the red packet contract of block chain network 120, which can be set, has got address list and will successfully get red packet The address of the red packet receiver of share is added and has got in address list.After receiving red packet and getting transaction request, check that this is red The address of receiver is wrapped whether in having got address list, if not getting address list, it is determined that the red packet is got Person not yet got the red packet share.
Next, the red packet contract in block chain network 120 calculates what red packet receiver should get according to red packet information Red packet share (step 225).For example, in one implementation, red packet contract can determine the red packet class of the red packet based on red packet ID Type is respectively red packet.In this case, the red packet total amount that red packet contract calculates in red packet information is always a divided by red packet share Red packet share of several quotient as each red packet, that is, the red packet share that red packet receiver should get.In another example in another kind In realization, red packet contract can determine that the red packet type of the red packet is random red packet based on red packet ID.In this case, red packet Remaining red packet share number that contract is stored at the node according to block chain network 120 and remaining red packet total amount it is determined that Distribute to the red packet share of red packet receiver.For example, specifically, it, will be remaining in the case where remaining red packet share number is 1 Red packet total amount is fully allocated to red packet receiver.And in the case where remaining red packet number is greater than 1, it is always golden from remaining red packet Take a value as the red packet share that distribute to red packet receiver in volume at random.
Next in step 227, the red packet contract of block chain network 120 is by the number of red packet share determined by step 225 Word currency is transferred to the address of red packet receiver.
Method 20 can also include step 229, wherein being transferred to red packet in the red packet share that should get red packet receiver After the address of receiver, the address of red packet receiver is recorded the red packet contract of block chain network 120 has got address column In table, and update remaining red packet total amount and remaining red packet share number.
The present invention also provides a kind of processing unit of block chain red packet, which includes memory and processor, the processing Device is coupled to the memory.The processor is configured to execute the step of being executed in red packet processing method by block chain network. The processing unit for example can be or may be implemented the node in the as above block chain network 120 in conjunction with described in Fig. 1 to Fig. 3 In (node 121-1,121-2 as shown in Figure 1 etc.).
The present invention also provides a kind of creating device of block chain red packet, which includes memory and processor, the processing Device is coupled to the memory.The processor is configured to execute the step executed in red packet processing method by red packet initiator terminal Suddenly.The creating device for example be can be or be may be implemented in the as above red packet initiator terminal 100 in conjunction with described in Fig. 1 to Fig. 3 In.
The present invention also provides a kind of device of getting of block chain red packet, including memory and processor, the processor with deposit Reservoir coupling.The processor is configured to execute the step of being executed in red packet processing method by red packet receiver's terminal.It should Getting device for example can be or may be implemented in the as above red packet receiver terminal 110 in conjunction with described in Fig. 1 to Fig. 3.
It can be seen that the server that the disclosure is not necessarily to centralization by the processing method 20 of the block chain red packet of the disclosure, The creation and granting for realizing the red packet of the decentralization based on block chain improve red packet granting and get the safety of process Property.On the other hand, the disclosure enriches the type of block chain transaction, and more people can be attracted to participate in using and opening for block chain In hair.
In one or more exemplary embodiments, additionally provide a kind of including the non-volatile of machine-executable instruction Computer readable storage medium, above-metioned instruction can be run by computer to execute in the red packet processing method 20 of the disclosure by red packet The step of node of initiator terminal 100, red packet receiver terminal 110 or block chain network 120 executes.
In one or more exemplary embodiments, a kind of computer program is additionally provided comprising machine is executable Instruction, which executes when being run is got in the red packet processing method 20 of the disclosure by red packet initiator terminal 100, red packet The step of node of person's terminal 110 or block chain network 120 executes.
In one or more exemplary designs, this can be realized with hardware, software, firmware or their any combination The open function.For example, can be instructed the function as one or more if realized with software or firmware Or code is stored on computer readable storage medium, or as the one or more instruction on computer readable storage medium Or code transmits.
Discrete hardware components can be used to realize in each component part of system disclosed herein, and it is real also to can integrate ground A present hardware component.For example, general processor, digital signal processor (DSP), specific integrated circuit can be used (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hard Part component or combinations thereof combines various illustrative component parts described in the disclosure to realize or execute.
In view of detailed descriptions above, these and other variation can be made to embodiment.In general, in claim In, term used should not be construed as limited to specific embodiment disclosed in description and claims, but be understood that Being includes whole equivalency ranges that all possible embodiment is enjoyed together with these claims.

Claims (26)

1. a kind of processing method of block chain red packet, which is characterized in that the method includes at the node of block chain network:
It receives the red packet that red packet initiator terminal is sent and provides transaction request, the red packet, which provides transaction request, to be sent out based on red packet It plays the red packet information of person's input and the witness public key of red packet initiator terminal generation and creates;
It handles the red packet and provides transaction request, and provide transaction request in response to the red packet and handle successfully to the red packet Initiator terminal returns to red packet ID;
It receives the red packet that red packet receiver terminal is sent and gets transaction request, it includes the red packet that the red packet, which gets transaction request, ID, the red packet receiver address and get signature, it is described to get signature by the red packet receiver terminal using described red Witness private key that promoter shares, corresponding with the witness public key is wrapped to the ground of the red packet ID and the red packet receiver The cryptographic Hash of both locations is signed and is generated;
Hash operation is carried out to generate the first cryptographic Hash to the address of the red packet ID and the red packet receiver, is seen using described Signature is got described in card public key decryptions to obtain the second cryptographic Hash, first cryptographic Hash and second cryptographic Hash are to test Signature is got described in card;And
Get that signature verification passes through and the address of the red packet receiver is not in the node of the block chain network in response to described What place saved has got in address list, calculates the red packet share of the red packet receiver according to the red packet information and to described Red packet receiver sends the red packet share.
2. the processing method of block chain red packet according to claim 1, which is characterized in that
The red packet information includes red packet total amount, red packet share total number and red packet type.
3. the processing method of block chain red packet according to claim 2, which is characterized in that
The red packet information further includes the message information of the red packet promoter and/or the pet name of the red packet promoter.
4. the processing method of block chain red packet according to claim 1, which is characterized in that get friendship receiving the red packet Easily after request, the method also includes:
Check whether red packet state is effective,
Wherein, check whether red packet state effectively comprises at least one of the following:
It checks that the red packet ID whether there is, checks whether the red packet is expired, check the red packet does not get share number Whether it is 0, and checks whether the address of the red packet receiver has got in address list described.
5. the processing method of block chain red packet according to claim 1, which is characterized in that according to the red packet information meter After calculating red packet share and sending the red packet share to the red packet receiver, the method also includes:
Described got in address list is recorded in the address of the red packet receiver;And
Remaining red packet total amount and remaining red packet share number are updated based on the red packet share.
6. a kind of creation method of block chain red packet, which is characterized in that the method includes at red packet initiator terminal:
Receive the red packet information of red packet promoter input;
Generated based on unsymmetrical key generating algorithm includes witness public key and the witness key pair for witnessing private key;
Transaction request is provided based on the red packet information and witness public key creation red packet and to described in the transmission of block chain network Red packet provides transaction request;
The success confirmation message that transaction request is provided for the red packet is received from the block chain network, the successfully confirmation disappears Breath includes red packet ID;And
Share the red packet ID and the witness private key at least one candidate red packet receiver.
7. the creation method of block chain red packet according to claim 6, which is characterized in that
The red packet information includes red packet total amount, red packet share total number and red packet type.
8. the creation method of block chain red packet according to claim 7, which is characterized in that
The red packet information further includes the message information of the red packet promoter and/or the pet name of the red packet promoter.
9. the creation method of block chain red packet according to claim 6, which is characterized in that receiving red packet promoter input Red packet information after, the method also includes:
The red packet information of red packet promoter input is verified, whether red packet is met with the determination red packet information Whether the account balance of the regular and/or described red packet promoter is greater than the red packet total amount in the red packet information.
10. the creation method of block chain red packet according to claim 9, which is characterized in that
The red packet rule includes at least one of total amount rule, quantity rule and currency type rule.
11. the creation method of block chain red packet according to claim 9, which is characterized in that the method also includes:
The message information is uploaded to interspace file system, obtains the message link of the message information, and wherein, Xiang Duo A candidate red packet receiver shares the red packet ID and the witness private key further include:
Share the pet name of the red packet issuer and/or the chain of messages of the message information to the multiple candidate red packet receiver It connects.
12. the creation method of block chain red packet according to claim 6, which is characterized in that the red packet information further includes The currency type of red packet, is used to indicate first kind digital cash, and it includes the first clause that the red packet, which provides transaction request, and described first Red packet of the clause for the red packet contract instruction first kind digital cash form on the node of the block chain network, it is described First clause includes the first field, the second field and third field, wherein
The first field of first clause is configured to include the address of the red packet contract, is used to indicate first clause Destination address;
The second field of first clause is configured to include the red packet total amount in the red packet information, is used to indicate to institute Shift the first kind digital cash of the red packet total amount in the address for stating red packet contract;And
The third field of first clause is configured to include red packet type, red packet share total number in the red packet information And the witness address for witnessing public key or being derived from according to the witness public key.
13. the creation method of block chain red packet according to claim 6, which is characterized in that the red packet information further includes The currency type of red packet, is used to indicate Second Type digital cash, and the red packet provides the first son that transaction request includes atomic operation Sentence and the second clause, wherein first clause indicates the second class for the red packet contract on the node of the block chain network The red packet of type digital cash form, second clause are used to shift the red packet total amount to the address of the red packet contract Second Type digital cash, first clause and the second clause include the first field, the second field and third field, In,
The first field of first clause is configured to include the address of the red packet contract, is used to indicate first clause Destination address;
The second field of first clause is configured as first predetermined value, and being used to indicate the red packet granting transaction request is not First kind digital cash form;
The third field of first clause is configured to include red packet type, red packet share total number in the red packet information And the witness address for witnessing public key or being derived from according to the witness public key;
The first field of second clause is configured to include the contract address of the Second Type digital cash, is used to indicate The destination address of second clause;
The second field of second clause is configured as second predetermined value, is used to indicate second clause not to described second The contract address of type digital cash executes and transfers accounts;And
The third field of second clause is configured to include red in the address and the red packet information of the red packet contract Packet total amount is used to indicate intelligent contract corresponding to the contract address of the Second Type digital cash to the red packet contract Address shift the Second Type digital cash of the red packet total amount.
14. the creation method of block chain red packet according to claim 12 or 13, which is characterized in that the red packet granting is handed over Easily request further includes the third clause with the first clause atomic operation, and the third clause is for executing with the first kind Type digital cash gets the transaction fee of transaction to the red packet that the address of red packet contract payment red packet receiver submits, and described the Three clauses include the first field, the second field and third field, wherein
The first field of the third clause is configured to include the address of the red packet contract, is used to indicate the third clause Destination address;
The second field of the third clause is configured as total transaction fee needed for getting the red packet, is used to indicate to described red Shift the first kind digital cash of total transaction fee in the address of inclusion about;And
The third field of the third clause is to be configured as empty or any default value.
15. the creation method of block chain red packet according to claim 12 or 13, which is characterized in that the red packet granting is handed over Easily request further includes the third clause with the first clause atomic operation, and the third clause is for executing with third number of types Word currency gets the transaction fee of transaction, third to the red packet that the address of red packet contract payment red packet receiver submits Sentence includes the first field, the second field and third field, wherein
The first field of the third clause is configured to include the contract address of the third type digital cash, is used to indicate The destination address of the third clause;
The second field of the third clause is configured as third predetermined value, is used to indicate the third clause not to the third The contract address of type digital cash executes and transfers accounts;
The third field of the third clause is configured to include the address of the red packet contract, the red packet ID and gets described Total transaction fee needed for red packet is used to indicate intelligent contract corresponding to the contract address of the third type digital cash to institute The address transfer for stating red packet contract is equal to the third type digital cash of total transaction fee.
16. the creation method of block chain red packet according to claim 12 or 13, which is characterized in that the red packet granting is handed over Easily request further includes the third clause with the first clause atomic operation, and the third clause is for executing with third number of types Word currency gets the transaction fee of transaction to the red packet that the witness address payment red packet receiver submits, and the third clause includes First field, the second field and third field, wherein
The first field of the third clause is configured to include the contract address of the third type digital cash, is used to indicate The destination address of the third clause;
The second field of the third clause is configured as third predetermined value, is used to indicate the third clause not to the third The contract address of type digital cash executes and transfers accounts;
The third field of the third clause is configured to include total transaction fee needed for getting the red packet and the witness is public Key or the witness address derived from according to the witness public key, the contract address institute for being used to indicate the third type digital cash are right The intelligent contract answered is equal to the third type digital cash of total transaction fee to witness address transfer.
17. a kind of block chain red packet gets method, which is characterized in that the method includes at red packet receiver's terminal:
Obtain the red packet ID and witness private key that red packet promoter shares;
It is determined in block chain network based on the red packet ID and the witness private key with the presence or absence of believable red packet information;
In response to determining, there are believable red packet information in block chain network, count to the address of the red packet ID and red packet receiver Cryptographic Hash is calculated, and is signed the cryptographic Hash to generate and get signature with the witness private key;And
Transaction request is got based on the red packet ID and the signature creation red packet of getting, and sends institute to the block chain network It states red packet and gets transaction request to get the red packet red packet share.
18. block chain red packet according to claim 17 gets method, which is characterized in that be based on the red packet ID and institute It states witness private key and determines in block chain network and include: with the presence or absence of believable red packet information
The first witness public key is calculated according to the witness private key;
The second witness public key corresponding with the red packet ID is obtained from the block chain network according to the red packet ID;And
Compare the first witness public key and the second witness public key, and determines the block chain network when the two is consistent On there are believable red packet information.
19. block chain red packet according to claim 17 gets method, which is characterized in that be based on the red packet ID and institute It states witness private key and determines in block chain network and include: with the presence or absence of believable red packet information
The first witness public key is calculated according to the witness private key, and the first witness ground is calculated according to the first witness public key Location;
The second witness corresponding with red packet ID address is obtained from the block chain network according to the red packet ID;And
Compare the first witness address and second witness address, and confirms the block chain network when the two is consistent On there are believable red packet information.
20. block chain red packet according to claim 17 gets method, which is characterized in that the red packet is got transaction and asked The 4th clause including the digital cash for shifting certain amount of money from the address of red packet contract to the address of red packet receiver is asked, 4th clause includes the first field, the second field and third field, wherein
The first field of 4th clause is configured to include the address of the red packet contract, is used to indicate the 4th clause Destination address;
The second field of 4th clause is configured as the 4th predetermined value, is used to indicate the 4th clause not to the red packet The address of contract executes and transfers accounts;And
The third field of 4th clause is configured to include the red packet ID, the address of the red packet receiver and the neck Take signature.
21. block chain red packet according to claim 17 gets method, wherein based on the red packet ID and described getting Signature creation red packet gets transaction request further include:
Transaction request is got to the red packet using the witness private key to sign to generate the red packet with the signature and lead Take transaction request.
22. a kind of processing unit of block chain red packet, comprising:
Memory and the processor for being couple to the memory are stored with machine-executable instruction in the memory, when described When machine-executable instruction is executed by the processor, so that the processing unit executes according to claim 1 any one of -5 The operation.
23. a kind of creating device of block chain red packet, comprising:
Memory and the processor for being couple to the memory are stored with machine-executable instruction in the memory, when described When machine-executable instruction is executed by the processor, so that the creating device is executed according to any one of claim 6-16 The operation.
24. a kind of block chain red packet gets device, comprising:
Memory and the processor for being couple to the memory are stored with machine-executable instruction in the memory, when described When machine-executable instruction is executed by the processor so that it is described get device execute it is any in 7-21 according to claim 1 Operation described in.
25. a kind of non-volatile computer readable storage medium storing program for executing, is stored thereon with machine-executable instruction, the machine is executable Instruction executes the method as described in any one of claim 1-21 when being run by computer.
26. a kind of computer program comprising machine-executable instruction, the machine-executable instruction execute root when being run According to method described in any one of claim 1-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 true CN110363512A (en) 2019-10-22
CN110363512B 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)

Cited By (6)

* 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
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
CN116452200A (en) * 2022-12-29 2023-07-18 胖迪科技(深圳)有限公司 Red packet receiving and sending method and device, electronic equipment and storage medium

Citations (9)

* 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
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
CN109711836A (en) * 2018-11-15 2019-05-03 远光软件股份有限公司 A kind of storage method of transaction, storage network and electronic equipment
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

Patent Citations (9)

* 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
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
CN109711836A (en) * 2018-11-15 2019-05-03 远光软件股份有限公司 A kind of storage method of transaction, storage network and electronic equipment
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

Cited By (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
WO2021088704A1 (en) * 2019-11-06 2021-05-14 杭州复杂美科技有限公司 Method for sending red packet by means of scanning code, and device 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
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
CN116452200A (en) * 2022-12-29 2023-07-18 胖迪科技(深圳)有限公司 Red packet receiving and sending method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN110363512B (en) 2022-12-20

Similar Documents

Publication Publication Date Title
CN110363512A (en) The processing of block chain red packet creates, gets method and apparatus, medium and computer program
US11615677B2 (en) Systems for multiple legal game providers with digital ledger
Liu et al. Toward fairness of cryptocurrency payments
KR102050129B1 (en) Block chain supporting multiple one-way functions used for verification of blocks
KR102589475B1 (en) Computer-implemented system and method for performing transaction mixing on a blockchain
CN106533696B (en) Identity identifying method, certificate server and user terminal based on block chain
KR101887964B1 (en) Blockchain core server having security ability based on quantum random number, blockchain security method and electronic cash exchange system
EP4184410A1 (en) Operating system for blockchain iot devices
CA3011600C (en) Information transaction infrastructure
Avoine Cryptography in radio frequency identification and fair exchange protocols
CN109450910A (en) Data sharing method, data sharing network and electronic equipment based on block chain
CN109565509A (en) Network service based on token in IOT application
CN110546672A (en) System and method for distributing data records using blockchains
CN109525671A (en) Date storage method, electronic equipment and storage medium based on block chain
CN115660675A (en) Method performed by a computer device, corresponding system and storage medium
CN107967416A (en) The methods, devices and systems of copyright right-safeguarding detection
CN108885666A (en) For detecting and preventing the pseudo- system and method emitted
WO2016197934A1 (en) Barcode security authentication method
CN104348792B (en) Data processing method, device and system
CN104112196A (en) Electronic System For Provision Of Banking Services
Tanas et al. An integrated reward and reputation mechanism for MCS preserving users’ privacy
JP2008027425A (en) Electronic settlement system, electronic settlement server, valuable value providing device, mobile communication terminal, and electronic settlement method
CN111461691A (en) Flow statistical system, method and device based on block chain
CN110088790A (en) Merchant registration for reverse payments
CN108876373A (en) A kind of method of payment, device, server and system

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