WO2021088704A1 - 扫码发红包方法、设备和存储介质 - Google Patents

扫码发红包方法、设备和存储介质 Download PDF

Info

Publication number
WO2021088704A1
WO2021088704A1 PCT/CN2020/124477 CN2020124477W WO2021088704A1 WO 2021088704 A1 WO2021088704 A1 WO 2021088704A1 CN 2020124477 W CN2020124477 W CN 2020124477W WO 2021088704 A1 WO2021088704 A1 WO 2021088704A1
Authority
WO
WIPO (PCT)
Prior art keywords
red envelope
red
address
contract
credential information
Prior art date
Application number
PCT/CN2020/124477
Other languages
English (en)
French (fr)
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 WO2021088704A1 publication Critical patent/WO2021088704A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/04Payment circuits
    • G06Q20/06Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme
    • G06Q20/065Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme using e-cash
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • 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/3821Electronic credentials
    • 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/3825Use of electronic signatures
    • 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

Definitions

  • This application relates to the field of Internet technology, and in particular to a method, device and storage medium for scanning code to send red envelopes.
  • the present invention provides a code scanning and sending red envelope method suitable for the user end, including:
  • a first public-private key pair including the first private key and the first public key is generated, and a red envelope transaction is generated according to the first public key and sent to the blockchain node for execution through the first contract, and the red envelope is paid Frozen in the first contract, and record the first public key in the first contract;
  • Generate credential information through the first private key signature generate a red envelope QR code based on the credential information and display it in a pre-configured way for the second client to obtain credential information by collecting the red envelope QR code, and generate it based on the credential information and the first address
  • the execution of the red envelope transaction includes: verifying whether the red envelope has been received by the first address: if the red envelope has been received, the execution fails; and, according to the first public key, the credential information is verified: if the verification fails, the execution fails.
  • the present invention provides another method for sending red envelopes by scanning codes suitable for users, including:
  • the credential information is obtained by collecting the red envelope QR code; among them, the red envelope QR code is generated by the first client through the first private key signature to generate the credential information, generated according to the credential information and displayed in a pre-configured manner, the first private key and the corresponding
  • the first public key is generated by the first client in response to the red envelope, and the red envelope transaction is generated according to the first public key and sent to the blockchain node for execution through the first contract, and the red envelope payment is frozen in the first contract , Record the first public key in the first contract;
  • a red envelope transaction is generated and sent to the blockchain node for execution through the first contract, and part or all of the red envelope payment is unfrozen and transferred to the first address.
  • executing the red envelope transaction includes: verifying whether the first address has received the red envelope: if it has been received, the execution fails; and, according to the first public key, verifying credential information: if the verification fails, the execution fails.
  • the present invention provides a code scanning method for sending red envelopes suitable for blockchain nodes, including:
  • the red envelope issuance transaction is executed through the first contract, the red envelope payment is frozen in the first contract, and the first public key is recorded in the first contract; among them, the first public key and the corresponding first private key, and the red envelope transaction is determined by The first user terminal is generated in response to sending a red envelope;
  • the red envelope transaction through the first contract, unfreeze some or all of the red envelope payment and transfer to the first address; among them, the red envelope transaction is obtained by the second client through the collection of the red envelope QR code to obtain the voucher information, based on the voucher information and the first address Generated, the red envelope two-dimensional code is signed by the first user terminal through the first private key to generate credential information, generated according to the credential information, and displayed in a pre-configured manner.
  • executing the red envelope transaction includes: verifying whether the first address has received the red envelope: if it has been received, the execution fails; and, according to the first public key, verifying credential information: if the verification fails, the execution fails.
  • the present invention also provides a device, including one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to make the one or more processors execute each of the processors according to the present invention.
  • the embodiment provides a method for sending red envelopes by scanning codes.
  • the present invention also provides a storage medium storing a computer program, the computer program causing the computer to execute the method for scanning code and sending red envelopes according to the embodiments of the present invention.
  • the method, device and storage medium for sending red envelopes by scanning codes provided by many embodiments of the present invention store the public key in the contract on the blockchain, and generate the credential information transmitted through the red envelope QR code through the private key signature, so that the The user end of the red envelope generates a red envelope transaction based on the credential information.
  • the contract verifies the credential information according to the stored public key, and verifies whether the red envelope is received repeatedly at the same address, and red envelopes are issued after the verification is passed, realizing a safe and easy-to-use decentralized Red envelope issuance;
  • the code scanning method, device and storage medium for issuing red envelopes provided by some embodiments of the present invention further generate different credential information for each red envelope by the user terminal that issues red envelopes, and verify whether the same credential information is repeatedly received red envelopes by the contract, which is further improved Security.
  • FIG. 1 is a flowchart of a method for scanning a code to send a red envelope according to an embodiment of the present invention.
  • Fig. 2 is a flowchart of another method for scanning a code to send a red envelope provided by an embodiment of the present invention.
  • FIG. 3 is a flowchart of another method for scanning a code to send a red envelope provided by an embodiment of the present invention.
  • Fig. 4 is a schematic structural diagram of a device provided by an embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for scanning a code to send a red envelope according to an embodiment of the present invention.
  • the present invention provides a method for scanning a code to send a red envelope, including:
  • S12 In response to sending a red envelope, generate a first public-private key pair including the first private key and the first public key, generate a red envelope transaction according to the first public key and send it to the blockchain node for execution through the first contract, The red envelope payment is frozen in the first contract, and the first public key is recorded in the first contract;
  • S14 Generate credential information through the first private key signature, generate a red envelope QR code based on the credential information, and display it in a pre-configured manner, so that the second client can obtain credential information by collecting the red envelope QR code, and based on the credential information and the first
  • the address generates the red envelope transaction and sends it to the blockchain node for execution through the first contract, unfreezes part or all of the red envelope payment and transfers it to the first address.
  • executing the red envelope transaction includes: verifying whether the first address has received the red envelope: if it has been received, the execution fails; and, according to the first public key, verifying credential information: if the verification fails, the execution fails.
  • user A When user A needs to send red envelopes face-to-face, he enters the amount and quantity of the red envelopes in the user terminal (such as mobile phones or tablets), selects a payment account, and performs identity verification.
  • the user terminal such as mobile phones or tablets
  • step S12 the user terminal of user A generates a first public-private key pair including the first private key p and the first public key P in response to the above-mentioned operation of user A, generates the red envelope payment to the contract account, and includes the first private key p and the first public key P.
  • a red envelope transaction tx1 of a public key P sends tx1 to the blockchain node.
  • the blockchain node After the blockchain node receives, broadcasts, and packs tx1, it executes tx1 through the first contract, transfers the red envelope money to the contract account and freezes it, and records the first public key P in the contract.
  • step S14 the user terminal of user A generates credential information m based on the signature of the first private key p (signing any content), and generates a red envelope two-dimensional code based on the credential information m and displays it on the screen of the user terminal.
  • the user terminals of users B, C, and D respectively scan the screen of the user terminal of user A to collect the red envelope two-dimensional code, and decode the collected red envelope two-dimensional code to obtain the voucher information m.
  • the red envelope transaction tx2 is generated according to m and user B's address addr B and sent to the blockchain node.
  • tx2 should include the contract address of the first contract.
  • the contract address can be pre-configured by the user side, or can be delivered by the user side of user A through the red envelope QR code.
  • the blockchain node After the blockchain node receives, broadcasts, and packs tx2, it executes tx2 through the first contract to verify whether addr B has received the red envelope: if yes, the tx2 execution fails; and the signature of the credential information m is verified according to the first public key P: If the verification fails, the execution of tx2 fails; if the execution of tx2 is successful, part or all of the red envelope payment will be unfrozen and transferred to addr B according to the pre-configured red envelope distribution rules.
  • the pre-configured red envelope distribution rules can be configured as equal distribution or random distribution, and so on.
  • a random allocation method is specifically configured as:
  • the first random number can be generated according to the random number generation method disclosed in the application No. CN201811351787.0, or can be generated according to other random number generation methods in the art.
  • the user terminals of user C and user D use the same method to receive red envelopes, so I won't repeat them one by one.
  • the above is an example of the scenario of sending red envelopes face-to-face.
  • the above method is also applicable to different scenarios such as one-to-one sending of red envelopes or group red envelopes in instant messaging tools.
  • the only difference lies in the two red envelopes that will be generated in step S14.
  • the dimension code is sent as picture information in the instant messaging tool, and the second user terminal obtains the credential information by recognizing the two-dimensional code in the picture.
  • the red envelope issuance transaction also includes a second address
  • the first contract is also used to monitor whether the red envelope payment has been issued within the pre-configured time period: if not, unfreeze the remaining undistributed funds and transfer to the second address .
  • the red envelope transaction tx1 also includes the second address addr A , and the pre-configured duration is 24 hours.
  • the first contract detects that the red envelope still exists after 24 hours, Unfreeze the remaining funds issued and transfer them to addr A.
  • the pre-configured duration can use the time unit as the duration unit, or the block height as the duration unit; the pre-configured duration can be specified by the first contract or by the user A through the red envelope transaction tx1, which can achieve the same Technical effect.
  • the public key is stored in the contract on the blockchain, and the private key signature is used to generate the credential information transmitted through the red envelope QR code, so that the user receiving the red envelope generates the red envelope transaction according to the credential information.
  • the contract verifies the credential information according to the stored public key, and verifies whether the red envelope is repeatedly received at the same address, and issues the red envelope after the verification is passed, realizing a safe and easy-to-use decentralized red envelope issuance.
  • the credential information generated according to the first private key signature is different;
  • the above-mentioned execution of the red envelope transaction also includes: verifying whether the voucher information has received the red envelope: the execution fails if it has been received.
  • red envelope sent by user A as an example, in order to avoid that a user's client terminal obtains the credential information m, repeating through multiple addresses (for example, addr B-1 , addr B-2 , addr B-3 , etc.)
  • user A’s client can generate a different receipt certificate for each red envelope recipient (only need to sign any different content according to the first private key), and the contract is executed During the red envelope transaction tx2, verify whether the credential information m in tx2 has already received the red envelope: yes, then tx2 execution fails.
  • the above-mentioned embodiment further improves the security by generating different credential information for each red packet by the user side that issued the red packet, and verifying whether the same credential information is repeatedly received the red packet by the contract.
  • Fig. 2 is a flowchart of another method for scanning a code to send a red envelope provided by an embodiment of the present invention. The method shown in FIG. 2 can be executed in conjunction with the method shown in FIG. 1.
  • the present invention also provides another method for scanning a code and sending a red envelope suitable for a user end, including:
  • S22 Obtain credential information by collecting the red envelope QR code; where the red envelope QR code is signed by the first user terminal through the first private key to generate credential information, generated according to the credential information and displayed in a pre-configured manner, the first private key and The corresponding first public key is generated by the first client in response to the red envelope, and the red envelope transaction is generated according to the first public key and sent to the blockchain node for execution through the first contract, and the red envelope payment is frozen in the first In the contract, record the first public key in the first contract;
  • S24 Generate a red envelope transaction according to the credential information and the first address and send it to the blockchain node for execution through the first contract, unfreeze part or all of the red envelope payment and transfer it to the first address.
  • executing the red envelope transaction includes: verifying whether the first address has received the red envelope: if it has been received, the execution fails; and, according to the first public key, verifying credential information: if the verification fails, the execution fails.
  • the various credential information generated according to the signature of the first private key are different; executing the red envelope transaction further includes: verifying whether the credential information has received the red envelope: if the red envelope has been received, the execution fails.
  • the red envelope issuance transaction further includes a second address
  • the first contract is also used to monitor whether the red envelope payment is completed within a pre-configured time period: if not, the remaining undistributed funds are unfreeze and transferred to the second address.
  • FIG. 3 is a flowchart of another method for scanning a code to send a red envelope provided by an embodiment of the present invention. The method shown in FIG. 3 can be executed in conjunction with the methods shown in FIG. 1 and FIG. 2.
  • the present invention also provides a code scanning method for sending red envelopes suitable for blockchain nodes, including:
  • S32 Execute the red envelope issuance transaction through the first contract, freeze the red envelope payment in the first contract, and record the first public key in the first contract; among them, the first public key and the corresponding first private key, and the red envelope is issued The transaction is generated by the first client in response to the red envelope;
  • S34 Execute the red envelope transaction through the first contract, unfreeze part or all of the red envelope payment and transfer to the first address; among them, the red envelope transaction is obtained by the second user terminal by collecting the red envelope QR code to obtain the voucher information, according to the voucher information and the first address. An address is generated, and the red envelope two-dimensional code is signed by the first user terminal through the first private key to generate credential information, generated according to the credential information, and displayed in a pre-configured manner.
  • executing the red envelope transaction includes: verifying whether the first address has received the red envelope: if it has been received, the execution fails; and, according to the first public key, verifying credential information: if the verification fails, the execution fails.
  • the various credential information generated according to the signature of the first private key are different; executing the red envelope transaction further includes: verifying whether the credential information has received the red envelope: if the red envelope has been received, the execution fails.
  • the red envelope issuance transaction further includes a second address
  • the first contract is also used to monitor whether the red envelope payment is completed within a pre-configured time period: if not, the remaining undistributed funds are unfreeze and transferred to the second address.
  • unfreezing part or all of the red envelope payment and transferring to the first address includes:
  • Fig. 4 is a schematic structural diagram of a device provided by an embodiment of the present invention.
  • the present application also provides a device 400, including one or more central processing units (CPU) 401, which can be based on a program stored in a read-only memory (ROM) 402 or The program loaded from the storage section 408 into the random access memory (RAM) 403 executes various appropriate actions and processing.
  • ROM read-only memory
  • RAM random access memory
  • various programs and data required for the operation of the device 400 are also stored.
  • the CPU 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404.
  • An input/output (I/O) interface 405 is also connected to the bus 404.
  • the following components are connected to the I/O interface 405: an input part 406 including a keyboard, a mouse, etc.; an output part 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and speakers, etc.; a storage part 408 including a hard disk, etc. ; And a communication section 409 including a network interface card such as a LAN card, a modem, and the like. The communication section 409 performs communication processing via a network such as the Internet.
  • the driver 410 is also connected to the I/O interface 405 as needed.
  • a removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as required, so that the computer program read from it is installed into the storage section 408 as required.
  • an embodiment of the present disclosure includes a computer program product, which includes a computer program tangibly embodied on a machine-readable medium, and the computer program includes program code for executing any of the foregoing methods.
  • the computer program may be downloaded and installed from the network through the communication part 409, and/or installed from the removable medium 411.
  • 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;
  • the computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the methods described in this application.
  • each block in the flowchart or block diagram may 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 logical function Executable instructions.
  • 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 in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
  • 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.
  • each unit may be a software program arranged in a computer or a mobile smart device, or may be a separately configured hardware device.
  • the names of these units or modules do not constitute a limitation on the units or modules themselves under certain circumstances.

