WO2020156480A1 - Red envelope processing method and device, and storage medium - Google Patents

Red envelope processing method and device, and storage medium Download PDF

Info

Publication number
WO2020156480A1
WO2020156480A1 PCT/CN2020/073981 CN2020073981W WO2020156480A1 WO 2020156480 A1 WO2020156480 A1 WO 2020156480A1 CN 2020073981 W CN2020073981 W CN 2020073981W WO 2020156480 A1 WO2020156480 A1 WO 2020156480A1
Authority
WO
WIPO (PCT)
Prior art keywords
red envelope
red
sub
transaction
index
Prior art date
Application number
PCT/CN2020/073981
Other languages
French (fr)
Chinese (zh)
Inventor
吴思进
王志文
Original Assignee
杭州复杂美科技有限公司
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 杭州复杂美科技有限公司 filed Critical 杭州复杂美科技有限公司
Publication of WO2020156480A1 publication Critical patent/WO2020156480A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/04Payment circuits
    • G06Q20/06Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme
    • 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
    • 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

Definitions

  • FIG. 1 is a schematic diagram of a scenario of a red packet processing solution in an embodiment of the present invention.
  • S103 Generate the master private key and the corresponding main chain code and master public key, and generate a first index list according to the number of red envelopes; wherein, the first index list includes the same number of indexes as the number of red envelopes;
  • step S105 the server 10 generates a sub-private key list including 3 sub-private keys according to the above-mentioned CKD algorithm, the main private key, the main chain code, and the first index list, and generates a red envelope including the main public key and the main chain code.
  • Transaction tx2, tx2 can also include information such as the total amount of red envelopes (100), currency (xxx), red envelope distribution type (random), and the number of red envelopes (3);
  • the server generates the master public key, the master public key, the master chain code, and the index list, and generates the child private key list according to the master private key, the master chain code, and the index list film.
  • the master public key and the master chain code Recorded on the blockchain, so that the red envelope contract configured on the blockchain can be generated according to the first sub-public key generated by the master public key, the main chain code, and the first index in the red envelope receipt transaction.
  • the signature information is used to verify the red envelope receiving authority, which realizes the red envelope processing scheme that combines centralization and decentralization.
  • the red envelope contract issues red envelopes to the user’s account; among them, the red envelope receiving transaction is generated by the server according to the first sub-private key signature in the sub-private key list, and according to the user who received the red envelope
  • the account information, the first index corresponding to the first sub-private key, and the first signature information are generated.

Abstract

A red envelope processing method and device, and a storage medium, the method comprising: receiving red envelope issuing request information and a red envelope payment transaction; generating a main private key and a corresponding main chain code and main public key, and generating a first index list according to the number of red envelopes; generating a sub-private key list according to the main private key, the main chain code and the first index list, and generating a red envelope issuing transaction according to the main public key and the main chain code; packaging the red envelope issuing transaction and the red envelope payment transaction into a transaction group and sending same to a blockchain node for execution so as to freeze red envelope money in a red envelope contract, and recording the main public key and the main chain code onto a blockchain; and sending a first index and a corresponding sub-private key to a client who receives the red envelope so as to generate signature information by means of a sub-private key signature, generating a red envelope reception transaction according to the first index and the signature information and sending same to a node for execution so as to verify whether a sub-public key generated according to the main public key, the main chain code and the first index is able to verify the signature Information: if so, then issuing the red envelope.

Description

红包处理方法、设备和存储介质Red packet processing method, equipment and storage medium 技术领域Technical field
本申请涉及互联网技术领域,具体涉及一种红包处理方法、设备和存储介质。This application relates to the field of Internet technology, in particular to a method, equipment and storage medium for processing red packets.
背景技术Background technique
当前的红包处理方案都是基于传统的中心化服务器处理用户的发红包请求或抢红包请求,并进行红包分配等处理的中心化方案。当前市场上尚无成熟的去中心化或中心化与去中心化相结合的红包处理方案。The current red envelope processing schemes are based on traditional centralized servers that process users' red envelope requests or grab red envelope requests, and perform red envelope distribution and other processing. At present, there is no mature decentralization or a combination of centralization and decentralization in the red envelope processing program.
完全去中心化的红包处理方案,尤其是抢红包模式这样的接收用户不确定模式的红包处理方案中,当前仍存在难以兼顾安全性和易用性的问题。例如,系统可以为发红包的用户自动生成验证方式,但通过区块链公开验证数据会使得作为抢红包用户的受众用户之外的其它区块链用户同样有机会获取到红包;而通过线下交流的方式将验证数据提供给抢到红包的用户,会使得方案的易用性大幅下降,难以吸引用户使用。Fully decentralized red envelope processing solutions, especially red envelope processing solutions that receive users in an uncertain mode such as the grab red envelope mode, still have the problem that it is difficult to balance security and ease of use. For example, the system can automatically generate a verification method for users who send red envelopes, but publicly verifying data through the blockchain will enable other blockchain users besides the audience users who grab the red envelopes to also have the opportunity to obtain red envelopes; and through offline The way of communication provides verification data to users who grab the red envelopes, which will greatly reduce the ease of use of the solution and make it difficult to attract users.
发明内容Summary of the invention
鉴于现有技术中的上述缺陷或不足,期望提供一种中心化与去中心化相结合的红包处理方法、设备和存储介质。In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a red packet processing method, equipment and storage medium that combines centralization and decentralization.
第一方面,本发明提供一种适用于服务端的红包处理方法,该方法包括:In the first aspect, the present invention provides a red packet processing method suitable for the server, and the method includes:
接收第一用户端发送的发红包请求信息和红包支付交易;其中,发红包请求信息包括红包个数;Receiving the red envelope request information and the red envelope payment transaction sent by the first user terminal; wherein the red envelope request information includes the number of red envelopes;
生成主私钥和对应的主链码、主公钥,并根据红包个数生成第一索引列表;其中,第一索引列表包括与红包个数相同数量的索引;Generate the master private key and the corresponding main chain code and master public key, and generate the first index list according to the number of red envelopes; wherein, the first index list includes the same number of indexes as the number of red envelopes;
根据主私钥、主链码和第一索引列表生成子私钥列表,根据主公钥和主链码生成发红包交易;Generate a list of sub-private keys based on the master private key, main chain code, and first index list, and generate red envelope transactions based on the master public key and main chain code;
将发红包交易和红包支付交易打包为交易组并发送至第一区块链的节点以供执行以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;Package the red envelope transaction and red envelope payment transaction into a transaction group and send it to the node of the first blockchain for execution to freeze the red envelope payment for the red envelope payment transaction in the red envelope contract, and record the master public key and main chain code to On the first blockchain;
向领取到红包的用户的第二用户端发送第一索引列表中的第一索引和对应于第一索引的第一子私钥,以供第二用户端通过所述第一子私钥签名生成第一签名信息、根据第一索引和第一签名信息生成红包领取交易并发送至第一区块链的节点以供执行以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则红包合约向用户的账户发放红包。Send the first index in the first index list and the first sub-private key corresponding to the first index to the second user end of the user who has received the red envelope, so that the second user end can generate the signature by the first sub-private key The first signature information, the red envelope receipt transaction is generated according to the first index and the first signature information and sent to the node of the first blockchain for execution to be verified by the red envelope contract. Generated according to the master public key, the main chain code and the first index Whether the first child public key can verify the first signature information: Yes, the red envelope contract will issue a red envelope to the user's account.
第二方面,本发明提供一种适用于区块链节点的红包处理方法,该方法包括:In the second aspect, the present invention provides a red packet processing method suitable for blockchain nodes, the method including:
接收并执行服务端发送的交易组以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;其中,交易组由服务端接收第一用户端发送的发红包请求信息和红包支付交易,生成主私钥和对应的主链码、主公钥并根据发红包请求信息包括的红包个数生成第一索引列表,根据主私钥、主链码和第一索引列表生成子私钥列表,根据主公钥和主链码生成发红包交易后,将发红包交易和红包支付交易打包生成;Receive and execute the transaction group sent by the server to freeze the red envelope payment of the red envelope payment transaction in the red envelope contract, and record the master public key and the main chain code on the first blockchain; among them, the transaction group is received by the server. A red envelope sending request information and a red envelope payment transaction sent by a user, the master private key and the corresponding main chain code, master public key are generated, and the first index list is generated according to the number of red envelopes included in the red envelope request information, according to the master private key, The main chain code and the first index list generate the sub-private key list, and after the red envelope transaction is generated according to the master public key and the main chain code, the red envelope transaction and red envelope payment transaction are packaged and generated;
接收并执行领取到红包的用户的第二用户端发送的红包领取交易以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则红包合约向用户的账户发放红包;其中,红包领取交易由第二用户端在收到服务端发送的第一索引列表中的第一索引和对应于第一索引的第一子私钥后,通过第一子私钥签名生成第一签名信息、根据第一索引和第一签名信息生成。Receive and execute the red packet receiving transaction sent by the second user terminal of the user who received the red packet to verify the first signature information through the red packet contract, which is generated according to the master public key, the main chain code and the first index: If yes, the red envelope contract will issue red envelopes to the user’s account; among them, the red envelope receiving transaction is received by the second user terminal from the first index in the first index list sent by the server and the first sub-private key corresponding to the first index Then, the first signature information is generated by signing the first sub-private key, and generated according to the first index and the first signature information.
第三方面,本发明提供一种适用于用户端的红包处理方法,该方法包括:In the third aspect, the present invention provides a red packet processing method suitable for the user side, the method including:
领取到红包后,接收服务端发送的第一索引列表中的第一索引和对应于第一索引的第一子私钥;其中,第一索引列表由服务端接收第 一用户端发送的发红包请求信息和红包支付交易后,生成与发红包请求信息包括的红包个数相同个数的索引所组成,第一子私钥根据服务端生成的主私钥和主链码,以及第一索引生成;After receiving the red envelope, the first index in the first index list sent by the server and the first sub-private key corresponding to the first index are received; where the first index list is received by the server to send the red envelope sent by the first user. After the request information and the red envelope payment transaction, the index is composed of the same number of red envelopes as the red envelope request information. The first sub-private key is generated based on the master private key and the main chain code generated by the server, and the first index ;
通过第一子私钥签名生成第一签名信息,根据第一索引和第一签名信息生成红包领取交易并发送至第一区块链的节点以供执行以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则红包合约发放红包;其中,子私钥列表由服务端生成主私钥和对应的主链码、主公钥后,根据主私钥、主链码和第一索引列表生成,并由服务端根据主公钥和主链码生成发红包交易将发红包交易和红包支付交易打包为交易组并发送至第一区块链的节点以供执行以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上。The first signature information is generated through the first sub-private key signature, and the red envelope receipt transaction is generated according to the first index and the first signature information and sent to the node of the first blockchain for execution to pass the red envelope contract verification according to the master public key, master Whether the first sub-public key generated by the chain code and the first index can verify the first signature information: yes, the red envelope contract will issue a red envelope; among them, the sub-private key list is generated by the server to generate the master private key and the corresponding main chain code, master After the public key, it is generated according to the master private key, main chain code and first index list, and the red envelope transaction is generated by the server according to the master public key and main chain code. The red envelope transaction and red envelope payment transaction are packaged into a transaction group and sent to The nodes of the first block chain are for execution to freeze the red envelope payment of the red envelope payment transaction in the red envelope contract, and record the master public key and the main chain code on the first block chain.
第四方面,本发明提供另一种适用于服务端的红包处理方法,该方法包括:In the fourth aspect, the present invention provides another red packet processing method suitable for the server, and the method includes:
接收第一用户端发送的发红包请求信息和红包支付交易;其中,发红包请求信息包括红包个数;Receiving the red envelope request information and the red envelope payment transaction sent by the first user terminal; wherein the red envelope request information includes the number of red envelopes;
生成主私钥和对应的主链码、主公钥,并根据红包个数生成第一索引列表;其中,第一索引列表包括与红包个数相同数量的索引;Generate the master private key and the corresponding main chain code and master public key, and generate the first index list according to the number of red envelopes; wherein, the first index list includes the same number of indexes as the number of red envelopes;
根据主私钥、主链码和第一索引列表生成子私钥列表,根据主公钥和主链码生成发红包交易;Generate a list of sub-private keys based on the master private key, main chain code, and first index list, and generate red envelope transactions based on the master public key and main chain code;
将发红包交易和红包支付交易打包为交易组并发送至第一区块链的节点以供执行以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;Package the red envelope transaction and red envelope payment transaction into a transaction group and send it to the node of the first blockchain for execution to freeze the red envelope payment for the red envelope payment transaction in the red envelope contract, and record the master public key and main chain code to On the first blockchain;
根据子私钥列表中的第一子私钥签名生成第一签名信息,并根据领取到红包的用户的账户信息、对应于第一子私钥的第一索引和第一签名信息生成红包领取交易并发送至第一区块链的节点以供执行以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则红包合约向用户的账户发放红包。Generate the first signature information according to the first sub-private key signature in the sub-private key list, and generate the red envelope receiving transaction based on the account information of the user who received the red envelope, the first index corresponding to the first sub-private key, and the first signature information And sent to the node of the first blockchain for execution to verify whether the first sub-public key generated according to the master public key, the main chain code and the first index can verify the first signature information through the red envelope contract: yes, then the red envelope contract Red envelopes are issued to the user's account.
第五方面,本发明提供另一种适用于区块链节点的红包处理方法,该方法包括:In the fifth aspect, the present invention provides another red packet processing method suitable for blockchain nodes, and the method includes:
接收并执行服务端发送的交易组以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;其中,交易组由服务端接收第一用户端发送的发红包请求信息和红包支付交易,生成主私钥和对应的主链码、主公钥并根据发红包请求信息包括的红包个数生成第一索引列表,根据主私钥、主链码和第一索引列表生成子私钥列表,根据主公钥和主链码生成发红包交易后,将发红包交易和红包支付交易打包生成;Receive and execute the transaction group sent by the server to freeze the red envelope payment of the red envelope payment transaction in the red envelope contract, and record the master public key and the main chain code on the first blockchain; among them, the transaction group is received by the server. A red envelope sending request information and a red envelope payment transaction sent by a user, the master private key and the corresponding main chain code, master public key are generated, and the first index list is generated according to the number of red envelopes included in the red envelope request information, according to the master private key, The main chain code and the first index list generate the sub-private key list, and after the red envelope transaction is generated according to the master public key and the main chain code, the red envelope transaction and red envelope payment transaction are packaged and generated;
接收并执行服务端发送的红包领取交易以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则红包合约向用户的账户发放红包;其中,红包领取交易由服务端根据子私钥列表中的第一子私钥签名生成第一签名信息,并根据领取到红包的用户的账户信息、对应于第一子私钥的第一索引和第一签名信息生成。Receive and execute the red envelope receipt transaction sent by the server to verify whether the first sub-public key generated according to the master public key, main chain code, and first index can verify the first signature information through the red envelope contract: if yes, the red envelope contract to the user The account issues red envelopes; among them, the red envelope receiving transaction is generated by the server according to the first sub-private key signature in the sub-private key list, and the first signature information is generated according to the account information of the user who received the red envelope, corresponding to the first sub-private key The first index and the first signature information are generated.
第六方面,本发明还提供一种设备,包括一个或多个处理器和存储器,其中存储器包含可由该一个或多个处理器执行的指令以使得该一个或多个处理器执行根据本发明各实施例提供的红包处理方法。In a sixth aspect, the present invention also provides a device including one or more processors and a memory, where the memory contains instructions executable by the one or more processors to cause the one or more processors to execute each of the processors according to the present invention. The red packet processing method provided by the embodiment.
第七方面,本发明还提供一种存储有计算机程序的存储介质,该计算机程序使计算机执行根据本发明各实施例提供的红包处理方法。In a seventh aspect, the present invention also provides a storage medium storing a computer program, which causes the computer to execute the red packet processing method provided according to the embodiments of the present invention.
本发明诸多实施例提供的红包处理方法、设备和存储介质通过由服务端生成主公钥、主公钥、主链码、索引列表,并根据主私钥、主链码和索引列表膜生成子私钥列表,将主公钥和主链码记录至区块链上,使区块链上配置的红包合约可以根据主公钥、主链码和红包领取交易中的第一索引所生成的第一子公钥验证第一子私钥签名生成的签名信息来验证红包领取权限,实现了中心化与去中心化相结合的红包处理方案;The red envelope processing method, device and storage medium provided by many embodiments of the present invention generate a master public key, master public key, master chain code, and index list by the server, and generate sub-keys based on the master private key, master chain code, and index list film. Private key list, record the main public key and main chain code on the blockchain, so that the red envelope contract configured on the block chain can be generated according to the first index in the main public key, main chain code and red envelope receipt transaction A sub-public key verifies the signature information generated by the first sub-private key signature to verify the red envelope receiving authority, and realizes the red envelope processing scheme that combines centralization and decentralization;
本发明一些实施例提供的红包处理方法、设备和存储介质进一步通过由红包合约将红包款项分配至各子地址的账户中,并在发放红包时将第一索引对应的子地址的账户中的红包款项进行发放,保障了一项索引无法被重复用于红包领取。The red envelope processing method, device and storage medium provided by some embodiments of the present invention further distribute the red envelope payment to the account of each sub-address through the red envelope contract, and when the red envelope is issued, the red envelope in the account corresponding to the sub-address is first indexed The payment is made to ensure that an index cannot be reused for red envelope collection.
附图说明Description of the drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, purposes and advantages of the present application will become more apparent:
图1为本发明一实施例中红包处理方案的场景示意图。FIG. 1 is a schematic diagram of a scenario of a red packet processing solution in an embodiment of the present invention.
图2为本发明一实施例提供的一种适用于服务端的红包处理方法的流程图。Fig. 2 is a flowchart of a red packet processing method applicable to a server according to an embodiment of the present invention.
图3为本发明一实施例提供的一种适用于区块链节点的红包处理方法的流程图。FIG. 3 is a flowchart of a red packet processing method suitable for blockchain nodes according to an embodiment of the present invention.
图4为图3所示方法的一种优选实施方式的流程图。FIG. 4 is a flowchart of a preferred embodiment of the method shown in FIG. 3.
图5为本发明一实施例提供的一种适用于用户端的红包处理方法的流程图。Fig. 5 is a flowchart of a red packet processing method suitable for a user terminal according to an embodiment of the present invention.
图6为本发明另一实施例提供的一种适用于服务端的红包处理方法的流程图。Fig. 6 is a flowchart of a red packet processing method suitable for a server according to another embodiment of the present invention.
图7为本发明另一实施例提供的一种适用于区块链节点的红包处理方法的流程图。FIG. 7 is a flowchart of a red packet processing method suitable for blockchain nodes according to another embodiment of the present invention.
图8为本发明一实施例提供的一种设备的结构示意图。FIG. 8 is a schematic structural diagram of a device provided by an embodiment of the present invention.
具体实施方式detailed description
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与发明相关的部分。The application will be further described in detail below with reference to the drawings and embodiments. It can be understood that the specific embodiments described here are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for ease of description, only the parts related to the invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that the embodiments in this application and the features in the embodiments can be combined with each other if there is no conflict. Hereinafter, the present application will be described in detail with reference to the drawings and in conjunction with embodiments.
图1为本发明一实施例中红包处理方案的场景示意图。以下将以图1所示的场景为例,对本发明提供的各项解决方案进行详细阐述。FIG. 1 is a schematic diagram of a scenario of a red packet processing solution in an embodiment of the present invention. The following will take the scenario shown in FIG. 1 as an example to describe in detail the various solutions provided by the present invention.
图2为本发明一实施例提供的一种适用于服务端的红包处理方法的流程图。如图2所示,在本实施例中,本发明提供一种适用于服务端的红包处理方法,包括:Fig. 2 is a flowchart of a red packet processing method applicable to a server according to an embodiment of the present invention. As shown in Figure 2, in this embodiment, the present invention provides a red packet processing method suitable for the server, including:
S101:接收第一用户端发送的发红包请求信息和红包支付交易;其中,发红包请求信息包括红包个数;S101: Receive the red envelope sending request information and the red envelope payment transaction sent by the first user terminal; wherein the red envelope sending request information includes the number of red envelopes;
S103:生成主私钥和对应的主链码、主公钥,并根据红包个数生成第一索引列表;其中,第一索引列表包括与红包个数相同数量的索引;S103: Generate the master private key and the corresponding main chain code and master public key, and generate a first index list according to the number of red envelopes; wherein, the first index list includes the same number of indexes as the number of red envelopes;
S105:根据主私钥、主链码和第一索引列表生成子私钥列表,根据主公钥和主链码生成发红包交易;S105: Generate a sub-private key list according to the master private key, the main chain code, and the first index list, and generate a red envelope transaction according to the master public key and the main chain code;
S107:将发红包交易和红包支付交易打包为交易组并发送至第一区块链的节点以供执行以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;S107: Pack the red envelope transaction and the red envelope payment transaction into a transaction group and send it to the node of the first blockchain for execution to freeze the red envelope payment for the red envelope payment transaction in the red envelope contract, and the master public key and main chain code Record to the first blockchain;
S109:向领取到红包的用户的第二用户端发送第一索引列表中的第一索引和对应于第一索引的第一子私钥,以供第二用户端通过所述第一子私钥签名生成第一签名信息、根据第一索引和第一签名信息生成红包领取交易并发送至第一区块链的节点以供执行以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则红包合约向用户的账户发放红包。S109: Send the first index in the first index list and the first sub-private key corresponding to the first index to the second client of the user who has received the red envelope, so that the second client can use the first sub-private key The signature generates the first signature information, generates the red envelope receipt transaction according to the first index and the first signature information, and sends it to the node of the first blockchain for execution for verification by the red envelope contract according to the master public key, the main chain code and the first index Whether the generated first child public key can verify the first signature information: If yes, the red envelope contract will issue a red envelope to the user's account.
具体地,在本实施例中,服务端10同时还是某即时通讯工具的服务端,用户通过该即时通讯工具进行红包的收发;在更多实施例中,服务端10可以配置为专用于红包收发的服务端,或,同时配置为其它本领域用于进行红包收发的不同通讯工具的服务端,均可实现相同的技术效果。Specifically, in this embodiment, the server 10 is also the server of a certain instant messaging tool, and the user uses the instant messaging tool to send and receive red packets; in more embodiments, the server 10 may be configured to be dedicated to the sending and receiving of red packets The same technical effect can be achieved on the server side of the server or the server side configured as other different communication tools used in the field for sending and receiving red packets.
以图1所示场景中,用户甲在该即时通讯工具的群里发送了一个总额为100xxx币的3人红包,用户乙、丙、丁抢到了该红包,用户戊、己等未抢到红包为例,对上述图2所示的方法进行详细阐述:In the scenario shown in Figure 1, user A sends a red envelope with a total of 100xxx coins to 3 people in the instant messaging tool group. Users B, C, and D grab the red envelope, and users E, E, etc. did not grab the red envelope. As an example, the method shown in Figure 2 above is described in detail:
用户甲通过第一用户端20发送一个总额为100xxx币的3人红包,第一用户端20生成发红包请求信息m1和一笔向红包合约转账100xxx币的红包支付交易tx1,并将m1和tx1发送至服务端10。其中,发红包请求信息m1包括:红包总额:100,币种:xxx币,红包个数:3,红包分配类型:随机,等等。User A sends a three-person red envelope with a total of 100xxx coins through the first user terminal 20, and the first user terminal 20 generates red envelope request information m1 and a red envelope payment transaction tx1 that transfers 100xxx coins to the red envelope contract, and combines m1 and tx1 Send to the server 10. Among them, the red envelope request information m1 includes: total amount of red envelopes: 100, currency: xxx coins, number of red envelopes: 3, red envelope distribution type: random, and so on.
在步骤S101中,服务端10接收上述第一用户端20发送的发红包 请求信息m1和红包支付交易tx1。In step S101, the server 10 receives the red envelope sending request information m1 and the red envelope payment transaction tx1 sent by the first user terminal 20.
优选地,在步骤S10中,服务端10可以对m1和tx1进行比对验证,若验证失败,例如,tx1支付的款项数额少于m1所请求发红包的红包总额,或,tx1支付的币种与请求发红包的币种不同,等等,则请求失败。Preferably, in step S10, the server 10 can compare and verify m1 and tx1. If the verification fails, for example, the amount of money paid by tx1 is less than the total amount of red envelopes requested by m1, or the currency of tx1 payment It is different from the currency of the red envelope request, etc., the request fails.
在另一实施例中,m1不包括红包总额和币种信息,服务端10根据tx1支付的币种和数额确定m1所请求发红包的币种和数额。In another embodiment, m1 does not include the total amount of red envelopes and currency information, and the server 10 determines the currency and amount of red envelopes requested by m1 according to the currency and amount paid by tx1.
在步骤S103中,服务端10为上述发红包请求信息m1生成主私钥、主链码和主公钥,并根据m1的红包个数(3)生成包括3个索引的第一索引列表【r1,r2,r3】。In step S103, the server 10 generates a master private key, a master chain code, and a master public key for the above red envelope request information m1, and generates a first index list including 3 indexes according to the number of red envelopes of m1 (3) [r1 , R2, r3].
具体地,在本实施例中,服务端10采用HD钱包的CKD(child key derivation)算法,根据随机生成的第一随机数生成种子,再根据种子生成主私钥和主链码,再根据主私钥生成相应的主公钥;第一索引列表中的各索引均为随机生成的随机数;在更多实施例中,服务器10还可以根据发红包请求信息m1或红包支付交易tx1的若干项参数生成CKD算法的种子或生成第一索引列表中的索引,只要生成种子或索引的参数不会因记录至区块链上被全部公开而导致安全隐患,即可实现相同的技术效果。Specifically, in this embodiment, the server 10 uses the CKD (child key derivation) algorithm of the HD wallet to generate a seed according to the first random number generated randomly, and then generates the master private key and the main chain code according to the seed, and then according to the master The private key generates the corresponding master public key; each index in the first index list is a random number generated randomly; in more embodiments, the server 10 may also send a red envelope request information m1 or several items of the red envelope payment transaction tx1 The parameter generates the seed of the CKD algorithm or generates the index in the first index list. As long as the parameters of the generated seed or index are not recorded on the blockchain and are fully disclosed and cause security risks, the same technical effect can be achieved.
在步骤S105中,服务端10根据上述CKD算法、主私钥、主链码和第一索引列表生成包括3个子私钥的子私钥列表,并生成包括主公钥和主链码的发红包交易tx2,tx2还可以包括红包总额(100)、币种(xxx)、红包分配类型(随机)、红包个数(3)等信息;In step S105, the server 10 generates a sub-private key list including 3 sub-private keys according to the above-mentioned CKD algorithm, the main private key, the main chain code, and the first index list, and generates a red envelope including the main public key and the main chain code. Transaction tx2, tx2 can also include information such as the total amount of red envelopes (100), currency (xxx), red envelope distribution type (random), and the number of red envelopes (3);
在步骤S107中,服务端10将tx1和tx2打包为交易组(tx1,tx2),将该交易组发送至第一区块链的节点501;In step S107, the server 10 packages tx1 and tx2 into a transaction group (tx1, tx2), and sends the transaction group to the node 501 of the first blockchain;
节点501将交易组(tx1,tx2)广播至第一区块链网络50的其它各节点501,各节点501分别将交易组(tx1,tx2)打包至区块中并执行,将用户甲支付的100xxx币冻结在红包合约中,并将主公钥和主链码记录到第一区块链上。The node 501 broadcasts the transaction group (tx1, tx2) to the other nodes 501 of the first blockchain network 50, and each node 501 packages the transaction group (tx1, tx2) into the block and executes it, and the user A pays 100xxx coins are frozen in the red envelope contract, and the main public key and main chain code are recorded on the first blockchain.
与上述步骤S103-S107并行地,服务端10作为即时通讯工具的服务端,根据发红包请求信息m1在群里发送红包信息,群里各用户的 用户端接收红包信息后,用户乙、丙、丁抢到了该红包,用户戊、己等未抢到红包。Parallel to the above steps S103-S107, the server 10, as the server of the instant messaging tool, sends red envelope information in the group according to the red envelope request information m1. After the user end of each user in the group receives the red envelope information, users B, C, Ding grabbed the red envelope, but users E and Ji did not grab the red envelope.
在步骤S109中,服务端10分别向抢到红包的用户乙、丙、丁的第二用户端30发送上述索引r1和对应的第一子私钥、r2和对应的第二子私钥、r3和对应的第三子私钥;In step S109, the server 10 respectively sends the index r1 and the corresponding first sub-private key, r2 and the corresponding second sub-private key, r3 to the second client 30 of users B, C, and D who grab the red envelope. And the corresponding third child private key;
用户乙的第二用户端30收到索引r1和对应的第一子私钥后,通过第一子私钥签名生成第一签名信息,生成包括索引r1、第一签名信息和用户乙的账户地址add 的红包领取交易tx3,并将tx3发送至节点501;在另一实施例中,也可以通过第一子私钥对add 签名生成第一签名信息,并生成包括索引r1和第一签名信息的红包领取交易tx3’; After receiving the index r1 and the corresponding first sub-private key, the second client 30 of user B generates the first signature information through the first sub-private key signature, and generates the first signature information including index r1, the first signature information, and the account address of user B Add B ’s red envelope receives transaction tx3, and sends tx3 to node 501; in another embodiment, add B can also be signed by the first sub-private key to generate the first signature information, including index r1 and the first signature Information red envelope to receive transaction tx3';
节点501接收、广播并通过红包合约执行tx3,根据主公钥、索引r1和主链码生成第一子公钥,再根据第一子公钥对第一签名信息进行验证:若验证成功,则将上述红包合约冻结的100xxx币中的一部分xxx币转账至add 以完成向用户乙发放红包; The node 501 receives, broadcasts, and executes tx3 through the red envelope contract, generates the first child public key according to the master public key, index r1 and the main chain code, and then verifies the first signature information according to the first child public key: if the verification is successful, then Transfer part of the xxx coins of the 100xxx coins frozen in the red envelope contract to add B to complete the distribution of red envelopes to user B;
同理,用户丙和用户丁的第二用户端30在分别收到索引r2和对应的第二子私钥、r3和对应的第三子私钥后,分别生成红包领取交易tx4和tx5并发送至节点501;节点501通过红包合约验证后分别向用户丙和丁发放红包。In the same way, the second client 30 of user C and user D respectively generate red packets to receive transactions tx4 and tx5 after receiving index r2 and the corresponding second sub-private key, r3 and corresponding third sub-private key, and send them To node 501; after node 501 passes the red envelope contract verification, red envelopes are issued to users C and D respectively.
其中,当红包分配类型配置为随机时,红包合约可以将预定的第一算法确定的某个区块的区块哈希或某笔交易的交易哈希作为随机数,结合预定的第二算法,生成随机为用户乙、丙、丁分配的红包数额;红包合约还可以利用区块链系统所提供的随机数,例如申请人在CN201811351787.0号专利中提出的随机数生成方法所生成的随机数,结合上述预定的第二算法,生成随机为用户乙、丙、丁分配的红包数额;Among them, when the red envelope distribution type is configured as random, the red envelope contract can use the block hash of a certain block determined by the predetermined first algorithm or the transaction hash of a certain transaction as a random number, combined with the predetermined second algorithm, Generate the amount of red envelopes randomly allocated to users B, C, D; red envelope contracts can also use random numbers provided by the blockchain system, such as random numbers generated by the random number generation method proposed by the applicant in the CN201811351787.0 patent , Combined with the above-mentioned predetermined second algorithm, generate the amount of red envelopes randomly allocated to users B, C and D;
而当红包分配类型配置为均分或其它非随机的分配方式时,红包合约可直接根据指定的分配方式进行分配。When the red envelope distribution type is configured as equal distribution or other non-random distribution methods, the red envelope contract can be directly distributed according to the specified distribution method.
上述实施例提供的方法采用了CKD算法生成子私钥和子公钥,在另一实施例中,还可以采用增强密钥推导(hardened key derivation,简称HKD)算法,可实现相同的技术效果。The method provided in the foregoing embodiment uses the CKD algorithm to generate the sub-private key and the sub-public key. In another embodiment, a hardened key derivation (hardened key derivation, referred to as HKD) algorithm may also be used to achieve the same technical effect.
上述实施例通过由服务端生成主公钥、主公钥、主链码、索引列表,并根据主私钥、主链码和索引列表膜生成子私钥列表,将主公钥和主链码记录至区块链上,使区块链上配置的红包合约可以根据主公钥、主链码和红包领取交易中的第一索引所生成的第一子公钥验证第一子私钥签名生成的签名信息来验证红包领取权限,实现了中心化与去中心化相结合的红包处理方案。In the above embodiment, the server generates the master public key, the master public key, the master chain code, and the index list, and generates the child private key list according to the master private key, the master chain code, and the index list film. The master public key and the master chain code Recorded on the blockchain, so that the red envelope contract configured on the blockchain can be generated according to the first sub-public key generated by the master public key, the main chain code, and the first index in the red envelope receipt transaction. The signature information is used to verify the red envelope receiving authority, which realizes the red envelope processing scheme that combines centralization and decentralization.
在上述实施例中,以红包支付交易对红包合约进行转账,红包领取交易包括第二用户的地址、红包合约向该地址转账为例,对上述方法进行了示例性的阐述;In the above embodiment, taking the red envelope payment transaction to transfer the red envelope contract, the red envelope receiving transaction includes the address of the second user, and the red envelope contract transfers money to the address as an example, the above method is exemplified;
在另一实施例中,红包合约配置有账户体系,对各用户的账户余额进行记账时,还可以将红包支付交易配置为冻结第一用户在红包合约中的余额,将红包领取交易配置为包括第二用户的账户标识信息、红包合约通过修改合约内第一用户和第二用户的账户余额实现对第二用户发放红包,可实现相同的技术效果。例如,红包合约中配置有账户体系,记录有用户甲的账户余额1000xxx币、用户乙的账户余额0xxx币,通过执行红包支付交易冻结用户甲的100xxx币(此时用户甲的账户余额900活动的xxx币、100冻结的xxx币),通过执行红包领取交易tx3修改红包合约的记账(此时用户甲的账户余额900活动的xxx币、80冻结的xxx币,用户乙的账户余额20xxx币)。In another embodiment, the red envelope contract is configured with an account system. When accounting the account balance of each user, the red envelope payment transaction can also be configured to freeze the balance of the first user in the red envelope contract, and the red envelope receiving transaction can be configured as Including the account identification information of the second user, the red envelope contract realizes the issuance of red envelopes to the second user by modifying the account balances of the first user and the second user in the contract, which can achieve the same technical effect. For example, the red envelope contract is configured with an account system that records user A’s account balance of 1000xxx coins and user B’s account balance of 0xxx coins. By executing the red envelope payment transaction, user A’s 100xxx coins are frozen (at this time, user A’s account balance is 900 active xxx coins, 100 frozen xxx coins), modify the bookkeeping of the red envelope contract by executing the red envelope receiving transaction tx3 (at this time, user A’s account balance is 900 active xxx coins, 80 frozen xxx coins, and user B’s account balance 20xxx coins) .
在一优选实施例中,红包合约配置有如上所述的账户体系,上述将红包支付交易支付的红包款项冻结在红包合约中包括:在红包合约中配置子地址列表所包括的各子地址的账户;以及,将红包支付交易支付的红包款项分配至各子地址的账户中;In a preferred embodiment, the red envelope contract is configured with the account system as described above, and the above freezing the red envelope payment of the red envelope payment transaction in the red envelope contract includes: configuring the account of each sub address included in the sub address list in the red envelope contract ; And, distribute the red envelope payment of the red envelope payment transaction to the account of each sub address;
上述红包合约向用户的账户发放红包包括:将红包合约中第一子地址的账户中的红包款项发放给用户的账户。The above-mentioned red envelope contract issuing red envelopes to the user's account includes: issuing red envelope funds in the account of the first sub-address in the red envelope contract to the user's account.
具体地,红包合约在执行交易组时,在红包合约中生成add1、add2、add3该3个账户,并将用户甲支付的红包款项按上述分配方式分配至该3个账户中;当红包合约执行根据索引r1生成的红包领取交易tx3并验证通过时,将add1账户中的红包款项发放给用户乙的账户(上述add 或红包合约中用户乙的账户)。 Specifically, when the red envelope contract executes the transaction group, the three accounts add1, add2, and add3 are generated in the red envelope contract, and the red envelope payment paid by user A is distributed to the three accounts according to the above distribution method; when the red envelope contract is executed When the red envelope generated by the index r1 receives the transaction tx3 and the verification is passed, the red envelope money in the add1 account is issued to the account of user B (the above add B or the account of user B in the red envelope contract).
上述实施例进一步通过由红包合约将红包款项分配至各子地址的账户中,并在发放红包时将第一索引对应的子地址的账户中的红包款项进行发放,保障了一项索引无法被重复用于红包领取。The above embodiment further distributes the red envelope payment to the account of each sub address by the red envelope contract, and distributes the red envelope payment in the account of the sub address corresponding to the first index when the red envelope is issued, ensuring that an index cannot be repeated Used for red envelope collection.
图3为本发明一实施例提供的一种适用于区块链节点的红包处理方法的流程图。图3所示的方法可配合图2所示的方法执行。FIG. 3 is a flowchart of a red packet processing method suitable for blockchain nodes according to an embodiment of the present invention. The method shown in FIG. 3 can be executed in conjunction with the method shown in FIG. 2.
如图3所示,在本实施例中,本发明还提供一种适用于区块链节点的红包处理方法,包括:As shown in Figure 3, in this embodiment, the present invention also provides a red packet processing method suitable for blockchain nodes, including:
S201:接收并执行服务端发送的交易组以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;其中,交易组由服务端接收第一用户端发送的发红包请求信息和红包支付交易,生成主私钥和对应的主链码、主公钥并根据发红包请求信息包括的红包个数生成第一索引列表,根据主私钥、主链码和第一索引列表生成子私钥列表,根据主公钥和主链码生成发红包交易后,将发红包交易和红包支付交易打包生成;S201: Receive and execute the transaction group sent by the server to freeze the red envelope payment of the red envelope payment transaction in the red envelope contract, and record the master public key and the main chain code on the first blockchain; where the transaction group is determined by the server Receive the red envelope request information and the red envelope payment transaction sent by the first client, generate the master private key, the corresponding main chain code, and the master public key, and generate the first index list according to the number of red envelopes included in the red envelope request information. Key, main chain code, and first index list to generate a list of sub-private keys, after generating a red envelope transaction based on the master public key and main chain code, package the red envelope transaction and red envelope payment transaction to generate;
S203:接收并执行领取到红包的用户的第二用户端发送的红包领取交易以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:S203: Receive and execute the red envelope receiving transaction sent by the second client of the user who received the red envelope to verify whether the first sub-public key generated according to the master public key, the main chain code and the first index can verify the first signature through the red envelope contract information:
是,则执行步骤S205:红包合约向用户的账户发放红包;其中,红包领取交易由第二用户端在收到服务端发送的第一索引列表中的第一索引和对应于第一索引的第一子私钥后,通过第一子私钥签名生成第一签名信息、根据第一索引和第一签名信息生成。If yes, perform step S205: the red envelope contract issues red envelopes to the user’s account; where the red envelope receiving transaction is received by the second user terminal from the first index in the first index list sent by the server and the first index corresponding to the first index After a sub-private key, first signature information is generated by signing the first sub-private key, and generated according to the first index and the first signature information.
图3所示方法的红包处理原理可参照图2所示的方法,此处不再赘述。For the red packet processing principle of the method shown in FIG. 3, refer to the method shown in FIG. 2, which will not be repeated here.
图4为图3所示方法的一种优选实施方式的流程图。图4所示的方法可配合图2所示的优选实施例所提供的方法执行。FIG. 4 is a flowchart of a preferred embodiment of the method shown in FIG. 3. The method shown in FIG. 4 can be executed in conjunction with the method provided in the preferred embodiment shown in FIG. 2.
如图4所示,在一优选实施例中,步骤S201包括:As shown in FIG. 4, in a preferred embodiment, step S201 includes:
S2012:在红包合约中配置子地址列表所包括的各子地址的账户;S2012: Configure the account of each sub-address included in the sub-address list in the red envelope contract;
S2014:将红包支付交易支付的红包款项分配至各子地址的账户中;S2014: Allocate the red envelope payment of the red envelope payment transaction to the account of each sub-address;
S2016:将主公钥和子地址列表记录到第一区块链上;S2016: Record the master public key and sub-address list on the first blockchain;
步骤S205包括:Step S205 includes:
S2052:将红包合约中第一子地址的账户中的红包款项发放给该用户的账户。S2052: Distribute the red envelope money in the account of the first sub-address in the red envelope contract to the user's account.
图4所示方法的红包处理原理可参照图2所示的优选实施例提供的方法,此处不再赘述。For the red packet processing principle of the method shown in FIG. 4, reference may be made to the method provided in the preferred embodiment shown in FIG. 2, which will not be repeated here.
图5为本发明一实施例提供的一种适用于用户端的红包处理方法的流程图。图5所示的方法可配合图2-4所示的方法执行。Fig. 5 is a flowchart of a red packet processing method suitable for a user terminal according to an embodiment of the present invention. The method shown in Figure 5 can be executed in conjunction with the method shown in Figures 2-4.
如图5所示,在本实施例中,本发明还提供一种适用于上述第二用户端的红包处理方法,包括:As shown in FIG. 5, in this embodiment, the present invention also provides a red packet processing method suitable for the above-mentioned second user terminal, including:
S301:领取到红包后,接收服务端发送的第一索引列表中的第一索引和对应于第一索引的第一子私钥;其中,第一索引列表由服务端接收第一用户端发送的发红包请求信息和红包支付交易后,生成与发红包请求信息包括的红包个数相同个数的索引所组成,第一子私钥根据服务端生成的主私钥和主链码,以及第一索引生成;S301: After receiving the red envelope, receive the first index in the first index list sent by the server and the first sub-private key corresponding to the first index; wherein the first index list is received by the server from the first user. After the red envelope request information and the red envelope payment transaction, an index consisting of the same number of red envelopes included in the red envelope request information is generated. The first sub-private key is based on the master private key and the main chain code generated by the server, and the first Index generation;
S303:通过第一子私钥签名生成第一签名信息,根据第一索引和第一签名信息生成红包领取交易并发送至第一区块链的节点以供执行以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则红包合约发放红包;其中,子私钥列表由服务端生成主私钥和对应的主链码、主公钥后,根据主私钥、主链码和第一索引列表生成,并由服务端根据主公钥和主链码生成发红包交易将发红包交易和红包支付交易打包为交易组并发送至第一区块链的节点以供执行以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上。S303: Generate first signature information through the first sub-private key signature, generate a red envelope receipt transaction based on the first index and the first signature information and send it to the node of the first blockchain for execution to verify the red envelope contract according to the master public key , The main chain code and the first sub-public key generated by the first index can verify the first signature information: yes, the red envelope contract will issue a red envelope; among them, the sub-private key list is generated by the server to generate the master private key and the corresponding main chain code After the master public key, it is generated according to the master private key, the main chain code and the first index list, and the red envelope transaction is generated by the server according to the master public key and the main chain code. The red envelope transaction and the red envelope payment transaction are packaged into a transaction group and Send to the node of the first blockchain for execution to freeze the red envelope payment of the red envelope payment transaction in the red envelope contract, and record the master public key and the main chain code on the first blockchain.
图5所示方法的红包处理原理同样可参照图2所示的方法,此处不再赘述。The red packet processing principle of the method shown in FIG. 5 can also be referred to the method shown in FIG. 2, which will not be repeated here.
图6为本发明另一实施例提供的一种适用于服务端的红包处理方法的流程图。如图6所示,在另一实施例中,本发明还提供另一种适用于服务端的红包处理方法,包括:Fig. 6 is a flowchart of a red packet processing method suitable for a server according to another embodiment of the present invention. As shown in Figure 6, in another embodiment, the present invention also provides another red packet processing method suitable for the server, including:
S401:接收第一用户端发送的发红包请求信息和红包支付交易;其中,发红包请求信息包括红包个数;S401: Receive the red envelope sending request information and the red envelope payment transaction sent by the first user terminal; wherein the red envelope sending request information includes the number of red envelopes;
S403:生成主私钥和对应的主链码、主公钥,并根据红包个数生成第一索引列表;其中,第一索引列表包括与红包个数相同数量的索引;S403: Generate a master private key and a corresponding main chain code and master public key, and generate a first index list according to the number of red envelopes; wherein, the first index list includes the same number of indexes as the number of red envelopes;
S405:根据主私钥、主链码和第一索引列表生成子私钥列表,根据主公钥和主链码生成发红包交易;S405: Generate a sub-private key list according to the master private key, the main chain code, and the first index list, and generate a red envelope transaction according to the master public key and the main chain code;
S407:将发红包交易和红包支付交易打包为交易组并发送至第一区块链的节点以供执行以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;S407: Package the red envelope transaction and the red envelope payment transaction into a transaction group and send it to the node of the first blockchain for execution to freeze the red envelope payment of the red envelope payment transaction in the red envelope contract, and the master public key and main chain code Record to the first blockchain;
S409:根据子私钥列表中的第一子私钥签名生成第一签名信息,并根据领取到红包的用户的账户信息、对应于第一子私钥的第一索引和第一签名信息生成红包领取交易并发送至第一区块链的节点以供执行以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则红包合约向用户的账户发放红包。S409: Generate the first signature information according to the first sub-private key signature in the sub-private key list, and generate the red envelope according to the account information of the user who received the red envelope, the first index corresponding to the first sub-private key, and the first signature information Receive the transaction and send it to the node of the first blockchain for execution to verify whether the first sub-public key generated according to the master public key, the master chain code and the first index can verify the first signature information through the red envelope contract: yes, then The red envelope contract issues red envelopes to the user's account.
优选地,上述将红包支付交易支付的红包款项冻结在红包合约中包括:在红包合约中配置子地址列表所包括的各子地址的账户;以及,将红包支付交易支付的红包款项分配至各子地址的账户中;Preferably, freezing the red envelope payment of the red envelope payment transaction in the red envelope contract includes: configuring the account of each sub-address included in the sub-address list in the red envelope contract; and allocating the red envelope payment of the red envelope payment transaction to each sub-address Address in the account;
上述红包合约向用户的账户发放红包包括:将红包合约中第一子地址的账户中的红包款项发放给用户的账户。The above-mentioned red envelope contract issuing red envelopes to the user's account includes: issuing red envelope funds in the account of the first sub-address in the red envelope contract to the user's account.
图6所示方法与图2所示方法的区别在于,在图6所示的方法中,步骤S409中由服务端10为第二用户生成红包领取交易并发送至节点501,而在图2所示的方法中,步骤S109中由第二用户的第二用户端30生成红包领取交易并发送至节点501。The difference between the method shown in FIG. 6 and the method shown in FIG. 2 is that, in the method shown in FIG. 6, the server 10 generates a red envelope receipt transaction for the second user in step S409 and sends it to the node 501, while in the method shown in FIG. In the method shown, in step S109, the second user terminal 30 of the second user generates a red envelope receiving transaction and sends it to the node 501.
图7为本发明另一实施例提供的一种适用于区块链节点的红包处理方法的流程图。图7所示的方法可配合图6所示的方法执行。FIG. 7 is a flowchart of a red packet processing method suitable for blockchain nodes according to another embodiment of the present invention. The method shown in FIG. 7 can be executed in conjunction with the method shown in FIG. 6.
如图7所示,在另一实施例中,本发明还提供另一种适用于区块链节点的红包处理方法,包括:As shown in Figure 7, in another embodiment, the present invention also provides another red envelope processing method suitable for blockchain nodes, including:
S501:接收并执行服务端发送的交易组以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;其中,交易组由服务端接收第一用户端发送的发红包请求信息和红包 支付交易,生成主私钥和对应的主链码、主公钥并根据发红包请求信息包括的红包个数生成第一索引列表,根据主私钥、主链码和第一索引列表生成子私钥列表,根据主公钥和主链码生成发红包交易后,将发红包交易和红包支付交易打包生成;S501: Receive and execute the transaction group sent by the server to freeze the red envelope payment of the red envelope payment transaction in the red envelope contract, and record the master public key and the main chain code on the first blockchain; where the transaction group is determined by the server Receive the red envelope request information and the red envelope payment transaction sent by the first client, generate the master private key, the corresponding main chain code, and the master public key, and generate the first index list according to the number of red envelopes included in the red envelope request information. Key, main chain code, and first index list to generate a list of sub-private keys, after generating a red envelope transaction based on the master public key and main chain code, package the red envelope transaction and red envelope payment transaction to generate;
S503:接收并执行服务端发送的红包领取交易以通过红包合约验证根据主公钥、主链码和第一索引生成的第一子公钥是否能验证第一签名信息:S503: Receive and execute the red envelope receiving transaction sent by the server to verify through the red envelope contract whether the first sub-public key generated according to the main public key, the main chain code and the first index can verify the first signature information:
是,则执行步骤S505:红包合约向用户的账户发放红包;其中,红包领取交易由服务端根据子私钥列表中的第一子私钥签名生成第一签名信息,并根据领取到红包的用户的账户信息、对应于第一子私钥的第一索引和第一签名信息生成。If yes, proceed to step S505: the red envelope contract issues red envelopes to the user’s account; among them, the red envelope receiving transaction is generated by the server according to the first sub-private key signature in the sub-private key list, and according to the user who received the red envelope The account information, the first index corresponding to the first sub-private key, and the first signature information are generated.
图7所示方法与图3所示方法的区别同样在于,在图7所示的方法中,红包领取交易由服务端10生成并发送至节点501,而在图3所示的方法中,红包领取交易由第二用户端30生成并发送至节点501。The difference between the method shown in FIG. 7 and the method shown in FIG. 3 is also that, in the method shown in FIG. 7, the red packet receiving transaction is generated by the server 10 and sent to the node 501, while in the method shown in FIG. The receiving transaction is generated by the second client 30 and sent to the node 501.
图8为本发明一实施例提供的一种设备的结构示意图。FIG. 8 is a schematic structural diagram of a device provided by an embodiment of the present invention.
如图8所示,作为另一方面,本申请还提供了一种设备800,包括一个或多个中央处理单元(CPU)801,其可以根据存储在只读存储器(ROM)802中的程序或者从存储部分808加载到随机访问存储器(RAM)803中的程序而执行各种适当的动作和处理。在RAM803中,还存储有设备800操作所需的各种程序和数据。CPU801、ROM802以及RAM803通过总线804彼此相连。输入/输出(I/O)接口805也连接至总线804。As shown in FIG. 8, as another aspect, the present application also provides a device 800, which includes one or more central processing units (CPU) 801, which can be based on a program stored in a read-only memory (ROM) 802 or The program loaded from the storage section 808 into the random access memory (RAM) 803 executes various appropriate actions and processing. In the RAM 803, various programs and data required for the operation of the device 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
以下部件连接至I/O接口805:包括键盘、鼠标等的输入部分806;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分807;包括硬盘等的存储部分808;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分809。通信部分809经由诸如因特网的网络执行通信处理。驱动器810也根据需要连接至I/O接口805。可拆卸介质811,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器810上,以便于从其上读出的计算机程序根据需要被安装入存储部分808。The following components are connected to the I/O interface 805: an input part 806 including a keyboard, a mouse, etc.; an output part 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and speakers, etc.; a storage part 808 including a hard disk, etc. ; And a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. The driver 810 is also connected to the I/O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that the computer program read therefrom is installed into the storage section 808 as needed.
特别地,根据本公开的实施例,上述任一实施例描述的红包处理方法可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括有形地包含在机器可读介质上的计算机程序,所述计算机程序包含用于执行红包处理方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分809从网络上被下载和安装,和/或从可拆卸介质811被安装。In particular, according to the embodiments of the present disclosure, the red packet processing method described in any of the above embodiments can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes program code for executing a red packet processing method. In such an embodiment, the computer program may be downloaded and installed from the network through the communication part 809, and/or installed from the removable medium 811.
作为又一方面,本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例的装置中所包含的计算机可读存储介质;也可以是单独存在,未装配入设备中的计算机可读存储介质。计算机可读存储介质存储有一个或者一个以上程序,该程序被一个或者一个以上的处理器用来执行描述于本申请的红包处理方法。As yet another aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium may be the computer-readable storage medium included in the device of the above-mentioned embodiment; or it may exist alone without being installed. The computer-readable storage medium in the device. The computer-readable storage medium stores one or more programs, and the program is used by one or more processors to execute the red packet processing method described in this application.
附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这根据所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以通过执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以通过专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the drawings illustrate the possible implementation architecture, functions, and operations of the system, method, and computer program product according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logic function Executable instructions. It should also be noted that, in some alternative implementations, the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown one after another can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
描述于本申请实施例中所涉及到的单元或模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元或模块也可以设置在处理器中,例如,各所述单元可以是设置在计算机或移动智能设备中的软件程序,也可以是单独配置的硬件装置。其中,这些单元或模块的名称在某种情况下并不构成对该单元或模块本身的限定。The units or modules involved in the embodiments described in the present application can be implemented in software or hardware. The described units or modules may also be arranged in the processor. For example, each of the described units may be a software program arranged in a computer or a mobile smart device, or may be a separately configured hardware device. Among them, the names of these units or modules do not constitute a limitation on the units or modules themselves under certain circumstances.
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离 本申请构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present application and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover the above technical features or technical solutions without departing from the concept of the application. Other technical solutions formed by any combination of its equivalent features. For example, the above-mentioned features and the technical features disclosed in this application (but not limited to) with similar functions are mutually replaced to form a technical solution.