Abstract

一种扫码发红包方法、设备和存储介质,该方法包括:响应于发红包,生成包括第一私钥和第一公钥的第一公私钥对,根据第一公钥生成发红包交易并发送至区块链节点(S12)以供通过合约执行,将红包款项冻结在合约中,并将第一公钥记录在合约中;通过第一私钥签名生成凭证信息,根据凭证信息生成红包二维码并通过预配置的方式展示(S14),以供获取凭证信息,根据凭证信息和第一地址生成领红包交易并发送至区块链节点以供通过合约执行,解冻部分或全部的红包款项并转账至第一地址。其中,执行领红包交易包括:验证第一地址是否已领取该红包:已领取则执行失败;以及,根据第一公钥验证凭证信息:验证失败则执行失败。该方法实现了安全易用、完全去中心化的红包发放。

Description

扫码发红包方法、设备和存储介质 技术领域
本申请涉及互联网技术领域,具体涉及一种扫码发红包方法、设备和存储介质。
背景技术
当前市场上尚无成熟的完全去中心化的红包处理方案,为了兼顾安全性和易用性,通常都必须由中心化服务器来处理部分业务逻辑。然而对于很多去中心化系统而言,出于各方面的原因无法或不希望设置辅助的中心化服务器,结合中心化服务器的红包方案不符合该类系统的需求。
发明内容
鉴于现有技术中的上述缺陷或不足,期望提供一种安全易用、完全去中心化的扫码发红包方法、设备和存储介质。
第一方面,本发明提供一种适用于用户端的扫码发红包方法,包括:
响应于发红包,生成包括第一私钥和第一公钥的第一公私钥对,根据第一公钥生成发红包交易并发送至区块链节点以供通过第一合约执行,将红包款项冻结在第一合约中,并将第一公钥记录在第一合约中;
通过第一私钥签名生成凭证信息,根据凭证信息生成红包二维码并通过预配置的方式展示,以供第二用户端通过采集红包二维码获取凭证信息,根据凭证信息和第一地址生成领红包交易并发送至区块链节点以供通过第一合约执行,解冻部分或全部的红包款项并转账至第一地址。
其中,执行领红包交易包括:验证第一地址是否已领取该红包: 已领取则执行失败;以及,根据第一公钥验证凭证信息:验证失败则执行失败。
第二方面,本发明提供另一种适用于用户端的扫码发红包方法,包括:
通过采集红包二维码获取凭证信息;其中,红包二维码由第一用户端通过第一私钥签名生成凭证信息,根据凭证信息生成并通过预配置的方式展示,第一私钥及对应的第一公钥由第一用户端响应于发红包所生成,并根据第一公钥生成发红包交易并发送至区块链节点以供通过第一合约执行,将红包款项冻结在第一合约中,将第一公钥记录在第一合约中;
根据凭证信息和第一地址生成领红包交易并发送至区块链节点以供通过第一合约执行,解冻部分或全部的红包款项并转账至第一地址。
其中,执行领红包交易包括:验证第一地址是否已领取该红包:已领取则执行失败;以及,根据第一公钥验证凭证信息:验证失败则执行失败。
第三方面,本发明提供一种适用于区块链节点的扫码发红包方法,包括:
通过第一合约执行发红包交易,将红包款项冻结在第一合约中,并将第一公钥记录在第一合约中;其中,第一公钥及对应的第一私钥、发红包交易由第一用户端响应于发红包生成;
通过第一合约执行领红包交易,解冻部分或全部的红包款项并转账至第一地址;其中,领红包交易由第二用户端通过采集红包二维码获取凭证信息,根据凭证信息和第一地址生成,红包二维码由第一用户端通过第一私钥签名生成凭证信息,根据凭证信息生成并通过预配置的方式展示。
其中,执行领红包交易包括:验证第一地址是否已领取该红包:已领取则执行失败;以及,根据第一公钥验证凭证信息:验证失败则执行失败。
第四方面,本发明还提供一种设备,包括一个或多个处理器和存储器,其中存储器包含可由该一个或多个处理器执行的指令以使得该 一个或多个处理器执行根据本发明各实施例提供的扫码发红包方法。
第五方面,本发明还提供一种存储有计算机程序的存储介质,该计算机程序使计算机执行根据本发明各实施例提供的扫码发红包方法。
本发明诸多实施例提供的扫码发红包方法、设备和存储介质通过将公钥存储到区块链上的合约中,并通过私钥签名生成通过红包二维码传递的凭证信息,使领取到红包的用户端根据凭证信息生成领红包交易,由合约根据存储的公钥验证凭证信息,以及验证同一地址是否重复领取红包,并在验证通过后发放红包,实现了安全易用的去中心化的红包发放;
本发明一些实施例提供的扫码发红包方法、设备和存储介质进一步通过由发红包的用户端为每一份红包生成不同的凭证信息,并由合约验证同一凭证信息是否重复领取红包,进一步提升了安全性。
附图说明
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:
图1为本发明一实施例提供的一种扫码发红包方法的流程图。
图2为本发明一实施例提供的另一种扫码发红包方法的流程图。
图3为本发明一实施例提供的又一种扫码发红包方法的流程图。
图4为本发明一实施例提供的一种设备的结构示意图。
具体实施方式
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与发明相关的部分。
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。
图1为本发明一实施例提供的一种扫码发红包方法的流程图。
如图1所示,在本实施例中,本发明提供一种扫码发红包方法,包括:
S12:响应于发红包,生成包括第一私钥和第一公钥的第一公私钥对,根据第一公钥生成发红包交易并发送至区块链节点以供通过第一合约执行,将红包款项冻结在第一合约中,并将第一公钥记录在第一合约中;
S14:通过第一私钥签名生成凭证信息,根据凭证信息生成红包二维码并通过预配置的方式展示,以供第二用户端通过采集红包二维码获取凭证信息,根据凭证信息和第一地址生成领红包交易并发送至区块链节点以供通过第一合约执行,解冻部分或全部的红包款项并转账至第一地址。
其中,执行领红包交易包括:验证第一地址是否已领取该红包:已领取则执行失败;以及,根据第一公钥验证凭证信息:验证失败则执行失败。
以下以面对面扫码发红包为例,对上述方法进行示例性阐述。
用户甲在需要进行面对面发红包时,在用户端(例如手机或平板等设备)中输入红包金额及数量、选择付款账户、进行身份验证等。
在步骤S12中,用户甲的用户端响应于上述用户甲的操作,生成包括第一私钥p和第一公钥P的第一公私钥对,生成将红包款项转账至合约账户,并且包括第一公钥P的发红包交易tx1,将tx1发送至区块链节点。
区块链节点接收、广播、打包tx1后,通过第一合约执行tx1,将红包款项转账至合约账户并冻结,并将第一公钥P记录在合约中。
在步骤S14中,用户甲的用户端根据第一私钥p签名生成凭证信息m(对任意内容签名均可),根据凭证信息m生成红包二维码并展示在用户端的屏幕上。
用户乙、丙、丁的用户端分别扫描用户甲的用户端的屏幕以采集该红包二维码,对采集到的红包二维码解码以获取到凭证信息m。
以用户乙的用户端为例,获取凭证信息m后,根据m和用户乙的 地址addr 生成领红包交易tx2并发送至区块链节点。其中,tx2中应包括第一合约的合约地址,该合约地址可以由用户端预配置,也可以由用户甲的用户端通过红包二维码传递。
区块链节点接收、广播、打包tx2后,通过第一合约执行tx2,验证addr 是否已领取该红包:是,则tx2执行失败;以及,根据第一公钥P验证凭证信息m的签名:验证失败,则tx2执行失败;若tx2执行成功,则根据预配置的红包分配规则解冻部分或全部的红包款项并转账至addr
其中,预配置的红包分配规则可以配置为均分或随机分配,等等。例如,一种随机分配方式具体配置为:
判断剩余未领取的红包个数是否大于1:
否,则解冻全部剩余红包款项并转账至第一地址;
是,则根据剩余红包款项的第一数额生成小于第一数额的第二数额;以及,获取区块链生成的第一随机数,并取第二数额与第一随机数的余数,得到第三数额;解冻第三数额的红包款项并转账至第一地址。其中,第一随机数可以根据CN201811351787.0号申请所公开的随机数生成方法所生成,也可以根据本领域的其它随机数生成方法所生成。
用户丙和用户丁的用户端以同样的方式进行红包领取,不再一一赘述。
以上以面对面发红包的场景为例进行了示例性的阐述,上述方法还适用于在即时通讯工具中进行1对1发红包或群发红包等不同场景,区别仅在于步骤S14中将生成的红包二维码作为图片信息在即时通讯工具中进行发送,而第二用户端通过识别图中二维码的方式获取凭证信息。
在一优选实施例中,发红包交易还包括第二地址,第一合约还用于监测红包款项是否在预配置的时长内发放完:否,则解冻未发放的剩余款项并转账至第二地址。
同样以用户甲发红包为例,在本实施例中,发红包交易tx1还包括第二地址addr ,预配置的时长为24小时,当第一合约在24小时 后检测到该红包还存在未发放的剩余款项,则解冻剩余款项并转账至addr
其中,预配置的时长可以以时间单位作为时长单位,也可以以区块高度作为时长单位;预配置的时长可以由第一合约指定,也可以由用户甲通过发红包交易tx1指定,可实现相同的技术效果。
上述各实施例通过将公钥存储到区块链上的合约中,并通过私钥签名生成通过红包二维码传递的凭证信息,使领取到红包的用户端根据凭证信息生成领红包交易,由合约根据存储的公钥验证凭证信息,以及验证同一地址是否重复领取红包,并在验证通过后发放红包,实现了安全易用的去中心化的红包发放。
在一优选实施例中,根据第一私钥签名生成的各凭证信息各不相同;
上述执行领红包交易还包括:验证凭证信息是否已领取红包:已领取则执行失败。
具体地,同样以用户甲发红包为例,为了避免某一用户的用户端获取凭证信息m后,通过多个地址(例如addr 乙-1、addr 乙-2、addr 乙-3…等)重复领取红包,可以由用户甲的用户端为每一位红包领取方分别生成各不相同的领取凭证(只需根据第一私钥对任意的不同内容进行签名即可),并由合约在执行领红包交易tx2时验证tx2中的凭证信息m是否已领取过红包:是,则tx2执行失败。
需要说明的是,该优选方法仅适用于逐一向发红包对象展示不同的红包二维码的发红包场景,而不适用于在即时通讯工具中群发红包。
上述实施例进一步通过由发红包的用户端为每一份红包生成不同的凭证信息,并由合约验证同一凭证信息是否重复领取红包,进一步提升了安全性。
图2为本发明一实施例提供的另一种扫码发红包方法的流程图。图2所示的方法可配合图1所示的方法执行。
如图2所示,在本实施例中,本发明还提供另一种适用于用户端的扫码发红包方法,包括:
S22:通过采集红包二维码获取凭证信息;其中,红包二维码由第 一用户端通过第一私钥签名生成凭证信息,根据凭证信息生成并通过预配置的方式展示,第一私钥及对应的第一公钥由第一用户端响应于发红包所生成,并根据第一公钥生成发红包交易并发送至区块链节点以供通过第一合约执行,将红包款项冻结在第一合约中,将第一公钥记录在第一合约中;
S24:根据凭证信息和第一地址生成领红包交易并发送至区块链节点以供通过第一合约执行,解冻部分或全部的红包款项并转账至第一地址。
其中,执行领红包交易包括:验证第一地址是否已领取该红包:已领取则执行失败;以及,根据第一公钥验证凭证信息:验证失败则执行失败。
优选地,根据第一私钥签名生成的各凭证信息各不相同;执行领红包交易还包括:验证凭证信息是否已领取红包:已领取则执行失败。
优选地,发红包交易还包括第二地址,第一合约还用于监测红包款项是否在预配置的时长内发放完:否,则解冻未发放的剩余款项并转账至第二地址。
图2所示方法的扫码发红包原理可参照图1所示的方法,此处不再赘述。
图3为本发明一实施例提供的又一种扫码发红包方法的流程图。图3所示的方法可配合图1、图2所示的方法执行。
如图3所示,在本实施例中,本发明还提供一种适用于区块链节点执行的扫码发红包方法,包括:
S32:通过第一合约执行发红包交易,将红包款项冻结在第一合约中,并将第一公钥记录在第一合约中;其中,第一公钥及对应的第一私钥、发红包交易由第一用户端响应于发红包生成;
S34:通过第一合约执行领红包交易,解冻部分或全部的红包款项并转账至第一地址;其中,领红包交易由第二用户端通过采集红包二维码获取凭证信息,根据凭证信息和第一地址生成,红包二维码由第一用户端通过第一私钥签名生成凭证信息,根据凭证信息生成并通过预配置的方式展示。
其中,执行领红包交易包括:验证第一地址是否已领取该红包:已领取则执行失败;以及,根据第一公钥验证凭证信息:验证失败则执行失败。
优选地,根据第一私钥签名生成的各凭证信息各不相同;执行领红包交易还包括:验证凭证信息是否已领取红包:已领取则执行失败。
优选地,发红包交易还包括第二地址,第一合约还用于监测红包款项是否在预配置的时长内发放完:否,则解冻未发放的剩余款项并转账至第二地址。
优选地,解冻部分或全部的红包款项并转账至第一地址包括:
判断剩余未领取的红包个数是否大于1:
否,则解冻全部剩余红包款项并转账至第一地址;
是,则根据剩余红包款项的第一数额生成小于第一数额的第二数额;以及,获取区块链生成的第一随机数,并取第二数额与第一随机数的余数,得到第三数额;解冻第三数额的红包款项并转账至第一地址。
图3所示方法的扫码发红包原理同样可参照图1所示的方法,此处不再赘述。
图4为本发明一实施例提供的一种设备的结构示意图。
如图4所示,作为另一方面,本申请还提供了一种设备400,包括一个或多个中央处理单元(CPU)401,其可以根据存储在只读存储器(ROM)402中的程序或者从存储部分408加载到随机访问存储器(RAM)403中的程序而执行各种适当的动作和处理。在RAM403中,还存储有设备400操作所需的各种程序和数据。CPU401、ROM402以及RAM403通过总线404彼此相连。输入/输出(I/O)接口405也连接至总线404。
以下部件连接至I/O接口405:包括键盘、鼠标等的输入部分406;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分407;包括硬盘等的存储部分408;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分409。通信部分409经由诸如因特网的网络执行通信处理。驱动器410也根据需要连接至I/O接口 405。可拆卸介质411,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器410上,以便于从其上读出的计算机程序根据需要被安装入存储部分408。
特别地,根据本公开的实施例,上述任一实施例描述的方法可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括有形地包含在机器可读介质上的计算机程序,计算机程序包含用于执行上述任一方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分409从网络上被下载和安装,和/或从可拆卸介质411被安装。
作为又一方面,本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例的装置中所包含的计算机可读存储介质;也可以是单独存在,未装配入设备中的计算机可读存储介质。计算机可读存储介质存储有一个或者一个以上程序,该程序被一个或者一个以上的处理器用来执行描述于本申请提供的方法。
附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这根据所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以通过执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以通过专用硬件与计算机指令的组合来实现。
描述于本申请实施例中所涉及到的单元或模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元或模块也可以设置在处理器中,例如,各单元可以是设置在计算机或移动智能设备中的软件程序,也可以是单独配置的硬件装置。其中,这些单元或模块的名称在某种情况下并不构成对该单元或模块本身的限定。
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离本申请构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。

Claims (12)

  1. 一种扫码发红包方法,其特征在于,所述方法适用于用户端,所述方法包括:
    响应于发红包,生成包括第一私钥和第一公钥的第一公私钥对,根据所述第一公钥生成发红包交易并发送至区块链节点以供通过第一合约执行,将红包款项冻结在所述第一合约中,并将所述第一公钥记录在所述第一合约中;
    通过所述第一私钥签名生成凭证信息,根据所述凭证信息生成红包二维码并通过预配置的方式展示,以供第二用户端通过采集所述红包二维码获取所述凭证信息,根据所述凭证信息和第一地址生成领红包交易并发送至区块链节点以供通过所述第一合约执行,解冻部分或全部的红包款项并转账至所述第一地址;
    其中,执行所述领红包交易包括:验证所述第一地址是否已领取该红包:已领取则执行失败;以及,根据所述第一公钥验证所述凭证信息:验证失败则执行失败。
  2. 根据权利要求1所述的方法,其特征在于,根据所述第一私钥签名生成的各凭证信息各不相同;
    所述执行所述领红包交易还包括:验证所述凭证信息是否已领取红包:已领取则执行失败。
  3. 根据权利要求1所述的方法,其特征在于,所述发红包交易还包括第二地址,所述第一合约还用于监测所述红包款项是否在预配置的时长内发放完:否,则解冻未发放的剩余款项并转账至所述第二地址。
  4. 一种扫码发红包方法,其特征在于,所述方法适用于用户端,所述方法包括:
    通过采集红包二维码获取凭证信息;其中,所述红包二维码由第 一用户端通过第一私钥签名生成所述凭证信息,根据所述凭证信息生成并通过预配置的方式展示,所述第一私钥及对应的第一公钥由所述第一用户端响应于发红包所生成,并根据所述第一公钥生成发红包交易并发送至区块链节点以供通过第一合约执行,将红包款项冻结在所述第一合约中,将所述第一公钥记录在所述第一合约中;
    根据所述凭证信息和第一地址生成领红包交易并发送至区块链节点以供通过所述第一合约执行,解冻部分或全部的红包款项并转账至所述第一地址;
    其中,执行所述领红包交易包括:验证所述第一地址是否已领取该红包:已领取则执行失败;以及,根据所述第一公钥验证所述凭证信息:验证失败则执行失败。
  5. 根据权利要求4所述的方法,其特征在于,根据所述第一私钥签名生成的各凭证信息各不相同;
    所述执行所述领红包交易还包括:验证所述凭证信息是否已领取红包:已领取则执行失败。
  6. 根据权利要求4所述的方法,其特征在于,所述发红包交易还包括第二地址,所述第一合约还用于监测所述红包款项是否在预配置的时长内发放完:否,则解冻未发放的剩余款项并转账至所述第二地址。
  7. 一种扫码发红包方法,其特征在于,所述方法适用于区块链节点,所述方法包括:
    通过第一合约执行发红包交易,将红包款项冻结在所述第一合约中,并将第一公钥记录在所述第一合约中;其中,所述第一公钥及对应的第一私钥、所述发红包交易由第一用户端响应于发红包生成;
    通过所述第一合约执行领红包交易,解冻部分或全部的红包款项并转账至第一地址;其中,所述领红包交易由第二用户端通过采集红包二维码获取凭证信息,根据所述凭证信息和第一地址生成,所述红 包二维码由所述第一用户端通过所述第一私钥签名生成所述凭证信息,根据所述凭证信息生成并通过预配置的方式展示;
    其中,所述执行领红包交易包括:验证所述第一地址是否已领取该红包:已领取则执行失败;以及,根据所述第一公钥验证所述凭证信息:验证失败则执行失败。
  8. 根据权利要求7所述的方法,其特征在于,根据所述第一私钥签名生成的各凭证信息各不相同;
    所述执行所述领红包交易还包括:验证所述凭证信息是否已领取红包:已领取则执行失败。
  9. 根据权利要求7所述的方法,其特征在于,所述发红包交易还包括第二地址,所述第一合约还用于监测所述红包款项是否在预配置的时长内发放完:否,则解冻未发放的剩余款项并转账至所述第二地址。
  10. 根据权利要求7-9任一项所述的方法,其特征在于,所述解冻部分或全部的红包款项并转账至第一地址包括:
    判断剩余未领取的红包个数是否大于1:
    否,则解冻全部剩余红包款项并转账至所述第一地址;
    是,则根据剩余红包款项的第一数额生成小于所述第一数额的第二数额;以及,
    获取区块链生成的第一随机数,并取所述第二数额与所述第一随机数的余数,得到第三数额;
    解冻所述第三数额的红包款项并转账至所述第一地址。
  11. 一种设备,其特征在于,所述设备包括:
    一个或多个处理器;
    存储器,用于存储一个或多个程序,
    当所述一个或多个程序被所述一个或多个处理器执行时,使得所 述一个或多个处理器执行如权利要求1-10中任一项所述的方法。
  12. 一种存储有计算机程序的存储介质,其特征在于,该程序被处理器执行时实现如权利要求1-10中任一项所述的方法。