Claims (17)

  1. 一种红包处理方法,其特征在于,所述方法适用于服务端,所述方法包括:A red packet processing method, characterized in that the method is applicable to the server, and the method includes:
    接收第一用户端发送的发红包请求信息和红包支付交易;其中,所述发红包请求信息包括红包个数;Receiving the red envelope sending request information and the red envelope payment transaction sent by the first user terminal; wherein the red envelope sending request information includes the number of red envelopes;
    生成主私钥和对应的主链码、主公钥,并根据所述红包个数生成第一索引列表;其中,所述第一索引列表包括与所述红包个数相同数量的索引;Generate a master private key and corresponding main chain code and master public key, and generate a first index list according to the number of red envelopes; wherein, the first index list includes the same number of indexes as the number of red envelopes;
    根据所述主私钥、所述主链码和所述第一索引列表生成子私钥列表,根据所述主公钥和所述主链码生成发红包交易;Generating a sub-private key list according to the master private key, the main chain code, and the first index list, and generating a red envelope transaction according to the master public key and the main chain code;
    将所述发红包交易和所述红包支付交易打包为交易组并发送至第一区块链的节点以供执行以将所述红包支付交易支付的红包款项冻结在红包合约中、将所述主公钥和所述主链码记录到所述第一区块链上;Pack the red envelope transaction and the red envelope payment transaction into a transaction group and send it to the node of the first blockchain for execution, so as to freeze the red envelope payment for the red envelope payment transaction in the red envelope contract, and the master The public key and the main chain code are recorded on the first blockchain;
    向领取到红包的用户的第二用户端发送所述第一索引列表中的第一索引和对应于所述第一索引的第一子私钥,以供所述第二用户端通过所述第一子私钥签名生成第一签名信息、根据所述第一索引和第一签名信息生成红包领取交易并发送至所述第一区块链的节点以供执行以通过所述红包合约验证根据所述主公钥、所述主链码和所述第一索引生成的第一子公钥是否能验证所述第一签名信息:是,则所述红包合约向所述用户的账户发放红包。Send the first index in the first index list and the first sub-private key corresponding to the first index to the second client of the user who has received the red envelope, so that the second client can pass the first index A sub-private key signature generates the first signature information, generates a red envelope receipt transaction according to the first index and the first signature information, and sends it to the node of the first blockchain for execution to pass the red envelope contract verification Whether the main public key, the main chain code, and the first sub-public key generated by the first index can verify the first signature information: yes, the red envelope contract issues a red envelope to the user's account.
  2. 根据权利要求1所述的方法,其特征在于,所述发红包交易还包括根据所述主公钥和所述第一索引列表生成的子地址列表;The method according to claim 1, wherein the red envelope transaction further comprises a sub-address list generated according to the master public key and the first index list;
    所述将所述红包支付交易支付的红包款项冻结在红包合约中包括:The freezing of the red envelope payment for the red envelope payment transaction in the red envelope contract includes:
    在红包合约中配置所述子地址列表所包括的各子地址的账户;Configure the account of each sub-address included in the sub-address list in the red envelope contract;
    将所述红包支付交易支付的红包款项分配至各子地址的账户中;Allocate the red envelope payment of the red envelope payment transaction to the account of each sub-address;
    所述红包合约向所述用户的账户发放红包包括:将所述红包合约中所述第一子公钥对应的第一子地址的账户中的红包款项发放给所述 用户的账户。The red envelope contract issuing the red envelope to the user's account includes: issuing the red envelope money in the account of the first sub-address corresponding to the first sub-public key in the red envelope contract to the user's account.
  3. 根据权利要求1或2所述的方法,其特征在于,所述方法采用子密钥推导(child key derivation,简称CKD)算法或增强密钥推导(hardened key derivation,简称HKD)算法。The method according to claim 1 or 2, wherein the method uses a child key derivation (CKD) algorithm or an enhanced key derivation (hardened key derivation, HKD) algorithm.
  4. 一种红包处理方法,其特征在于,所述方法适用于区块链节点,所述方法包括:A red packet processing method, characterized in that the method is suitable for blockchain nodes, and the method includes:
    接收并执行服务端发送的交易组以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;其中,所述交易组由所述服务端接收第一用户端发送的发红包请求信息和红包支付交易,生成主私钥和对应的主链码、主公钥并根据所述发红包请求信息包括的红包个数生成第一索引列表,根据所述主私钥、所述主链码和所述第一索引列表生成子私钥列表,根据所述主公钥和所述主链码生成发红包交易后,将所述发红包交易和所述红包支付交易打包生成;Receive and execute the transaction group sent by the server to freeze the red envelope payment of the red envelope payment transaction in the red envelope contract, and record the master public key and the main chain code on the first blockchain; wherein, the transaction group consists of The server receives the red envelope request information and the red envelope payment transaction sent by the first client, generates the master private key, the corresponding main chain code, and the master public key, and generates the first index list according to the number of red envelopes included in the red envelope request information , Generating a sub-private key list according to the master private key, the main chain code, and the first index list, after generating a red envelope transaction according to the master public key and the main chain code, the red envelope transaction Generate packaged with the red envelope payment transaction;
    接收并执行领取到红包的用户的第二用户端发送的红包领取交易以通过所述红包合约验证根据所述主公钥、所述主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则所述红包合约向所述用户的账户发放红包;其中,所述红包领取交易由所述第二用户端在收到所述服务端发送的所述第一索引列表中的第一索引和对应于所述第一索引的第一子私钥后,通过所述第一子私钥签名生成第一签名信息、根据所述第一索引和所述第一签名信息生成。Receive and execute the red packet receiving transaction sent by the second user terminal of the user who received the red packet to verify through the red packet contract whether the first child public key generated according to the master public key, the main chain code and the first index can be Verify the first signature information: if yes, the red envelope contract will issue a red envelope to the user’s account; wherein, the red envelope receiving transaction is received by the second user terminal after receiving the first index sent by the server After the first index in the list and the first sub-private key corresponding to the first index, the first signature information is generated by signing the first sub-private key, and according to the first index and the first signature information generate.
  5. 根据权利要求4所述的方法,其特征在于,所述发红包交易还包括根据所述主公钥和所述第一索引列表生成的子地址列表;The method according to claim 4, wherein the red envelope transaction further comprises a sub-address list generated according to the master public key and the first index list;
    所述将所述红包支付交易支付的红包款项冻结在红包合约中包括:The freezing of the red envelope payment for the red envelope payment transaction in the red envelope contract includes:
    在红包合约中配置所述子地址列表所包括的各子地址的账户;Configure the account of each sub-address included in the sub-address list in the red envelope contract;
    将所述红包支付交易支付的红包款项分配至各子地址的账户中;Allocate the red envelope payment of the red envelope payment transaction to the account of each sub-address;
    所述红包合约向所述用户的账户发放红包包括:将所述红包合约中所述第一子公钥对应的第一子地址的账户中的红包款项发放给所述用户的账户。The red envelope contract issuing the red envelope to the user's account includes: issuing the red envelope money in the account of the first sub-address corresponding to the first sub-public key in the red envelope contract to the user's account.
  6. 根据权利要求4或5所述的方法,其特征在于,所述方法采用子密钥推导(child key derivation,简称CKD)算法或增强密钥推导(hardened key derivation,简称HKD)算法。The method according to claim 4 or 5, wherein the method adopts a child key derivation (CKD) algorithm or a hardened key derivation (HKD) algorithm.
  7. 一种红包处理方法,其特征在于,所述方法适用于用户端,所述方法包括:A red packet processing method, characterized in that the method is applicable to the user side, and the method includes:
    领取到红包后,接收服务端发送的第一索引列表中的第一索引和对应于所述第一索引的第一子私钥;其中,所述第一索引列表由所述服务端接收第一用户端发送的发红包请求信息和红包支付交易后,生成与所述发红包请求信息包括的红包个数相同个数的索引所组成,所述第一子私钥根据所述服务端生成的主私钥和所述主链码,以及所述第一索引生成;After receiving the red envelope, the first index in the first index list sent by the server and the first sub-private key corresponding to the first index are received; wherein, the first index list is received by the server. After the red envelope issuance request information and the red envelope payment transaction sent by the user end, an index consisting of the same number of red envelopes as included in the red envelope request information is generated, and the first sub-private key is based on the master generated by the server. Private key, the main chain code, and the first index generation;
    通过所述第一子私钥签名生成第一签名信息,根据所述第一索引和所述第一签名信息生成红包领取交易并发送至第一区块链的节点以供执行以通过红包合约验证根据所述主公钥、所述主链码和第一索引生成的第一子公钥是否能验证所述第一签名信息:是,则所述红包合约发放红包;其中,所述子私钥列表由所述服务端生成主私钥和对应的主链码、主公钥后,根据所述主私钥、所述主链码和所述第一索引列表生成,并由所述服务端根据所述主公钥和所述主链码生成发红包交易将所述发红包交易和所述红包支付交易打包为交易组并发送至第一区块链的节点以供执行以将所述红包支付交易支付的红包款项冻结在红包合约中、将所述主公钥和所述主链码记录到所述第一区块链上。Generate first signature information through the first sub-private key signature, generate a red envelope receipt transaction based on the first index and the first signature information, and send it to the node of the first blockchain for execution to pass the red envelope contract verification Whether the first sub-public key generated according to the main public key, the main chain code and the first index can verify the first signature information: if yes, the red envelope contract issues red envelopes; wherein, the sub-private key After the server generates the master private key, the corresponding main chain code, and the master public key, the list is generated according to the master private key, the main chain code, and the first index list, and is generated by the server according to The master public key and the main chain code generate a red envelope transaction, package the red envelope transaction and the red envelope payment transaction into a transaction group and send to the node of the first blockchain for execution to pay the red envelope The red envelope payment for the transaction is frozen in the red envelope contract, and the master public key and the master chain code are recorded on the first blockchain.
  8. 根据权利要求7所述的方法,其特征在于,所述发红包交易还包括根据所述主公钥和所述第一索引列表生成的子地址列表;The method according to claim 7, wherein the red envelope transaction further comprises a sub-address list generated according to the master public key and the first index list;
    所述将所述红包支付交易支付的红包款项冻结在红包合约中包 括:The freezing of the red envelope payment for the red envelope payment transaction in the red envelope contract includes:
    在红包合约中配置所述子地址列表所包括的各子地址的账户;Configure the account of each sub-address included in the sub-address list in the red envelope contract;
    将所述红包支付交易支付的红包款项分配至各子地址的账户中;Allocate the red envelope payment of the red envelope payment transaction to the account of each sub-address;
    所述红包合约发放红包包括:根据所述红包合约中第一子公钥对应的所述第一子地址的账户中的红包款项发放红包。The issuing of red envelopes by the red envelope contract includes: issuing red envelopes according to the red envelope funds in the account of the first sub-address corresponding to the first sub-public key in the red envelope contract.
  9. 根据权利要求7或8所述的方法,其特征在于,所述方法采用子密钥推导(child key derivation,简称CKD)算法或增强密钥推导(hardened key derivation,简称HKD)算法。The method according to claim 7 or 8, characterized in that the method uses a child key derivation (CKD) algorithm or a hardened key derivation (HKD) algorithm.
  10. 一种红包处理方法,其特征在于,所述方法适用于服务端,所述方法包括:A red packet processing method, characterized in that the method is applicable to the server, and the method includes:
    接收第一用户端发送的发红包请求信息和红包支付交易;其中,所述发红包请求信息包括红包个数;Receiving the red envelope sending request information and the red envelope payment transaction sent by the first user terminal; wherein the red envelope sending request information includes the number of red envelopes;
    生成主私钥和对应的主链码、主公钥,并根据所述红包个数生成第一索引列表;其中,所述第一索引列表包括与所述红包个数相同数量的索引;Generate a master private key and corresponding main chain code and master public key, and generate a first index list according to the number of red envelopes; wherein, the first index list includes the same number of indexes as the number of red envelopes;
    根据所述主私钥、所述主链码和所述第一索引列表生成子私钥列表,根据所述主公钥和所述主链码生成发红包交易;Generating a sub-private key list according to the master private key, the main chain code, and the first index list, and generating a red envelope transaction according to the master public key and the main chain code;
    将所述发红包交易和所述红包支付交易打包为交易组并发送至第一区块链的节点以供执行以将所述红包支付交易支付的红包款项冻结在红包合约中、将所述主公钥和所述主链码记录到所述第一区块链上;Pack the red envelope transaction and the red envelope payment transaction into a transaction group and send it to the node of the first blockchain for execution, so as to freeze the red envelope payment for the red envelope payment transaction in the red envelope contract, and the master The public key and the main chain code are recorded on the first blockchain;
    根据所述子私钥列表中的第一子私钥签名生成第一签名信息,并根据领取到红包的用户的账户信息、对应于所述第一子私钥的第一索引和所述第一签名信息生成红包领取交易并发送至所述第一区块链的节点以供执行以通过所述红包合约验证根据所述主公钥、所述主链码和所述第一索引生成的第一子公钥是否能验证所述第一签名信息:是,则所述红包合约向所述用户的账户发放红包。The first signature information is generated according to the first sub-private key signature in the sub-private key list, and the first signature information is generated according to the account information of the user who received the red envelope, the first index corresponding to the first sub-private key, and the first The signature information generates a red envelope to receive the transaction and sends it to the node of the first blockchain for execution to verify the first generated according to the master public key, the master chain code, and the first index through the red envelope contract. Whether the child public key can verify the first signature information: yes, then the red envelope contract issues a red envelope to the user's account.
  11. 根据权利要求10所述的方法,其特征在于,所述发红包交易 还包括根据所述主公钥和所述第一索引列表生成的子地址列表;The method according to claim 10, wherein the red envelope transaction further comprises a sub-address list generated according to the master public key and the first index list;
    所述将所述红包支付交易支付的红包款项冻结在红包合约中包括:The freezing of the red envelope payment for the red envelope payment transaction in the red envelope contract includes:
    在红包合约中配置所述子地址列表所包括的各子地址的账户;Configure the account of each sub-address included in the sub-address list in the red envelope contract;
    将所述红包支付交易支付的红包款项分配至各子地址的账户中;Allocate the red envelope payment of the red envelope payment transaction to the account of each sub-address;
    所述红包合约向所述用户的账户发放红包包括:将所述红包合约中所述第一子公钥对应的第一子地址的账户中的红包款项发放给所述用户的账户。The red envelope contract issuing the red envelope to the user's account includes: issuing the red envelope money in the account of the first sub-address corresponding to the first sub-public key in the red envelope contract to the user's account.
  12. 根据权利要求10或11所述的方法,其特征在于,所述方法采用子密钥推导(child key derivation,简称CKD)算法或增强密钥推导(hardened key derivation,简称HKD)算法。The method according to claim 10 or 11, wherein the method adopts a child key derivation (CKD) algorithm or a hardened key derivation (HKD) algorithm.
  13. 一种红包处理方法,其特征在于,所述方法适用于区块链节点,所述方法包括:A red packet processing method, characterized in that the method is suitable for blockchain nodes, and the method includes:
    接收并执行服务端发送的交易组以将红包支付交易支付的红包款项冻结在红包合约中、将主公钥和主链码记录到第一区块链上;其中,所述交易组由所述服务端接收第一用户端发送的发红包请求信息和红包支付交易,生成主私钥和对应的主链码、主公钥并根据所述发红包请求信息包括的红包个数生成第一索引列表,根据所述主私钥、所述主链码和所述第一索引列表生成子私钥列表,根据所述主公钥和所述主链码生成发红包交易后,将所述发红包交易和所述红包支付交易打包生成;Receive and execute the transaction group sent by the server to freeze the red envelope payment of the red envelope payment transaction in the red envelope contract, and record the master public key and the main chain code on the first blockchain; wherein, the transaction group consists of The server receives the red envelope request information and the red envelope payment transaction sent by the first client, generates the master private key, the corresponding main chain code, and the master public key, and generates the first index list according to the number of red envelopes included in the red envelope request information , Generating a sub-private key list according to the master private key, the main chain code, and the first index list, after generating a red envelope transaction according to the master public key and the main chain code, the red envelope transaction Generate packaged with the red envelope payment transaction;
    接收并执行所述服务端发送的红包领取交易以通过所述红包合约验证根据所述主公钥、所述主链码和第一索引生成的第一子公钥是否能验证第一签名信息:是,则所述红包合约向所述用户的账户发放红包;其中,所述红包领取交易由所述服务端根据所述子私钥列表中的第一子私钥签名生成第一签名信息,并根据领取到红包的用户的账户信息、对应于所述第一子私钥的第一索引和所述第一签名信息生成。Receive and execute the red envelope receiving transaction sent by the server to verify through the red envelope contract whether the first child public key generated according to the master public key, the main chain code, and the first index can verify the first signature information: If yes, the red envelope contract issues red envelopes to the user's account; wherein, the red envelope receiving transaction is generated by the server according to the first sub-private key signature in the sub-private key list, and Generated according to the account information of the user who received the red envelope, the first index corresponding to the first sub-private key, and the first signature information.
  14. 根据权利要求13所述的方法,其特征在于,所述发红包交易还包括根据所述主公钥和所述第一索引列表生成的子地址列表;The method according to claim 13, wherein the red envelope transaction further comprises a sub-address list generated according to the master public key and the first index list;
    所述将所述红包支付交易支付的红包款项冻结在红包合约中包括:The freezing of the red envelope payment for the red envelope payment transaction in the red envelope contract includes:
    在红包合约中配置所述子地址列表所包括的各子地址的账户;Configure the account of each sub-address included in the sub-address list in the red envelope contract;
    将所述红包支付交易支付的红包款项分配至各子地址的账户中;Allocate the red envelope payment of the red envelope payment transaction to the account of each sub-address;
    所述红包合约向所述用户的账户发放红包包括:将所述红包合约中所述第一子公钥对应的第一子地址的账户中的红包款项发放给所述用户的账户。The red envelope contract issuing the red envelope to the user's account includes: issuing the red envelope money in the account of the first sub-address corresponding to the first sub-public key in the red envelope contract to the user's account.
  15. 根据权利要求13或14所述的方法,其特征在于,所述方法采用子密钥推导(child key derivation,简称CKD)算法或增强密钥推导(hardened key derivation,简称HKD)算法。The method according to claim 13 or 14, characterized in that the method uses a child key derivation (CKD) algorithm or a hardened key derivation (HKD) algorithm.
  16. 一种设备,其特征在于,所述设备包括:A device, characterized in that the device includes:
    一个或多个处理器;One or more processors;
    存储器,用于存储一个或多个程序,Memory, used to store one or more programs,
    当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求1-15中任一项所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the method according to any one of claims 1-15.
  17. 一种存储有计算机程序的存储介质,其特征在于,该程序被处理器执行时实现如权利要求1-15中任一项所述的方法。A storage medium storing a computer program, characterized in that, when the program is executed by a processor, the method according to any one of claims 1-15 is implemented.