PCT/CN2020/124477 2019-11-06 2020-10-28 扫码发红包方法、设备和存储介质 WO2021088704A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911073993.4A CN110827006A (zh) 2019-11-06 2019-11-06 扫码发红包方法、设备和存储介质
CN201911073993.4 2019-11-06

Publications (1)

Publication Number Publication Date
WO2021088704A1 true WO2021088704A1 (zh) 2021-05-14

Family

ID=69552733

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/124477 WO2021088704A1 (zh) 2019-11-06 2020-10-28 扫码发红包方法、设备和存储介质

Country Status (2)

Country Link
CN (1) CN110827006A (zh)
WO (1) WO2021088704A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110827006A (zh) * 2019-11-06 2020-02-21 杭州复杂美科技有限公司 扫码发红包方法、设备和存储介质
CN112418949A (zh) * 2020-12-05 2021-02-26 深圳市穗深冷气设备有限公司 一种基于区块链的数据收集方法及系统
CN113592469A (zh) * 2021-08-02 2021-11-02 杭州复杂美科技有限公司 基于零知识证明的红包处理方法、计算机设备和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3435310A1 (en) * 2017-07-26 2019-01-30 Financial Transactions Control Systems Sweden AB (publ) System and method of a decentralized payment network
CN109784888A (zh) * 2019-01-28 2019-05-21 杭州复杂美科技有限公司 红包处理方法、设备和存储介质
CN109816362A (zh) * 2019-01-28 2019-05-28 杭州复杂美科技有限公司 红包处理方法、设备和存储介质
CN110148017A (zh) * 2019-04-29 2019-08-20 阿里巴巴集团控股有限公司 基于区块链的权益发放方法及装置、电子设备、存储介质
CN110363512A (zh) * 2019-07-12 2019-10-22 上海唯链信息科技有限公司 区块链红包的处理、创建、领取方法和装置、介质及计算机程序
CN110827006A (zh) * 2019-11-06 2020-02-21 杭州复杂美科技有限公司 扫码发红包方法、设备和存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108335089B (zh) * 2018-02-13 2022-02-01 成诗文 红包雨的发放方法、系统、装置和计算机可读存储介质
CN109934566B (zh) * 2019-02-11 2023-04-14 杭州复杂美科技有限公司 红包处理方法、设备和存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3435310A1 (en) * 2017-07-26 2019-01-30 Financial Transactions Control Systems Sweden AB (publ) System and method of a decentralized payment network
CN109784888A (zh) * 2019-01-28 2019-05-21 杭州复杂美科技有限公司 红包处理方法、设备和存储介质
CN109816362A (zh) * 2019-01-28 2019-05-28 杭州复杂美科技有限公司 红包处理方法、设备和存储介质
CN110148017A (zh) * 2019-04-29 2019-08-20 阿里巴巴集团控股有限公司 基于区块链的权益发放方法及装置、电子设备、存储介质
CN110363512A (zh) * 2019-07-12 2019-10-22 上海唯链信息科技有限公司 区块链红包的处理、创建、领取方法和装置、介质及计算机程序
CN110827006A (zh) * 2019-11-06 2020-02-21 杭州复杂美科技有限公司 扫码发红包方法、设备和存储介质