PCT/CN2020/073981 2019-01-28 2020-01-23 Red envelope processing method and device, and storage medium WO2020156480A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910077864.6A CN109816362B (en) 2019-01-28 2019-01-28 Red packet processing method, device and storage medium
CN201910077864.6 2019-01-28

Publications (1)

Publication Number Publication Date
WO2020156480A1 true WO2020156480A1 (en) 2020-08-06

Family

ID=66605500

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/073981 WO2020156480A1 (en) 2019-01-28 2020-01-23 Red envelope processing method and device, and storage medium

Country Status (2)

Country Link
CN (1) CN109816362B (en)
WO (1) WO2020156480A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11126593B2 (en) 2019-06-15 2021-09-21 Facebook, Inc. Scalable, secure, efficient, and adaptable distributed digital ledger transaction network
US11249985B2 (en) 2019-06-15 2022-02-15 Facebook, Inc. Scalable, secure, efficient, and adaptable distributed digital ledger transaction network
US11249947B2 (en) 2019-06-15 2022-02-15 Facebook, Inc. Distributed digital ledger transaction network for flexible, lazy deletion of data stored within an authenticated data structure
US11405204B2 (en) * 2019-06-15 2022-08-02 Meta Platforms, Inc Scalable, secure, efficient, and adaptable distributed digital ledger transaction network

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109816362B (en) * 2019-01-28 2021-07-06 杭州复杂美科技有限公司 Red packet processing method, device and storage medium
CN110827006A (en) * 2019-11-06 2020-02-21 杭州复杂美科技有限公司 Code scanning red packet generating method, equipment and storage medium
CN113379404A (en) * 2020-03-10 2021-09-10 本无链科技(深圳)有限公司 Bracelet-based hand-qi red envelope system and method
CN112001717A (en) * 2020-10-27 2020-11-27 四川泰立科技股份有限公司 Method, system and storage medium for calculating encryption currency of digital television

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180288022A1 (en) * 2017-03-31 2018-10-04 Dr. Vijay Madisetti Method and System for Identity and Access Management for Blockchain Interoperability
CN108876359A (en) * 2018-01-03 2018-11-23 上海指旺信息科技有限公司 Stored value card platform based on block chain
CN108921525A (en) * 2018-06-29 2018-11-30 北京金山安全软件有限公司 Processing method and device for block chain red packet, electronic equipment and medium
CN109784888A (en) * 2019-01-28 2019-05-21 杭州复杂美科技有限公司 Red packet processing method, equipment and storage medium
CN109816362A (en) * 2019-01-28 2019-05-28 杭州复杂美科技有限公司 Red packet processing method, equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9858569B2 (en) * 2014-03-21 2018-01-02 Ramanan Navaratnam Systems and methods in support of authentication of an item
US10263981B1 (en) * 2015-12-02 2019-04-16 United Services Automobile Association (Usaa) Public authentication systems and methods
CN106251146B (en) * 2016-07-21 2018-04-10 恒宝股份有限公司 A kind of method of mobile payment and mobile-payment system
CN106411506B (en) * 2016-08-31 2019-04-16 飞天诚信科技股份有限公司 Key derivation method and device suitable for digital cash
CN107480986B (en) * 2017-08-14 2019-08-09 飞天诚信科技股份有限公司 A kind of method and hardware wallet using hardware realization digital cash wallet
CN108985760B (en) * 2018-06-15 2021-07-06 杭州复杂美科技有限公司 Payment method, payment system, payment device and storage medium
CN109035016B (en) * 2018-06-28 2020-10-23 杭州复杂美科技有限公司 Multi-chain concurrent transaction method
CN109102297A (en) * 2018-09-04 2018-12-28 深圳市百宝廊珠宝首饰有限公司 A kind of voidable method of payment and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180288022A1 (en) * 2017-03-31 2018-10-04 Dr. Vijay Madisetti Method and System for Identity and Access Management for Blockchain Interoperability
CN108876359A (en) * 2018-01-03 2018-11-23 上海指旺信息科技有限公司 Stored value card platform based on block chain
CN108921525A (en) * 2018-06-29 2018-11-30 北京金山安全软件有限公司 Processing method and device for block chain red packet, electronic equipment and medium
CN109784888A (en) * 2019-01-28 2019-05-21 杭州复杂美科技有限公司 Red packet processing method, equipment and storage medium
CN109816362A (en) * 2019-01-28 2019-05-28 杭州复杂美科技有限公司 Red packet processing method, equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11126593B2 (en) 2019-06-15 2021-09-21 Facebook, Inc. Scalable, secure, efficient, and adaptable distributed digital ledger transaction network
US11249985B2 (en) 2019-06-15 2022-02-15 Facebook, Inc. Scalable, secure, efficient, and adaptable distributed digital ledger transaction network
US11249947B2 (en) 2019-06-15 2022-02-15 Facebook, Inc. Distributed digital ledger transaction network for flexible, lazy deletion of data stored within an authenticated data structure
US11405204B2 (en) * 2019-06-15 2022-08-02 Meta Platforms, Inc Scalable, secure, efficient, and adaptable distributed digital ledger transaction network
US11615055B2 (en) 2019-06-15 2023-03-28 Meta Platforms, Inc. Scalable, secure, efficient, and adaptable distributed digital ledger transaction network

Also Published As

Publication number Publication date
CN109816362A (en) 2019-05-28
CN109816362B (en) 2021-07-06

Similar Documents

Publication Publication Date Title
WO2020156480A1 (en) Red envelope processing method and device, and storage medium
TWI723357B (en) Remittance method, device, computer equipment and computer readable storage medium based on blockchain
CN107332826B (en) The communication means and device of block chain agent node
WO2020001370A1 (en) Multi-chain concurrent transaction method
TW202042134A (en) Event processing method, apparatus and electronic device based on blockchain technology
TWI733091B (en) Remittance method and device based on blockchain
CN109727009B (en) Red packet processing method, apparatus and storage medium
Kaur et al. Scalability in blockchain: Challenges and solutions
BR112021009000A2 (en) computer implemented method, and, central entity computer
TW202016818A (en) Blockchain transaction method and device
CN113595726A (en) Method for controlling and distributing blockchain implementation of digital content
CN107358436B (en) Method and system for digital currency wallet payment through bank account access authentication
WO2020119298A1 (en) Event processing method and apparatus based on blockchain, and electronic device
TWI705691B (en) Block chain-based event processing method and device, and electronic equipment
CN109934566B (en) Red packet processing method, device and storage medium
US20180152429A1 (en) Systems and methods for publicly verifiable authorization
WO2021088704A1 (en) Method for sending red packet by means of scanning code, and device and storage medium
CN109903025B (en) Red packet processing method, device and storage medium
CN109685659B (en) Method for supporting offline transaction of block chain hard wallet and hard wallet
CN112995167B (en) Kafka mechanism-based electricity consumption information acquisition method, blockchain network and user terminal
Chen et al. A game theoretical analysis of non-linear blockchain system
CN113592476A (en) Cross-chain asset transfer method, computer device, and storage medium
Ni et al. Dual-anonymous off-line electronic cash for mobile payment
CN114037449A (en) Cross-chain asset transfer method, computer device, and storage medium
WO2021012814A1 (en) Digital asset authentication processing system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20747975

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20747975

Country of ref document: EP

Kind code of ref document: A1