Also Published As

Publication number Publication date
CN110827006A (zh) 2020-02-21

Similar Documents

Publication Publication Date Title
WO2021088704A1 (zh) 扫码发红包方法、设备和存储介质
CN107438002B (zh) 基于区块链的系统以及系统中的电子设备和方法
CN108985760B (zh) 支付方法及系统、设备和存储介质
US20220239470A1 (en) Cross-blockchain data processing method and apparatus, device, and computer storage medium
TWI779231B (zh) 基於區塊鏈的存證方法和裝置
CN107767267B (zh) 一种虚拟资源的转移方法和装置
CN108985100B (zh) 基于区块链的元素安全性证明方法、装置、设备和介质
CN110659906B (zh) 票据信息处理方法、相关设备及介质
KR20200141502A (ko) 즉각적인 오프라인 블록체인 트랜잭션의 보안을 증가시키는 데 적합한 컴퓨터 구현된 시스템 및 방법
US11144926B2 (en) Blockchain-based recordkeeping method and apparatus
WO2020156480A1 (zh) 红包处理方法、设备和存储介质
US20220405736A1 (en) Payment processing system and method
CN111726226B (zh) 签名系统、方法、第一服务器及存储介质
JP6820265B2 (ja) サービス実施方法、支払い方法、及び装置
CN109660594A (zh) 业务处理结果的定向推送方法、展示方法、装置和设备
KR20200107769A (ko) 트랜잭션 데이터를 처리를 위해 블록체인 시스템에 제공하기 위한 방법 및 디바이스
TW202011312A (zh) 區塊鏈交易的認證伺服器及認證方法
CN110336779A (zh) 一种区块链的构建方法、装置和电子设备
Mavroudis et al. Snappy: Fast on-chain payments with practical collaterals
CN111937020A (zh) 一种数字货币的聚合支付方法、系统及边缘服务器
US20230325791A1 (en) Proxied cross-ledger authentication
CN110009339A (zh) 基于区块链的数据处理方法和装置
CN111461799B (zh) 数据处理方法、装置、计算机设备及介质
CN111325585A (zh) 一种资产转移方法、装置及计算机可读存储介质
AU2016272701A1 (en) Systems and methods for publicly verifiable authorization

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: 20885620

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: 20885620

Country of ref document: EP

Kind code of ref document: A1