[go: up one dir, main page]

CN110533403B - A method for consumption processing and related device - Google Patents

A method for consumption processing and related device Download PDF

Info

Publication number
CN110533403B
CN110533403B CN201910829813.4A CN201910829813A CN110533403B CN 110533403 B CN110533403 B CN 110533403B CN 201910829813 A CN201910829813 A CN 201910829813A CN 110533403 B CN110533403 B CN 110533403B
Authority
CN
China
Prior art keywords
consumption
account
transfer request
smart contract
blockchain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910829813.4A
Other languages
Chinese (zh)
Other versions
CN110533403A (en
Inventor
王星雅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910829813.4A priority Critical patent/CN110533403B/en
Publication of CN110533403A publication Critical patent/CN110533403A/en
Application granted granted Critical
Publication of CN110533403B publication Critical patent/CN110533403B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/42Confirmation, e.g. check or permission by the legal debtor of payment
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Development Economics (AREA)
  • Computer Security & Cryptography (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The embodiment of the application provides a consumption processing method and a related device, wherein the consumption authority of an account is regulated through an intelligent contract of a blockchain, so that when a user transfers consumption through the blockchain, the consumption authority of the intelligent contract is required to be met, and transfer consumption can be realized. According to the embodiment of the application, the user performs planning and arrangement on the fund purpose through the intelligent contract, so that the fund purpose planning and arrangement is safe and reliable, and the problems that the planning and arrangement through the memo are unreliable and the memo is easy to lose are solved.

Description

一种消费处理的方法以及相关装置A method for consumption processing and related device

技术领域Technical Field

本申请涉及互联网技术领域,尤其涉及一种消费处理的方法以及相关装置。The present application relates to the field of Internet technology, and in particular to a consumption processing method and related devices.

背景技术Background Art

随着互联网技术的发展,电子支付(electronic payment)在人们日常生活中应用广泛。消费者根据关联的银行卡或第三方支付账户,通过电子支付的方式可以方便地为自己喜爱的服务或物品支付金额。With the development of Internet technology, electronic payment is widely used in people's daily life. Consumers can conveniently pay for their favorite services or items through electronic payment according to the associated bank card or third-party payment account.

在目前的购物消费中,若用户A喜欢用户B售卖的物品,则用户A可以通过将自己账户中的资金转账到用户B的账户中,从用户B中购买得到该物品。若用户A期望管理自己账户中资金的使用用途,则用户A可以通过备忘录记录账户中的剩余资金以及计划的资金用途。In current shopping consumption, if user A likes an item sold by user B, user A can purchase the item from user B by transferring funds from his account to user B's account. If user A expects to manage the use of funds in his account, user A can record the remaining funds in the account and the planned use of funds through a memo.

本申请的发明人发现现有技术至少存在如下缺点:用户采用备忘录的方式管理自己的资金用途,在购物消费时容易忘记查看备忘录,从而忘记设定的资金计划。同时,采用实体备忘录时,用户容易丢失该备忘录。The inventor of the present application has found that the prior art has at least the following disadvantages: users use memos to manage their fund usage, and are prone to forget to check the memos when shopping, thereby forgetting the set fund plan. At the same time, when using physical memos, users are prone to lose the memos.

由上述分析可知,现有技术中,用户采用备忘录的方式管理资金用途存在不可靠且容易丢失的问题。From the above analysis, it can be seen that in the prior art, users use memos to manage the use of funds, which is unreliable and easy to lose.

发明内容Summary of the invention

本申请实施例提供了一种消费处理的方法以及相关装置,用于从交易过程限定资金的消费权限,解决备忘录方式不可靠且备忘录容易丢失的问题。The embodiment of the present application provides a consumption processing method and related devices for limiting the consumption authority of funds from the transaction process, thereby solving the problem that the memo method is unreliable and the memo is easily lost.

有鉴于此,本申请实施例第一方面提供一种消费处理的方法,包括:In view of this, a first aspect of an embodiment of the present application provides a consumption processing method, including:

获取账户转账请求,所述账户转账请求包括账户标识,所述账户转账请求还包括消费类型、所述消费类型对应的消费金额以及位置信息中的至少一种;Obtaining an account transfer request, the account transfer request including an account identifier, the account transfer request also including at least one of a consumption type, a consumption amount corresponding to the consumption type, and location information;

根据所述账户转账请求,通过智能合约确定消费权限,所述消费权限与所述账户标识具有对应关系;According to the account transfer request, determining the consumption authority through a smart contract, wherein the consumption authority has a corresponding relationship with the account identifier;

若所述账户转账请求满足消费权限,则通过区块链同步所述账户转账请求。If the account transfer request satisfies the consumption authority, the account transfer request is synchronized through the blockchain.

本申请实施例第二方面提供一种消费处理的装置,包括:A second aspect of an embodiment of the present application provides a consumption processing device, including:

获取单元,用于获取账户转账请求,所述账户转账请求包括账户标识,所述账户转账请求还包括消费类型、所述消费类型对应的消费金额以及位置信息中的至少一种;an acquisition unit, configured to acquire an account transfer request, wherein the account transfer request includes an account identifier, and the account transfer request also includes at least one of a consumption type, a consumption amount corresponding to the consumption type, and location information;

处理单元,用于根据所述账户转账请求,通过智能合约确定消费权限,所述消费权限与所述账户标识具有对应关系;A processing unit, configured to determine the consumption authority through a smart contract according to the account transfer request, wherein the consumption authority has a corresponding relationship with the account identifier;

处理单元,还用于若所述账户转账请求满足消费权限,则通过区块链同步所述账户转账请求。The processing unit is further configured to synchronize the account transfer request through the blockchain if the account transfer request satisfies the consumption authority.

在一种可能的设计中,在本申请实施例第二方面的一种实现方式中,所述处理单元还用于:In a possible design, in an implementation of the second aspect of the embodiment of the present application, the processing unit is further configured to:

根据所述账户转账请求获取所述消费类型对应的消费金额;Acquire the consumption amount corresponding to the consumption type according to the account transfer request;

若所述消费类型对应的消费金额小于或等于所述消费类型对应的消费限额,则确定所述账户转账请求满足所述消费权限,其中,所述消费类型对应的消费限额为通过所述智能合约确定的;If the consumption amount corresponding to the consumption type is less than or equal to the consumption limit corresponding to the consumption type, determining that the account transfer request satisfies the consumption authority, wherein the consumption limit corresponding to the consumption type is determined by the smart contract;

若所述消费类型对应的消费金额大于所述消费类型对应的消费限额,则确定所述账户转账请求未满足所述消费权限。If the consumption amount corresponding to the consumption type is greater than the consumption limit corresponding to the consumption type, it is determined that the account transfer request does not meet the consumption authority.

在一种可能的设计中,在本申请实施例第二方面的一种实现方式中,所述处理单元还用于:In a possible design, in an implementation of the second aspect of the embodiment of the present application, the processing unit is further configured to:

根据所述账户转账请求获取所述消费类型;Acquire the consumption type according to the account transfer request;

若所述消费类型满足所述账户标识对应的消费类型限制条件,则确定所述账户转账请求满足所述消费权限,其中,所述账户标识对应的消费类型限制条件为通过所述智能合约确定的;If the consumption type satisfies the consumption type restriction condition corresponding to the account identifier, determining that the account transfer request satisfies the consumption authority, wherein the consumption type restriction condition corresponding to the account identifier is determined by the smart contract;

若所述消费类型未满足所述账户标识对应的消费类型限制条件,则确定所述账户转账请求未满足所述消费权限。If the consumption type does not satisfy the consumption type restriction condition corresponding to the account identifier, it is determined that the account transfer request does not satisfy the consumption authority.

在一种可能的设计中,在本申请实施例第二方面的一种实现方式中,所述处理单元还用于:In a possible design, in an implementation of the second aspect of the embodiment of the present application, the processing unit is further configured to:

根据所述账户转账请求获取所述位置信息;acquiring the location information according to the account transfer request;

若所述位置信息满足所述账户标识对应的位置信息限制条件,则确定所述账户转账请求满足所述消费权限,其中,所述账户标识对应的位置信息限制条件为通过所述智能合约确定的;If the location information satisfies the location information restriction condition corresponding to the account identifier, determining that the account transfer request satisfies the consumption authority, wherein the location information restriction condition corresponding to the account identifier is determined by the smart contract;

若所述位置信息未满足所述账户标识对应的位置信息限制条件,则确定所述账户转账请求未满足所述消费权限。If the location information does not satisfy the location information restriction condition corresponding to the account identifier, it is determined that the account transfer request does not satisfy the consumption authority.

在一种可能的设计中,在本申请实施例第二方面的一种实现方式中,还包括存款单元,所述存款单元用于:In a possible design, in an implementation of the second aspect of the embodiment of the present application, a deposit unit is further included, and the deposit unit is used to:

获取存款请求,所述存款请求包括所述账户标识,所述消费类型以及存款金额;Obtaining a deposit request, the deposit request including the account identifier, the consumption type, and the deposit amount;

根据所述账户标识,所述消费类型以及所述存款金额,确定所述智能合约;Determining the smart contract according to the account identifier, the consumption type, and the deposit amount;

向区块链同步所述存款请求以及所述智能合约。The deposit request and the smart contract are synchronized to the blockchain.

在一种可能的设计中,在本申请实施例第二方面的一种实现方式中,所述存款单元还用于:In a possible design, in an implementation of the second aspect of the embodiment of the present application, the deposit unit is further used for:

向区块链同步所述存款请求;Synchronizing the deposit request to the blockchain;

向区块链同步所述智能合约;Synchronizing the smart contract to the blockchain;

其中,所述向区块链同步所述智能合约包括:Wherein, synchronizing the smart contract to the blockchain includes:

通过私钥加密所述智能合约,得到加密后的所述智能合约;Encrypt the smart contract using a private key to obtain the encrypted smart contract;

向区块链同步加密后的所述智能合约。The encrypted smart contract is synchronized to the blockchain.

在一种可能的设计中,在本申请实施例第二方面的一种实现方式中,所述处理单元还用于:In a possible design, in an implementation of the second aspect of the embodiment of the present application, the processing unit is further configured to:

若所述消费金额大于所述消费限额,则生成提示消息,所述提示消息用于提示转账失败。If the consumption amount is greater than the consumption limit, a prompt message is generated, wherein the prompt message is used to prompt that the transfer fails.

在一种可能的设计中,在本申请实施例第二方面的一种实现方式中,所述处理单元还用于:In a possible design, in an implementation of the second aspect of the embodiment of the present application, the processing unit is further configured to:

根据所述消费限额与所述消费金额确定更新后的所述消费限额。The updated consumption limit is determined according to the consumption limit and the consumption amount.

在一种可能的设计中,在本申请实施例第二方面的一种实现方式中,所述处理单元还用于:In a possible design, in an implementation of the second aspect of the embodiment of the present application, the processing unit is further configured to:

根据所述智能合约中的所述消费限额生成提醒消息,所述提醒消息用于展示所述消费限额。A reminder message is generated according to the consumption limit in the smart contract, and the reminder message is used to display the consumption limit.

在一种可能的设计中,在本申请实施例第二方面的一种实现方式中,所述处理单元还用于:In a possible design, in an implementation of the second aspect of the embodiment of the present application, the processing unit is further configured to:

根据所述账户转账请求中的所述账户标识获取历史消费记录,所述历史消费记录与所述账户标识具有关联关系;Acquire historical consumption records according to the account identifier in the account transfer request, where the historical consumption records are associated with the account identifier;

根据所述账户转账请求中的所述账户标识、所述消费类型以及所述历史消费记录,通过所述智能合约确定所述消费类型对应的消费限额。According to the account identifier in the account transfer request, the consumption type and the historical consumption record, the consumption limit corresponding to the consumption type is determined through the smart contract.

本申请实施例第三方面提供一种节点设备,该节点设备可以是终端设备或服务器,包括:存储器、收发器、处理器以及总线系统;A third aspect of an embodiment of the present application provides a node device, which may be a terminal device or a server, including: a memory, a transceiver, a processor, and a bus system;

其中,所述存储器用于存储程序;Wherein, the memory is used to store programs;

所述处理器用于执行所述存储器中的程序,包括如下步骤:The processor is used to execute the program in the memory, comprising the following steps:

获取账户转账请求,所述账户转账请求包括账户标识,所述账户转账请求还包括消费类型、所述消费类型对应的消费金额以及位置信息中的至少一种;Obtaining an account transfer request, the account transfer request including an account identifier, the account transfer request also including at least one of a consumption type, a consumption amount corresponding to the consumption type, and location information;

根据所述账户转账请求,通过智能合约确定消费权限,所述消费权限与所述账户标识具有对应关系;According to the account transfer request, determining the consumption authority through a smart contract, wherein the consumption authority has a corresponding relationship with the account identifier;

若所述账户转账请求满足消费权限,则通过区块链同步所述账户转账请求;所述总线系统用于连接所述存储器以及所述处理器,以使所述存储器以及所述处理器进行通信。If the account transfer request satisfies the consumption authority, the account transfer request is synchronized through the blockchain; the bus system is used to connect the memory and the processor so that the memory and the processor communicate with each other.

在一种可能的设计中,在本申请实施例第三方面的一种实现方式中,所述处理器用于执行所述存储器中的程序,还包括如下步骤:In a possible design, in an implementation manner of the third aspect of the embodiment of the present application, the processor is used to execute the program in the memory, further comprising the following steps:

根据所述账户转账请求获取所述消费类型对应的消费金额;Acquire the consumption amount corresponding to the consumption type according to the account transfer request;

若所述消费类型对应的消费金额小于或等于所述消费类型对应的消费限额,则确定所述账户转账请求满足所述消费权限,其中,所述消费类型对应的消费限额为通过所述智能合约确定的;If the consumption amount corresponding to the consumption type is less than or equal to the consumption limit corresponding to the consumption type, determining that the account transfer request satisfies the consumption authority, wherein the consumption limit corresponding to the consumption type is determined by the smart contract;

若所述消费类型对应的消费金额大于所述消费类型对应的消费限额,则确定所述账户转账请求未满足所述消费权限。If the consumption amount corresponding to the consumption type is greater than the consumption limit corresponding to the consumption type, it is determined that the account transfer request does not meet the consumption authority.

在一种可能的设计中,在本申请实施例第三方面的一种实现方式中,所述处理器用于执行所述存储器中的程序,还包括如下步骤:In a possible design, in an implementation manner of the third aspect of the embodiment of the present application, the processor is used to execute the program in the memory, further comprising the following steps:

根据所述账户转账请求获取所述消费类型;Acquire the consumption type according to the account transfer request;

若所述消费类型满足所述账户标识对应的消费类型限制条件,则确定所述账户转账请求满足所述消费权限,其中,所述账户标识对应的消费类型限制条件为通过所述智能合约确定的;If the consumption type satisfies the consumption type restriction condition corresponding to the account identifier, determining that the account transfer request satisfies the consumption authority, wherein the consumption type restriction condition corresponding to the account identifier is determined by the smart contract;

若所述消费类型未满足所述账户标识对应的消费类型限制条件,则确定所述账户转账请求未满足所述消费权限。If the consumption type does not satisfy the consumption type restriction condition corresponding to the account identifier, it is determined that the account transfer request does not satisfy the consumption authority.

在一种可能的设计中,在本申请实施例第三方面的一种实现方式中,所述处理器用于执行所述存储器中的程序,还包括如下步骤:In a possible design, in an implementation manner of the third aspect of the embodiment of the present application, the processor is used to execute the program in the memory, further comprising the following steps:

根据所述账户转账请求获取所述位置信息;acquiring the location information according to the account transfer request;

若所述位置信息满足所述账户标识对应的位置信息限制条件,则确定所述账户转账请求满足所述消费权限,其中,所述账户标识对应的位置信息限制条件为通过所述智能合约确定的;If the location information satisfies the location information restriction condition corresponding to the account identifier, determining that the account transfer request satisfies the consumption authority, wherein the location information restriction condition corresponding to the account identifier is determined by the smart contract;

若所述位置信息未满足所述账户标识对应的位置信息限制条件,则确定所述账户转账请求未满足所述消费权限。If the location information does not satisfy the location information restriction condition corresponding to the account identifier, it is determined that the account transfer request does not satisfy the consumption authority.

在一种可能的设计中,在本申请实施例第三方面的一种实现方式中,所述处理器用于执行所述存储器中的程序,还包括如下步骤:In a possible design, in an implementation manner of the third aspect of the embodiment of the present application, the processor is used to execute the program in the memory, further comprising the following steps:

获取存款请求,所述存款请求包括所述账户标识,所述消费类型以及存款金额;Obtaining a deposit request, the deposit request including the account identifier, the consumption type, and the deposit amount;

根据所述账户标识,所述消费类型以及所述存款金额,确定所述智能合约;Determining the smart contract according to the account identifier, the consumption type, and the deposit amount;

向区块链同步所述存款请求以及所述智能合约。The deposit request and the smart contract are synchronized to the blockchain.

在一种可能的设计中,在本申请实施例第三方面的一种实现方式中,所述处理器用于执行所述存储器中的程序,还包括如下步骤:In a possible design, in an implementation manner of the third aspect of the embodiment of the present application, the processor is used to execute the program in the memory, further comprising the following steps:

向区块链同步所述存款请求;Synchronizing the deposit request to the blockchain;

向区块链同步所述智能合约;Synchronizing the smart contract to the blockchain;

其中,所述向区块链同步所述智能合约包括:Wherein, synchronizing the smart contract to the blockchain includes:

通过私钥加密所述智能合约,得到加密后的所述智能合约;Encrypt the smart contract using a private key to obtain the encrypted smart contract;

向区块链同步加密后的所述智能合约。The encrypted smart contract is synchronized to the blockchain.

在一种可能的设计中,在本申请实施例第三方面的一种实现方式中,所述处理器用于执行所述存储器中的程序,还包括如下步骤:In a possible design, in an implementation manner of the third aspect of the embodiment of the present application, the processor is used to execute the program in the memory, further comprising the following steps:

若所述消费金额大于所述消费限额,则生成提示消息,所述提示消息用于提示转账失败。If the consumption amount is greater than the consumption limit, a prompt message is generated, wherein the prompt message is used to prompt that the transfer fails.

在一种可能的设计中,在本申请实施例第三方面的一种实现方式中,所述处理器用于执行所述存储器中的程序,还包括如下步骤:In a possible design, in an implementation manner of the third aspect of the embodiment of the present application, the processor is used to execute the program in the memory, further comprising the following steps:

根据所述消费限额与所述消费金额确定更新后的所述消费限额。The updated consumption limit is determined according to the consumption limit and the consumption amount.

在一种可能的设计中,在本申请实施例第三方面的一种实现方式中,所述处理器用于执行所述存储器中的程序,还包括如下步骤:In a possible design, in an implementation manner of the third aspect of the embodiment of the present application, the processor is used to execute the program in the memory, further comprising the following steps:

根据所述智能合约中的所述消费限额生成提醒消息,所述提醒消息用于展示所述消费限额。A reminder message is generated according to the consumption limit in the smart contract, and the reminder message is used to display the consumption limit.

在一种可能的设计中,在本申请实施例第三方面的一种实现方式中,所述处理器用于执行所述存储器中的程序,还包括如下步骤:In a possible design, in an implementation manner of the third aspect of the embodiment of the present application, the processor is used to execute the program in the memory, further comprising the following steps:

根据所述账户转账请求中的所述账户标识获取历史消费记录,所述历史消费记录与所述账户标识具有关联关系;Acquire historical consumption records according to the account identifier in the account transfer request, where the historical consumption records are associated with the account identifier;

根据所述账户转账请求中的所述账户标识、所述消费类型以及所述历史消费记录,通过所述智能合约确定所述消费类型对应的消费限额。According to the account identifier in the account transfer request, the consumption type and the historical consumption record, the consumption limit corresponding to the consumption type is determined through the smart contract.

本申请第四方面提供一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机执行如第一方面的方法。A fourth aspect of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enables the computer to execute the method of the first aspect.

从以上技术方案可以看出,本申请实施例具有以下优点:It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

本申请实施例提供一种消费处理的方法以及相关装置,该方法通过区块链的智能合约规定账户的消费权限,从而用户在区块链转账消费时,需符合智能合约的消费权限,才能实现转账消费。用户根据本申请实施例,通过智能合约对资金用途进行规划安排,安全可靠,解决了通过备忘录进行规划安排的不可靠且备忘录容易丢失的问题。The embodiment of the present application provides a method for consumption processing and a related device. The method specifies the consumption authority of an account through a smart contract of a blockchain, so that when a user transfers money for consumption on the blockchain, the user must comply with the consumption authority of the smart contract to realize the transfer consumption. According to the embodiment of the present application, the user plans and arranges the use of funds through a smart contract, which is safe and reliable, and solves the problem that planning and arranging through a memo is unreliable and the memo is easy to lose.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1为本申请实施例的系统架构图;FIG1 is a system architecture diagram of an embodiment of the present application;

图2为本申请实施例提供的一种消费处理的方法的流程图;FIG2 is a flow chart of a consumption processing method provided in an embodiment of the present application;

图3为本申请实施例中账户转账请求的示意图;FIG3 is a schematic diagram of an account transfer request in an embodiment of the present application;

图4为本申请实施例用户通过扫描商家的二维码向商家转账的界面图;FIG4 is an interface diagram of an embodiment of the present application in which a user transfers money to a merchant by scanning the merchant's QR code;

图5为本申请实施例商家扫描用户的客户端上的条码进行转账时用户客户端的界面图;FIG5 is an interface diagram of a user client when a merchant scans a barcode on a user's client to transfer money according to an embodiment of the present application;

图6为本申请实施例中用户直接向商家账户进行支付的界面示意图;FIG6 is a schematic diagram of an interface for a user to pay directly to a merchant account in an embodiment of the present application;

图7为本申请实施例中智能合约的示意图;FIG7 is a schematic diagram of a smart contract in an embodiment of the present application;

图8为本申请实施例中分布式区块链账本的一个网络拓扑图;FIG8 is a network topology diagram of a distributed blockchain ledger in an embodiment of the present application;

图9为本申请实施例中用户、商家与区块链的示意图;FIG9 is a schematic diagram of a user, a merchant, and a blockchain in an embodiment of the present application;

图10为本申请实施例区块链账本的示意图;FIG10 is a schematic diagram of a blockchain ledger according to an embodiment of the present application;

图11为本申请实施例中账户标识1的消费记录示意图;FIG11 is a schematic diagram of a consumption record of account identification 1 in an embodiment of the present application;

图12为本申请实施例中用户存款的界面示意图;FIG12 is a schematic diagram of an interface for user deposits in an embodiment of the present application;

图13为本申请实施例中父母向子女账户存款的示意图;FIG13 is a schematic diagram of a parent depositing money into a child's account in an embodiment of the present application;

图14为本申请实施例中终端设备提示转账失败的示意图;FIG14 is a schematic diagram of a terminal device prompting a transfer failure in an embodiment of the present application;

图15为本申请实施例更新后的智能合约示意图;FIG15 is a schematic diagram of an updated smart contract according to an embodiment of the present application;

图16为本申请实施例中终端设备显示消费计划的界面图;FIG16 is an interface diagram of a terminal device displaying a consumption plan in an embodiment of the present application;

图17为本申请实施例提供的一种消费处理的方法的流程图;FIG17 is a flow chart of a consumption processing method provided in an embodiment of the present application;

图18为本申请实施例中终端设备支付界面的示意图;FIG18 is a schematic diagram of a payment interface of a terminal device in an embodiment of the present application;

图19为一种消费处理的方法的应用例示意图;FIG19 is a schematic diagram of an application example of a consumption processing method;

图20为本申请实施例提供的一种消费处理的装置的示意图;FIG20 is a schematic diagram of a consumption processing device provided in an embodiment of the present application;

图21为本申请实施例提供的一种消费处理的装置的另一个示意图;FIG21 is another schematic diagram of a consumption processing device provided in an embodiment of the present application;

图22为与本申请实施例提供的终端相关的手机的部分结构的框图FIG. 22 is a block diagram of a partial structure of a mobile phone related to the terminal provided in an embodiment of the present application

图23是本申请实施例提供的一种服务器结构示意图。Figure 23 is a schematic diagram of a server structure provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

本申请实施例提供了一种消费处理的方法以及相关装置,用于从交易过程限定资金的消费权限,解决备忘录方式不可靠且备忘录容易丢失的问题。The embodiment of the present application provides a consumption processing method and related devices for limiting the consumption authority of funds from the transaction process, thereby solving the problem that the memo method is unreliable and the memo is easily lost.

本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“对应于”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "corresponding to" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

应理解,电子支付在人们日常生活中应用广泛,大大改善了人们的生活。人们通过终端设备例如手机或电脑,即可完成支付转账流程。然而,一些自制力较差的消费者容易冲动消费,例如,某消费者计划每月用900元作为伙食费,然而面对美食的诱惑,该消费者最后使用了2000元吃饭以及购买零食,完全超出了该消费者的计划,让该消费者苦不堪言。此外,许多家长专门为其子女开设电子支付账户,方便其子女生活,例如去饭堂打饭、购买文具、搭乘公共交通等都可以用电子支付,这些子女可能经受不住诱惑,将本来用于吃饭的饭钱用来买玩具。因此,消费者有必要对其电子支付账户的资金用途进行管理。It should be understood that electronic payment is widely used in people's daily lives and has greatly improved people's lives. People can complete the payment and transfer process through terminal devices such as mobile phones or computers. However, some consumers with poor self-control are prone to impulse consumption. For example, a consumer plans to use 900 yuan as food expenses per month. However, faced with the temptation of delicious food, the consumer finally used 2,000 yuan for meals and snacks, which completely exceeded the consumer's plan and made the consumer miserable. In addition, many parents open electronic payment accounts specifically for their children to facilitate their children's lives. For example, they can use electronic payment to get food in the canteen, buy stationery, take public transportation, etc. These children may not be able to withstand the temptation and use the money originally used for meals to buy toys. Therefore, it is necessary for consumers to manage the use of funds in their electronic payment accounts.

目前的消费者一般通过将自己的资金计划写在备忘录上,然后在进行电子支付前查看自己的备忘录中的资金计划,从而确定自己是否应该进行该电子支付。然而,许多消费者经常忘记查看备忘录,导致忘记了自己的资金计划并错误地支付了金钱。此外,消费者还可能会丢失手机,从而丢失了手机中的电子备忘录,或者消费者使用的是纸质备忘录,这类备忘录更加容易丢失。Currently, consumers generally write down their financial plans on a memo and then check the financial plans in their memo before making electronic payments to determine whether they should make the electronic payment. However, many consumers often forget to check the memo, which results in forgetting their financial plans and making erroneous payments. In addition, consumers may lose their mobile phones and thus lose the electronic memos in their mobile phones, or consumers may use paper memos, which are more likely to be lost.

为了解决上述问题,本申请实施例提供了一种消费处理的方法以及相关装置,能够从电子支付的过程对电子支付进行限制,当满足设定的规则时,消费者才能实现电子支付消费。In order to solve the above problems, the embodiments of the present application provide a consumption processing method and related devices, which can restrict electronic payments from the process of electronic payment. Consumers can only realize electronic payment consumption when the set rules are met.

图1为本申请实施例的系统架构图。可见,用户通过终端设备与商家进行转账交易,用户所用的终端设备类型与商家所用的终端设备类型相同,这些终端设备可以包括但不限于手机、台式电脑、平板电脑、笔记本电脑以及掌上电脑。这些终端设备通过网络上的服务器相互连接,以完成用户与商家之间的电子交易。用户可以与商家转账,以从商家中购买所需的物品或服务,例如,用户1与商家1转账,用户1与商家2转账。用户之间也可以进行转账,例如,用户1与用户2转账,用户1与用户3转账。FIG1 is a system architecture diagram of an embodiment of the present application. It can be seen that the user conducts a transfer transaction with the merchant through a terminal device. The type of terminal device used by the user is the same as the type of terminal device used by the merchant. These terminal devices may include but are not limited to mobile phones, desktop computers, tablet computers, laptop computers, and PDAs. These terminal devices are interconnected through servers on the network to complete electronic transactions between users and merchants. Users can transfer money with merchants to purchase the required items or services from merchants, for example, user 1 transfers money with merchant 1, and user 1 transfers money with merchant 2. Users can also transfer money between each other, for example, user 1 transfers money with user 2, and user 1 transfers money with user 3.

可以理解的是,图1中的终端设备上一般安装有用于电子支付的客户端,这些客户端可以是电脑软件、手机软件、小程序等,电脑软件可以是电脑插件、浏览器、股票交易软件等,手机软件可以是购物应用程序(Application,APP)、银行APP、第三方支付软件APP等,小程序可以是嵌入在手机软件中的功能程序。在实际应用中,还可以是其他能够实现电子支付的客户端,具体此处不做限定。It is understandable that the terminal device in FIG1 is generally installed with a client for electronic payment, which can be computer software, mobile phone software, applets, etc. Computer software can be a computer plug-in, browser, stock trading software, etc. Mobile phone software can be a shopping application (Application, APP), bank APP, third-party payment software APP, etc., and applets can be functional programs embedded in mobile phone software. In actual applications, other clients that can realize electronic payment can also be used, which are not limited here.

基于如图1所示的架构,本申请实施例提供一种消费处理的方法,如图2所示,图2为本申请实施例提供的一种消费处理的方法的流程图,该方法适合实施在用户与商家面对面交易的场景,该方法包括:Based on the architecture shown in FIG1 , an embodiment of the present application provides a method for consumption processing, as shown in FIG2 , which is a flow chart of a method for consumption processing provided by an embodiment of the present application. The method is suitable for implementation in a scenario where a user and a merchant conduct face-to-face transactions. The method includes:

201、获取账户转账请求,账户转账请求包括账户标识,账户转账请求还包括消费类型、消费类型对应的消费金额以及位置信息中的至少一种;201. Obtain an account transfer request, where the account transfer request includes an account identifier and at least one of a consumption type, a consumption amount corresponding to the consumption type, and location information;

在本申请实施例中,账户标识可以是账户的身份标识号(identity document,ID),也可以是账户的昵称,在实际应用中,还可以是其他情况,具体此处不做具体限定。账户标识具体是用户用于转账消费的账户标识。消费类型可以是伙食费、交通消费、商店消费等,可以由用户设定或账户体系的管理者设定或其他用户设定。位置信息可以是基于移动位置服务(location based service,LBS)信息,是通过电信移动运营商的无线电通讯网络(如全球移动通信系统网、码分多址通信系统网)或外部定位方式(如全球定位系统)获取移动终端用户的位置信息(地理坐标,或大地坐标)。In the embodiment of the present application, the account identifier can be an identity document (ID) of the account, or it can be a nickname of the account. In actual applications, it can also be other situations, which are not specifically limited here. The account identifier is specifically an account identifier used by the user for transfer consumption. The consumption type can be food expenses, transportation consumption, store consumption, etc., which can be set by the user or the administrator of the account system or other users. The location information can be based on mobile location service (location based service, LBS) information, which is obtained through the radio communication network of the telecommunications mobile operator (such as the global mobile communication system network, the code division multiple access communication system network) or the external positioning method (such as the global positioning system) The location information (geographic coordinates, or geodetic coordinates) of the mobile terminal user.

在一些实施例中,客户端或服务器获取包括账户标识、消费类型的账户转账请求,如下面描述:In some embodiments, the client or server obtains an account transfer request including an account identifier and a consumption type, as described below:

图3为本申请实施例中账户转账请求的示意图,可见,账户转账请求包括账户标识、消费类型以及与消费类型对应的消费金额,该消费金额与该次消费中的账户标识具有关联关系,且与该次消费的消费类型具有关联关系。例如,账户A在该次转账消费中的消费类型为伙食费,消费金额为10元。FIG3 is a schematic diagram of an account transfer request in an embodiment of the present application. It can be seen that the account transfer request includes an account identifier, a consumption type, and a consumption amount corresponding to the consumption type. The consumption amount is associated with the account identifier in the consumption and is associated with the consumption type of the consumption. For example, the consumption type of account A in the transfer consumption is food expenses, and the consumption amount is 10 yuan.

在本申请实施例中,用户到达商家的店铺中,看中某商品并决定购买,用户可以通过电子支付的方式向商家转账,从而购买到该商品。或者是,用户来到商家的饭店中,用餐消费并向商家转账。用户在向商家转账时,可以通过扫描商家的二维码向商家转账,也可以是商家扫描用户的客户端上的条码进行转账,还可以是用户直接向商家账户进行支付,以下将对这三种场景进行详细的描述:In the embodiment of the present application, a user arrives at a merchant's store, takes a fancy to a certain product and decides to buy it. The user can transfer money to the merchant through electronic payment to purchase the product. Alternatively, the user comes to the merchant's restaurant, eats and consumes and transfers money to the merchant. When the user transfers money to the merchant, he can transfer money to the merchant by scanning the merchant's QR code, or the merchant can transfer money by scanning the barcode on the user's client, or the user can pay directly to the merchant's account. The following will describe these three scenarios in detail:

图4为本申请实施例用户通过扫描商家的二维码向商家转账的界面图。用户通过客户端扫描商家的二维码后,客户端可以从二维码中获得商家标识、商家昵称、消费类型等信息,然后客户端将商家昵称显示在客户端的界面上,例如,在客户端的界面上显示“向商家(XXX)转账”,并且,客户端将消费类型自动填入对应输入区域。用户可以查看消费类型是否正确,若不正确,则用户可以点击该输入区域然后通过虚拟键盘进行修改。然后,用户还可以填入转账金额,支付密码等信息,同时,客户端还可以将用户进行转账的账户标识进行显示,例如,在客户端的界面上显示“支付用的账户:xxx”。用户确认信息无误后,点击“确定”虚拟按钮,使得客户端获取到账户转账请求,账户转账请求中可以包括用户进行转账的账户标识、显示在客户端界面上的消费类型、消费金额,一般还包括商家标识、支付密码等。FIG4 is an interface diagram of a user transferring money to a merchant by scanning a merchant's QR code in an embodiment of the present application. After the user scans the merchant's QR code through the client, the client can obtain information such as the merchant's identification, merchant nickname, consumption type, etc. from the QR code, and then the client displays the merchant's nickname on the client's interface, for example, "transfer to merchant (XXX)" is displayed on the client's interface, and the client automatically fills in the consumption type into the corresponding input area. The user can check whether the consumption type is correct. If it is not correct, the user can click on the input area and then modify it through the virtual keyboard. Then, the user can also fill in the transfer amount, payment password and other information. At the same time, the client can also display the account identification of the user for transfer, for example, "account for payment: xxx" is displayed on the client's interface. After the user confirms that the information is correct, click the "OK" virtual button, so that the client obtains the account transfer request, which may include the account identification of the user for transfer, the consumption type displayed on the client interface, the consumption amount, and generally also includes the merchant identification, payment password, etc.

在一种可能的实施例中,客户端未从二维码中获得消费类型,而是根据商家标识,通过服务器中存储的商家标识与消费类型的关联关系获取到商家标识对应的消费类型,然后将消费类型自动填入对应区域。用户可以查看消费类型是否正确,若不正确,则用户可以点击该输入区域然后通过虚拟键盘进行修改。In a possible embodiment, the client does not obtain the consumption type from the QR code, but obtains the consumption type corresponding to the merchant ID through the association relationship between the merchant ID and the consumption type stored in the server according to the merchant ID, and then automatically fills the consumption type into the corresponding area. The user can check whether the consumption type is correct. If it is not correct, the user can click on the input area and modify it through the virtual keyboard.

表1示出了商家标识与消费类型的关联关系。可见,客户端可以通过商家标识查询到对应的消费类型。消费类型可以包括但不限于伙食费、商店消费等,还可以是交通消费、资产买卖等等,具体此处不做限定。消费类型可以由用户自行设定,也可以由账户体系的管理者设定,然后上传至服务器供用户选择。Table 1 shows the association between merchant IDs and consumption types. It can be seen that the client can query the corresponding consumption type through the merchant ID. The consumption type may include but is not limited to food expenses, store consumption, etc., and may also be transportation consumption, asset trading, etc., which are not specifically limited here. The consumption type can be set by the user himself or by the administrator of the account system, and then uploaded to the server for the user to choose.

表1Table 1

在一种可能的实施例中,客户端未从二维码中获得消费类型,也未从服务器中获得消费类型,而是如图4所示,让用户自己填入消费类型。用户点击消费类型对应的输入区域时,可以通过虚拟键盘输入消费类型。In a possible embodiment, the client does not obtain the consumption type from the QR code or the server, but allows the user to fill in the consumption type as shown in Figure 4. When the user clicks the input area corresponding to the consumption type, the consumption type can be entered through the virtual keyboard.

在本申请实施例中,输入区域可以是如图4所示的下划线上方区域,也可以是通过框图将输入区域包围,还可以是其他方式,具体此处不做限定。In the embodiment of the present application, the input area may be the area above the underline as shown in FIG. 4 , or the input area may be surrounded by a box, or other methods may be used, which are not specifically limited here.

图5为本申请实施例商家扫描用户的客户端上的条码进行转账时用户客户端的界面图。可见,用户客户端上显示条码或二维码,以及支付用的账户:xxx。用户可以通过点击“支付用的账户:xxx”,从而客户端弹出用户的其他账户选择界面,以供用户选择。商家通过终端设备扫描如图3所示的界面后,可以从用户的客户端中获取到支付用的账户标识以及其他信息。然后商家的终端设备生成账户转账请求,账户转账请求中可以包括用户进行转账的账户标识、消费类型、消费金额等,以及商家标识。可以理解的是,商家的终端设备生成账户转账请求后可以将账户转账请求发送至用户的客户端上显示其内容。FIG5 is an interface diagram of the user client when the merchant scans the barcode on the user's client to transfer money in an embodiment of the present application. It can be seen that a barcode or QR code is displayed on the user client, as well as the account for payment: xxx. The user can click "Account for payment: xxx" so that the client pops up the user's other account selection interface for the user to choose. After the merchant scans the interface shown in FIG3 through the terminal device, the account identification and other information for payment can be obtained from the user's client. The merchant's terminal device then generates an account transfer request, which may include the user's account identification, consumption type, consumption amount, etc., as well as the merchant identification. It is understandable that after the merchant's terminal device generates the account transfer request, it can send the account transfer request to the user's client to display its content.

在一种可能的实施例中,商家的终端设备仅将用户进行转账的账户标识、消费金额以及商家标识等上传至服务器,然后服务器根据商家标识,通过服务器中存储的商家标识与消费类型的关联关系获取到商家标识对应的消费类型,最后服务器生成账户转账请求,账户转账请求中包括可以包括用户进行转账的账户标识、消费类型、消费金额等,以及商家标识。可以理解的是,服务器生成账户转账请求后可以将账户转账请求发送至用户的客户端上显示其内容。In a possible embodiment, the merchant's terminal device only uploads the user's account ID, consumption amount, merchant ID, etc. to the server, and then the server obtains the consumption type corresponding to the merchant ID through the association relationship between the merchant ID and the consumption type stored in the server according to the merchant ID. Finally, the server generates an account transfer request, which may include the user's account ID, consumption type, consumption amount, etc., and the merchant ID. It is understandable that after the server generates the account transfer request, it can send the account transfer request to the user's client to display its content.

在一种可能的实施例中,商家的终端设备将用户进行转账的账户标识、消费类型、消费金额以及商家标识等通过服务器发送至用户的客户端,等待用户输入支付密码并确认后,用户的客户端获取到账户转账请求。账户转账请求中可以包括用户进行转账的账户标识、消费类型、消费金额、支付密码等,以及商家标识。In a possible embodiment, the merchant's terminal device sends the user's account ID, consumption type, consumption amount, merchant ID, etc. to the user's client through the server, and after the user enters the payment password and confirms, the user's client obtains the account transfer request. The account transfer request may include the user's account ID, consumption type, consumption amount, payment password, etc., and the merchant ID.

图6为本申请实施例中用户直接向商家账户进行支付的界面示意图。商家仅提供了商家自己的账户标识给用户,商家没有二维码,也没有扫描的终端设备,则用户需要向客户端自行输入商家的账户,以及消费类型、消费金额、支付密码等。用户点击“确定”虚拟按钮后,客户端获取到账户转账请求,该账户转账请求可以包括用户进行转账的账户标识、消费类型、消费金额、支付密码等,以及商家账户标识。Figure 6 is a schematic diagram of the interface for a user to pay directly to a merchant account in an embodiment of the present application. The merchant only provides the merchant's own account ID to the user. The merchant does not have a QR code or a terminal device for scanning. The user needs to enter the merchant's account, consumption type, consumption amount, payment password, etc. into the client. After the user clicks the "OK" virtual button, the client obtains an account transfer request, which may include the user's account ID, consumption type, consumption amount, payment password, etc., as well as the merchant's account ID.

在实际应用中,客户端还可以通过其他方式获取到账户转账请求,具体此处不再赘述。In actual applications, the client can also obtain the account transfer request through other methods, which will not be described in detail here.

在另一些实施例中,客户端或服务器可以获取到包括账户标识、消费类型的账户转账请求,与前述实施例类似,此处不再赘述。In other embodiments, the client or server may obtain an account transfer request including an account identifier and a consumption type, which is similar to the aforementioned embodiment and will not be described in detail here.

在另一些实施例中,客户端或服务器可以获取到包括账户标识、位置信息的账户转账请求,其中,账户标识的获取方式与前述实施例类型,此处不再赘述。In other embodiments, the client or server may obtain an account transfer request including an account identifier and location information, wherein the method for obtaining the account identifier is similar to the aforementioned embodiment and will not be repeated here.

在本申请实施例中,客户端或服务器可以根据无线电通讯网络(如全球移动通信系统网、码分多址数字蜂窝系统网)或外部定位方式(如全球定位系统)获取到位置信息,其中,全球移动通信系统(global system for mobile communications,GSM)可称为第二代(2G)移动电话系统,码分多址(code division multiple access,CDMA)通信系统网是一种移动电话系统,全球定位系统(global positioning system,GPS)为提供定位服务的一种系统。在实际应用中,客户端或服务器还可以通过其他方式获取到客户端的位置信息,此处不做具体限定。In the embodiment of the present application, the client or server can obtain the location information based on the radio communication network (such as the global system for mobile communications network, the code division multiple access digital cellular system network) or the external positioning method (such as the global positioning system), wherein the global system for mobile communications (global system for mobile communications, GSM) can be called the second generation (2G) mobile phone system, the code division multiple access (code division multiple access, CDMA) communication system network is a mobile phone system, and the global positioning system (global positioning system, GPS) is a system that provides positioning services. In actual applications, the client or server can also obtain the location information of the client through other methods, which are not specifically limited here.

202、根据账户转账请求,通过智能合约确定消费权限,消费权限与账户标识具有对应关系;202. According to the account transfer request, the consumption authority is determined through the smart contract, and the consumption authority has a corresponding relationship with the account identifier;

在本申请实施例中,消费权限包括但不限于消费类型对应的消费限额、账户标识对应的消费类型限制条件以及账户标识对应的位置信息限制条件中的至少一种;In the embodiment of the present application, the consumption authority includes but is not limited to at least one of a consumption limit corresponding to a consumption type, a consumption type restriction condition corresponding to an account identifier, and a location information restriction condition corresponding to an account identifier;

在一些实施例中,客户端或服务器通过智能合约确定消费类型对应的消费限额,如下描述:In some embodiments, the client or server determines the consumption limit corresponding to the consumption type through a smart contract, as described below:

在本申请实施例中,智能合约是用户预先在区块链中设定的,如图7所示,智能合约中一般包括账户标识、消费类型以及消费限额。图7为本申请实施例中智能合约的示意图,可见,智能合约可以包括多个消费类型,例如消费类型1和消费类型2,它们对应不同的消费限额。例如可以是账户A中的伙食费的消费限额为100,账户A中的交通消费的消费限额为200。In the embodiment of the present application, the smart contract is pre-set by the user in the blockchain, as shown in Figure 7, and the smart contract generally includes an account identifier, a consumption type, and a consumption limit. Figure 7 is a schematic diagram of a smart contract in the embodiment of the present application. It can be seen that the smart contract can include multiple consumption types, such as consumption type 1 and consumption type 2, which correspond to different consumption limits. For example, the consumption limit for food expenses in account A can be 100, and the consumption limit for transportation consumption in account A can be 200.

终端设备获取到账户转账请求后,可以根据账户转账请求从智能合约中找到对应的消费限额,例如,账户转账请求中的账户标识为账户A以及消费类型为交通消费,则可以根据账户标识以及消费类型从智能合约中找到账户A中的交通消费的消费限额为200。After the terminal device receives the account transfer request, it can find the corresponding consumption limit from the smart contract according to the account transfer request. For example, if the account identifier in the account transfer request is account A and the consumption type is transportation consumption, it can be found from the smart contract that the consumption limit for transportation consumption in account A is 200 according to the account identifier and consumption type.

在另一些实施例中,客户端或服务器通过智能合约确定账户标识对应的消费类型限制条件,如下描述:In other embodiments, the client or server determines the consumption type restriction condition corresponding to the account identifier through a smart contract, as described below:

在本申请实施例中,智能合约是用户预先在区块链中设定的,智能合约中可以包括账户标识对应的消费类型限制条件。在一些实施例中,父母可以在智能合约中设定其子女的账户对应的消费类型限制条件为允许的消费类型包括伙食费、学习用品或零食。则当子女使用其账户进行消费时,可以通过智能合约确定该账户对应的消费类型限制条件,并与当前消费的消费类型对比,若当前消费类型符合消费类型限制条件,则可以完成消费。例如,账户当前消费类型为伙食费,客户端或服务器判断伙食费属于消费类型限制条件(包括伙食费、学习用品或零食)中的一种,则可以完成该消费。又例如,账户当前消费类型为直播打赏,客户端或服务器判断伙食费不属于消费类型限制条件(包括伙食费、学习用品或零食)中的一种,则不完成该消费。在另一些实施例中,父母可以在智能合约中设定其子女的账户对应的消费类型限制条件为禁止的消费类型包括观看色情影片、直播打赏等。则当子女使用其账户消费时,若账户当前消费类型为伙食费,不属于消费类型限制条件的禁止的消费类型,则可以完成该消费,若账户当前消费类型为直播打赏,属于消费类型限制条件的禁止的消费类型,则不完成该消费。在另一些实施例中,消费类型限制条件既包括允许的消费类型,也包括禁止的消费类型,其消费过程与前述实施例类似,此处不再赘述。In the embodiment of the present application, the smart contract is set by the user in advance in the blockchain, and the smart contract may include the consumption type restriction condition corresponding to the account identifier. In some embodiments, parents can set the consumption type restriction condition corresponding to their children's accounts in the smart contract as the allowed consumption types including food expenses, school supplies or snacks. Then when the children use their accounts to consume, the consumption type restriction condition corresponding to the account can be determined by the smart contract, and compared with the current consumption type. If the current consumption type meets the consumption type restriction condition, the consumption can be completed. For example, the current consumption type of the account is food expenses, and the client or server determines that the food expenses belong to one of the consumption type restrictions (including food expenses, school supplies or snacks), then the consumption can be completed. For another example, the current consumption type of the account is live broadcast reward, and the client or server determines that the food expenses do not belong to one of the consumption type restrictions (including food expenses, school supplies or snacks), then the consumption is not completed. In other embodiments, parents can set the consumption type restriction condition corresponding to their children's accounts in the smart contract as prohibited consumption types including watching pornographic films, live broadcast rewards, etc. When the child uses his account to make a purchase, if the current consumption type of the account is food expenses, which does not belong to the prohibited consumption types of the consumption type restriction conditions, the consumption can be completed; if the current consumption type of the account is live broadcast rewards, which belongs to the prohibited consumption types of the consumption type restriction conditions, the consumption will not be completed. In other embodiments, the consumption type restriction conditions include both permitted consumption types and prohibited consumption types, and the consumption process is similar to the above embodiments, which will not be repeated here.

在另一些实施例中,客户端或服务器通过智能合约确定账户标识对应的位置信息限制条件,如下描述:In other embodiments, the client or server determines the location information restriction condition corresponding to the account identifier through a smart contract, as described below:

在本申请实施例中,智能合约是用户预先在区块链中设定的,智能合约中可以包括账户标识对应的位置信息限制条件。在一些实施例中,用户设定位置信息限制条件包括允许的位置信息,示例性的,允许的位置信息可以包括但不限于百货商场、饭店等。当用户进行消费时,可以将用户当前的位置信息与允许的位置信息对比,若当前的位置信息属于允许的位置信息,则可以进行消费,例如,当前的位置信息为饭店,而允许的位置信息中包括饭店,则可以进行消费。在另一些实施例中,用户设定位置信息限制条件包括禁止的位置信息,示例性的,禁止的位置信息可以包括但不限于赌场区域、色情场所区域等。当用户进行消费时,可以将用户当前的位置信息与禁止的位置信息对比,若当前的位置信息属于禁止的位置信息,则不可以进行消费,例如,当前的位置信息为赌场区域,而禁止的位置信息中包括赌场区域,则不可以进行消费。在另一些实施例中,用户设定位置信息限制条件既包括允许的位置信息也包括禁止的位置信息,其消费过程与前述实施例类似,此处不再赘述。203、若账户转账请求满足消费权限,则通过区块链同步账户转账请求。In the embodiment of the present application, the smart contract is pre-set by the user in the blockchain, and the smart contract may include the location information restriction condition corresponding to the account identifier. In some embodiments, the user sets the location information restriction condition including the allowed location information. For example, the allowed location information may include but is not limited to department stores, restaurants, etc. When the user consumes, the user's current location information may be compared with the allowed location information. If the current location information belongs to the allowed location information, consumption can be carried out. For example, if the current location information is a restaurant, and the allowed location information includes a restaurant, consumption can be carried out. In other embodiments, the user sets the location information restriction condition including prohibited location information. For example, the prohibited location information may include but is not limited to casino areas, pornographic places, etc. When the user consumes, the user's current location information may be compared with the prohibited location information. If the current location information belongs to the prohibited location information, consumption cannot be carried out. For example, if the current location information is a casino area, and the prohibited location information includes a casino area, consumption cannot be carried out. In other embodiments, the user sets the location information restriction condition including both allowed location information and prohibited location information. The consumption process is similar to the aforementioned embodiment and will not be repeated here. 203. If the account transfer request satisfies the consumption authority, the account transfer request is synchronized through the blockchain.

在本申请实施例中,账户转账请求满足消费权限可以包括但不限于消费类型对应的消费金额小于或等于消费类型对应的消费限额,消费类型满足账户标识对应的消费类型限制条件,位置信息满足账户标识对应的位置信息限制条件。在实际应用中,还可以包括其他判断条件,此处不做具体限定。In the embodiment of the present application, the account transfer request meeting the consumption authority may include but is not limited to the consumption amount corresponding to the consumption type being less than or equal to the consumption limit corresponding to the consumption type, the consumption type meeting the consumption type restriction condition corresponding to the account identifier, and the location information meeting the location information restriction condition corresponding to the account identifier. In actual applications, other judgment conditions may also be included, which are not specifically limited here.

在一些实施例中,终端设备确定消费限额后,可以将账户转账请求中的消费金额与消费限额进行对比,若消费金额小于或等于消费限额,则通过区块链该同步账户转账请求。In some embodiments, after the terminal device determines the consumption limit, it can compare the consumption amount in the account transfer request with the consumption limit. If the consumption amount is less than or equal to the consumption limit, the account transfer request is synchronized through the blockchain.

区块链(blockchain)是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。随着区块链技术的发展,区块链技术在各个领域均得到了广泛应用,例如,在金融领域、信息安全、计算资源共享、娱乐游戏、社交、供应链管理或医疗等领域。Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. With the development of blockchain technology, blockchain technology has been widely used in various fields, such as finance, information security, computing resource sharing, entertainment games, social networking, supply chain management or medical fields.

区块链中,各个组织共同维护一个区块链账本,为了便于介绍,请参阅图8,图8为本申请实施例中分布式区块链账本的一个网络拓扑图,如图8所示,分布式账本(distributed ledger)是一种在网络成员之间共享、复制和同步的数据库。分布式账本记录网络参与者之间的交易,比如资产或数据的交换,这种共享账本降低了因调解不同账本所产生的时间和开支成本。在本申请中所涉及的网络成员包含但不仅限于生产者、消费者、供应商、合作伙伴、造市者、推动者和其他项目干系人,交易的资产可以是有形的物理资产(比如汽车、住房或草莓),也可以是无形的虚拟资产(比如契约、专利和证券)。资产的所有权和转移会在业务网络中创造价值,这个过程被称为交易(transaction)。In the blockchain, each organization jointly maintains a blockchain account book. For ease of introduction, please refer to Figure 8, which is a network topology diagram of a distributed blockchain account book in an embodiment of the present application. As shown in Figure 8, a distributed ledger is a database shared, copied and synchronized between network members. The distributed ledger records transactions between network participants, such as the exchange of assets or data. This shared ledger reduces the time and expense costs incurred by mediating different account books. The network members involved in this application include but are not limited to producers, consumers, suppliers, partners, market makers, promoters and other project stakeholders. The assets traded can be tangible physical assets (such as cars, houses or strawberries) or intangible virtual assets (such as contracts, patents and securities). The ownership and transfer of assets create value in the business network, and this process is called a transaction.

分布式账本是由大型网络中的每个参与者独立持有和更新的数据库。分布是独一无二的,记录不是由中央机构传达给各个节点设备,而是由每个节点设备独立构建和保存。也就是说,网络上的每一个节点设备都处理每一笔交易,得出自己的结论,然后对这些结论进行投票,以确定大多数节点设备都同意这些结论。一旦达成共识,分布式区块链账本已经更新,并且所有节点设备都维护自己账本的相同副本。即如图2所示的,节点设备1与其他节点设备(如节点设备2、节点设备3、节点设备4、节点设备5和节点设备6)共享节点设备1的本地账本,节点设备2与其他节点设备(如节点设备1、节点设备3、节点设备4、节点设备5和节点设备6)共享节点设备2的本地账本,节点设备3其他节点设备(如节点设备1、节点设备2、节点设备4、节点设备5和节点设备6)共享节点设备3的本地账本,节点设备4与其他节点设备(如节点设备1、节点设备2、节点设备3、节点设备5和节点设备6)共享节点设备4的本地账本,节点设备5与其他节点设备(如节点设备1、节点设备2、节点设备3、节点设备4和节点设备6)共享节点设备5的本地账本,节点设备6与其他节点设备(如节点设备1、节点设备2、节点设备3、节点设备4和节点设备5)共享节点设备6的本地账本。至此,节点设备1、节点设备2、节点设备3、节点设备4、节点设备5和节点设备6均维护同一个区块链账本,该区块链账本包括所有节点设备记录的数据。A distributed ledger is a database that is independently held and updated by each participant in a large network. The distribution is unique in that the records are not communicated to each node device by a central authority, but are independently constructed and saved by each node device. That is, every node device on the network processes every transaction, draws its own conclusions, and then votes on these conclusions to determine that the majority of node devices agree with them. Once consensus is reached, the distributed blockchain ledger has been updated and all node devices maintain the same copy of their own ledger. That is, as shown in Figure 2, node device 1 shares the local ledger of node device 1 with other node devices (such as node device 2, node device 3, node device 4, node device 5 and node device 6), node device 2 shares the local ledger of node device 2 with other node devices (such as node device 1, node device 3, node device 4, node device 5 and node device 6), node device 3 shares the local ledger of node device 3 with other node devices (such as node device 1, node device 2, node device 4, node device 5 and node device 6), node device 5 shares the local ledger of node device 5 with other node devices (such as node device 1, node device 2, node device 3, node device 4 and node device 6), node device 6 shares the local ledger of node device 6 with other node devices (such as node device 1, node device 2, node device 3, node device 4 and node device 5). At this point, node device 1, node device 2, node device 3, node device 4, node device 5 and node device 6 all maintain the same blockchain ledger, which includes data recorded by all node devices.

基于如图8所示的分布式区块链账本,本申请实施例用户与商家可以通过如图8所示的分布式区块链账本进行交易,用户和商家都具有自己的账户,用户和商家可以将自己的账户以及账户中的金额写在区块链账本上。Based on the distributed blockchain ledger as shown in Figure 8, users and merchants in the embodiment of the present application can conduct transactions through the distributed blockchain ledger as shown in Figure 8. Users and merchants have their own accounts, and users and merchants can write their accounts and the amounts in their accounts on the blockchain ledger.

图9为本申请实施例中用户、商家与区块链的示意图。可见,用户1、用户2、商家1、商家2、商家3、商家4均连上了区块链,他们可以将账户转账请求向区块链同步。例如,用户1与商家1进行转账,账户转账请求的内容为用户1向商家1转账10元伙食费,则用户1和商家1通过客户端向区块链上传该账户转账请求,区块链通过共识机制达成共识后,将该账户转账请求写入区块链账本上,即将用户1向商家1转账10元伙食费写在区块链账本上,则可以得到用户1的账户减少了10元,商家1的账户中增加了10元的结果。Figure 9 is a schematic diagram of users, merchants and blockchain in the embodiment of the present application. It can be seen that user 1, user 2, merchant 1, merchant 2, merchant 3, and merchant 4 are all connected to the blockchain, and they can synchronize the account transfer request to the blockchain. For example, user 1 transfers money with merchant 1, and the content of the account transfer request is that user 1 transfers 10 yuan of food expenses to merchant 1. Then user 1 and merchant 1 upload the account transfer request to the blockchain through the client. After the blockchain reaches a consensus through the consensus mechanism, the account transfer request is written to the blockchain account book, that is, the transfer of 10 yuan of food expenses from user 1 to merchant 1 is written on the blockchain account book, and the result can be obtained that user 1's account is reduced by 10 yuan, and merchant 1's account is increased by 10 yuan.

终端设备通过区块链同步账户转账请求后,区块链账本上增加了该账户转账请求对应的账户转账记录,如图10所示。图10为本申请实施例区块链账本的示意图,区块链账本中包括若干个账户标识对应的记录,图10仅示出了其中一部分参数,从图10可以看出,用户向账户标识1进行存款,存款金额为100,对应的消费类型为伙食费,表示该100元存款用于伙食费,账户标识1向商家标识1在伙食费的消费类型上转账了100元,账户标识1向商家标识2在交通出行的消费类型上转账了5元,则终端设备可以从区块链账本中读取到类似前述的区块链账本记录,然后根据这些区块链账本记录统计到账户标识1向外转账的消费记录。图11为本申请实施例中账户标识1的消费记录示意图,可见,终端设备根据区块链账本,得到账户标识1在伙食费的消费类型上消费了100元,账户标识1在交通出行的消费类型上消费了5元,同理,终端设备也可以根据区块链账本统计到账户的其他情况,具体此处不再赘述。可选地,在本申请实施例图2对应的一种消费处理的方法的一个可选实施例中,获取账户转账请求之前,方法还包括:获取存款请求,存款请求包括账户标识,消费类型以及存款金额;根据账户标识,消费类型以及存款金额,确定智能合约;向区块链同步存款请求以及智能合约。After the terminal device synchronizes the account transfer request through the blockchain, the account transfer record corresponding to the account transfer request is added to the blockchain account book, as shown in Figure 10. Figure 10 is a schematic diagram of the blockchain account book of the embodiment of the present application. The blockchain account book includes records corresponding to several account identifiers. Figure 10 only shows some of the parameters. It can be seen from Figure 10 that the user deposits 100 yuan to account identifier 1, and the deposit amount is 100. The corresponding consumption type is food expenses, indicating that the 100 yuan deposit is used for food expenses. Account identifier 1 transfers 100 yuan to merchant identifier 1 in the consumption type of food expenses, and account identifier 1 transfers 5 yuan to merchant identifier 2 in the consumption type of transportation. The terminal device can read similar blockchain account book records from the blockchain account book, and then count the consumption records of account identifier 1 transferring outward according to these blockchain account book records. Figure 11 is a schematic diagram of the consumption record of account ID 1 in the embodiment of the present application. It can be seen that the terminal device obtains from the blockchain account book that account ID 1 has spent 100 yuan on the consumption type of food expenses, and account ID 1 has spent 5 yuan on the consumption type of transportation. Similarly, the terminal device can also count other situations of the account according to the blockchain account book, which will not be described in detail here. Optionally, in an optional embodiment of a consumption processing method corresponding to Figure 2 of the embodiment of the present application, before obtaining an account transfer request, the method also includes: obtaining a deposit request, the deposit request includes an account ID, a consumption type and a deposit amount; determining a smart contract based on the account ID, the consumption type and the deposit amount; synchronizing the deposit request and the smart contract to the blockchain.

在本申请实施例中,终端设备首先往账户中存款,再进行消费。存款的方式可以是用户输入存款请求,如图12所示,图12为本申请实施例中用户存款的界面示意图,用户在终端设备的界面上填写账户标识、存款金额,还可以填写消费类型,用来限定该存款金额的用途,例如,填写的消费类型为伙食费,存款金额为100元,则可以限定该次存款中存款的100元指定用于伙食费。然后,用户选定支付用的银行卡以及输入银行密码,点击“确定”虚拟按钮即可生成存款请求。终端设备获取到存款请求后,可以根据存款请求中的账户标识,消费类型以及存款金额确定智能合约,其中,存款金额与消费限额具有关联关系,例如,存款请求中账户标识1的存款金额为100元,并指定消费类型为伙食费,则智能合约中添加账户标识1的伙食费的消费限额增加100元。In the embodiment of the present application, the terminal device first deposits money into the account and then consumes. The deposit method can be that the user enters a deposit request, as shown in Figure 12, which is a schematic diagram of the interface of the user deposit in the embodiment of the present application. The user fills in the account identification and deposit amount on the interface of the terminal device, and can also fill in the consumption type to limit the purpose of the deposit amount. For example, if the consumption type filled in is food expenses and the deposit amount is 100 yuan, then the 100 yuan deposited in this deposit can be specified for food expenses. Then, the user selects the bank card for payment and enters the bank password, and clicks the "OK" virtual button to generate a deposit request. After the terminal device obtains the deposit request, it can determine the smart contract according to the account identification, consumption type and deposit amount in the deposit request, where the deposit amount and the consumption limit are associated. For example, the deposit amount of account identification 1 in the deposit request is 100 yuan, and the consumption type is specified as food expenses, then the consumption limit of food expenses for account identification 1 added in the smart contract is increased by 100 yuan.

在一种可能的实施例中,用户可以不用银行卡进行存款,而用第三方支付软件进行存款,存款方式类似,具体此处不再赘述。In a possible embodiment, the user may use a third-party payment software to make a deposit instead of a bank card. The deposit method is similar and will not be described in detail here.

在一种可能的实施例中,用户可以用A账户往B账户存款,例如,父母用其自己的账户向子女的账户进行存款,以限定子女账户的消费类型和消费限额。图13为本申请实施例中父母向子女账户存款的示意图,可见,父母先在账户标识中填入子女的账户标识,然后填入消费类型和存款金额,最后选定自己的账户用于支付,并输入支付密码,点击“确定”虚拟按钮,则终端设备可以获取到对应的存款请求。终端设备获取到存款请求后,可以根据存款请求中的账户标识,消费类型以及存款金额确定智能合约。In a possible embodiment, a user can use account A to deposit money into account B. For example, parents use their own accounts to deposit money into their children's accounts to limit the consumption type and consumption limit of their children's accounts. Figure 13 is a schematic diagram of parents depositing money into their children's accounts in an embodiment of the present application. It can be seen that the parents first fill in the account ID of the child in the account ID, then fill in the consumption type and deposit amount, and finally select their own account for payment, enter the payment password, and click the "OK" virtual button, then the terminal device can obtain the corresponding deposit request. After the terminal device obtains the deposit request, it can determine the smart contract based on the account ID, consumption type and deposit amount in the deposit request.

终端设备得到存款请求和智能合约后,向区块链同步存款请求以及智能合约,同步方式与本申请其他实施例中同步账户转账请求类似,此处不再赘述。After the terminal device receives the deposit request and the smart contract, it synchronizes the deposit request and the smart contract to the blockchain. The synchronization method is similar to the synchronization of account transfer requests in other embodiments of the present application, and will not be repeated here.

可选地,在本申请实施例图2对应的一种消费处理的方法的一个可选实施例中,向区块链同步存款请求以及智能合约包括:向区块链同步存款请求;向区块链同步智能合约;其中,向区块链同步智能合约包括:通过私钥加密智能合约,得到加密后的智能合约;向区块链同步加密后的智能合约。Optionally, in an optional embodiment of a consumption processing method corresponding to Figure 2 of the embodiment of the present application, synchronizing a deposit request and a smart contract to the blockchain includes: synchronizing a deposit request to the blockchain; synchronizing the smart contract to the blockchain; wherein synchronizing the smart contract to the blockchain includes: encrypting the smart contract by a private key to obtain an encrypted smart contract; and synchronizing the encrypted smart contract to the blockchain.

在本申请实施例中,终端设备先用私钥对智能合约加密,再将加密后的智能合约向区块链同步。可以理解的是,经过加密后的智能合约更加安全,不容易被盗取。当终端设备需要使用区块链中的智能合约时,可以通过私钥或公钥进行解密,具体此处不做限定。In the embodiment of the present application, the terminal device first encrypts the smart contract with a private key, and then synchronizes the encrypted smart contract to the blockchain. It is understandable that the encrypted smart contract is more secure and not easy to be stolen. When the terminal device needs to use the smart contract in the blockchain, it can be decrypted by a private key or a public key, which is not limited here.

可选地,在本申请实施例图2对应的一种消费处理的方法的一个可选实施例中,根据账户转账请求中的账户标识以及消费类型,通过智能合约确定消费限额之后,方法还包括:Optionally, in an optional embodiment of a consumption processing method corresponding to FIG. 2 of the embodiment of the present application, after determining the consumption limit through a smart contract according to the account identifier and the consumption type in the account transfer request, the method further includes:

若消费金额大于消费限额,则生成提示消息,提示消息用于提示转账失败。If the consumption amount is greater than the consumption limit, a prompt message is generated to indicate that the transfer has failed.

在本申请实施例中,用户消费时,若超出限额,则不能转账,并且终端设备会提示转账失败。图14为本申请实施例中终端设备提示转账失败的示意图。可见,用户向终端设备输入账户转账信息,终端设备获取账户转账请求后,通过智能合约确定对应的消费限额,当终端设备检测到消费金额大于该消费限额时,则生成提示消息,使得终端设备在界面上显示“转账失败”,例如,用户准备向餐厅转账200元的金额,对应的消费类型为伙食费,而智能合约中,该账户在伙食费下的消费限额只有100元,则消费金额大于消费限额,使得终端设备无法完成转账,提示转账失败。用户可以点击终端设备界面上的“确定”虚拟按钮关闭该提示消息。In the embodiment of the present application, when the user consumes, if the limit is exceeded, the transfer cannot be made, and the terminal device will prompt that the transfer failed. Figure 14 is a schematic diagram of the terminal device prompting the transfer failed in the embodiment of the present application. It can be seen that the user inputs the account transfer information to the terminal device. After the terminal device obtains the account transfer request, the corresponding consumption limit is determined through the smart contract. When the terminal device detects that the consumption amount is greater than the consumption limit, a prompt message is generated, so that the terminal device displays "transfer failed" on the interface. For example, the user is preparing to transfer 200 yuan to the restaurant, and the corresponding consumption type is food expenses. In the smart contract, the consumption limit of the account under the food expenses is only 100 yuan. The consumption amount is greater than the consumption limit, so that the terminal device cannot complete the transfer and prompts that the transfer failed. The user can click the "OK" virtual button on the terminal device interface to close the prompt message.

可选地,在本申请实施例图2对应的一种消费处理的方法的一个可选实施例中,向区块链同步账户转账请求之后,方法还包括:Optionally, in an optional embodiment of a consumption processing method corresponding to FIG. 2 of the embodiment of the present application, after requesting a transfer to the blockchain synchronization account, the method further includes:

根据消费限额与消费金额确定更新后的消费限额。The updated consumption limit is determined based on the consumption limit and the consumption amount.

在本申请实施例中,用户进行转账消费之后,终端设备可以根据该转账消费更新智能合约中的消费限额。具体可以是,将消费限额减去消费金额得到更新后的消费限额。如图7和图15所示,图15为本申请实施例更新后的智能合约示意图,可见,原本账户在消费类型1的消费限额为X。当用户在消费类型1中消费了Y元后,终端设备根据消费限额与消费金额确定更新后的消费类型1的消费限额为X-Y。当用户不断在该消费类型上消费时,消费限额不断减少,直到消费限额用完或者用户再进行存款。例如,用户每隔一个月为自己账户存款,用于伙食费,则用户每天吃饭时,智能合约中的消费限额每天根据用户吃饭消费的金额减少。In an embodiment of the present application, after the user transfers money for consumption, the terminal device can update the consumption limit in the smart contract according to the transfer consumption. Specifically, the consumption limit can be subtracted from the consumption amount to obtain the updated consumption limit. As shown in Figures 7 and 15, Figure 15 is a schematic diagram of the updated smart contract in the embodiment of the present application. It can be seen that the original consumption limit of the account in consumption type 1 is X. After the user consumes Y yuan in consumption type 1, the terminal device determines that the updated consumption limit of consumption type 1 is X-Y based on the consumption limit and the consumption amount. When the user continues to consume on this consumption type, the consumption limit continues to decrease until the consumption limit is used up or the user makes another deposit. For example, if a user deposits money into his account every other month for food expenses, when the user eats every day, the consumption limit in the smart contract decreases every day according to the amount of the user's meal consumption.

同理,用户为自己存款时,对应的消费类型中若还有消费限额,则终端设备在该消费限额的基础上加上存款时规定的金额。例如,原本账户在消费类型1的消费限额为X。用户往账户中存款Y元,并且指定该金额对应的消费类型为消费类型1,则终端设备根据消费限额与消费金额确定更新后的消费类型1的消费限额为X+Y。Similarly, when a user deposits money for himself, if there is a consumption limit in the corresponding consumption type, the terminal device adds the amount specified when the deposit is made to the consumption limit. For example, the original consumption limit of the account in consumption type 1 is X. The user deposits Y yuan into the account and specifies that the consumption type corresponding to the amount is consumption type 1. The terminal device determines the updated consumption limit of consumption type 1 as X+Y based on the consumption limit and the consumption amount.

可选地,在本申请实施例图2对应的一种消费处理的方法的一个可选实施例中,方法还包括:Optionally, in an optional embodiment of a consumption processing method corresponding to FIG. 2 of the embodiment of the present application, the method further includes:

根据智能合约中的消费限额生成提醒消息,提醒消息用于展示消费限额。A reminder message is generated based on the consumption limit in the smart contract, and the reminder message is used to display the consumption limit.

在本申请实施例中,若用户需要查看自己计划用于某消费类型的消费限额,可以让终端设备显示消费类型以及消费限额。图16为本申请实施例中终端设备显示消费计划的界面图。可见,终端设备可以显示用户的账户标识以及消费类型,并且显示消费类型对应的消费限额,用户可以直观看到自己的消费计划,例如,用户计划每月使用1000元伙食费,则可以通过如图16的界面查看。In the embodiment of the present application, if the user needs to view the consumption limit that he plans to use for a certain consumption type, the terminal device can display the consumption type and the consumption limit. Figure 16 is an interface diagram of the terminal device displaying the consumption plan in the embodiment of the present application. It can be seen that the terminal device can display the user's account identification and consumption type, and display the consumption limit corresponding to the consumption type. The user can intuitively see his consumption plan. For example, if the user plans to use 1,000 yuan of food expenses per month, he can view it through the interface as shown in Figure 16.

可选地,在本申请实施例图2对应的一种消费处理的方法的一个可选实施例中,根据账户转账请求中的账户标识以及消费类型,通过智能合约确定消费限额包括:Optionally, in an optional embodiment of a consumption processing method corresponding to FIG. 2 of the embodiment of the present application, determining the consumption limit through a smart contract according to the account identifier and the consumption type in the account transfer request includes:

根据账户转账请求中的账户标识获取历史消费记录,历史消费记录与账户标识具有关联关系;Obtain historical consumption records according to the account identifier in the account transfer request, where the historical consumption records are associated with the account identifier;

根据账户转账请求中的账户标识、消费类型以及历史消费记录,通过智能合约确定消费限额。The consumption limit is determined through a smart contract based on the account ID, consumption type, and historical consumption records in the account transfer request.

在本申请实施例中,终端设备在确定智能合约的过程中,可以首先获取与账户标识对应的历史消费记录,则可以根据账户转账请求中的账户标识、消费类型以及终端设备获取的历史消费记录,通过智能合约确定消费限额。例如,账户标识1中所有历史消费记录为用户向账户标识1进行存款,存款金额为100,对应的消费类型为伙食费,表示该100元存款用于伙食费,账户标识1向商家标识1在伙食费的消费类型上转账了20元,账户标识1向商家标识2在伙食费的消费类型上转账了30元,则终端设备根据这些历史消费记录,可以确定该账户标识1在伙食费这个消费类型中,首先存款了100元,然后消费了20元,又消费了30元,则可以确定账户标识1在在伙食费这个消费类型中的消费限额还剩下100-20-30=50元。In the embodiment of the present application, the terminal device can first obtain the historical consumption record corresponding to the account identifier in the process of determining the smart contract, and then determine the consumption limit through the smart contract according to the account identifier in the account transfer request, the consumption type and the historical consumption record obtained by the terminal device. For example, all historical consumption records in account identifier 1 are that the user deposits 100 yuan to account identifier 1, and the corresponding consumption type is food expenses, indicating that the 100 yuan deposit is used for food expenses, account identifier 1 transfers 20 yuan to merchant identifier 1 in the consumption type of food expenses, and account identifier 1 transfers 30 yuan to merchant identifier 2 in the consumption type of food expenses. Then, based on these historical consumption records, the terminal device can determine that the account identifier 1 first deposited 100 yuan in the consumption type of food expenses, then consumed 20 yuan, and then consumed 30 yuan. It can be determined that the consumption limit of account identifier 1 in the consumption type of food expenses is 100-20-30=50 yuan.

基于如图1所示的架构,本申请实施例还提供一种消费处理的方法,如图17所示,图17为本申请实施例提供的一种消费处理的方法的流程图,该方法适合实施在用户网上购物的场景,该方法包括:Based on the architecture shown in FIG1 , the embodiment of the present application further provides a consumption processing method, as shown in FIG17 . FIG17 is a flow chart of a consumption processing method provided by the embodiment of the present application. The method is suitable for implementation in a scenario where a user shops online. The method includes:

1701、获取账户转账请求,账户转账请求包括账户标识、消费类型以及与消费类型对应的消费金额;1701. Obtain an account transfer request, where the account transfer request includes an account identifier, a consumption type, and a consumption amount corresponding to the consumption type;

在本申请实施例中,用户进行网上购物时,若准备购买购物车中的商品,则可以进入对应的支付界面,如图18所示,图18为本申请实施例中终端设备支付界面的示意图。可见,终端设备上显示有商品1的消费类型以及对应的消费金额,消费金额即该商品1的价格/打折后的价格,用于表示该次消费中用多少钱购买该商品1,若购物车中还有其他商品,例如商品2、商品3,均一一在支付界面上显示出来。用户选择支付账户以及输入支付密码后,可以点击“确定”虚拟按钮,使得终端设备获取到账户转账请求。在一种可能的实施例中,用户可以不将商品放入购物车,而是直接购买,进入支付界面,则支付界面仅显示商品1的消费类型以及消费金额。In the embodiment of the present application, when the user is shopping online, if he is ready to buy the goods in the shopping cart, he can enter the corresponding payment interface, as shown in Figure 18, which is a schematic diagram of the payment interface of the terminal device in the embodiment of the present application. It can be seen that the consumption type of commodity 1 and the corresponding consumption amount are displayed on the terminal device. The consumption amount is the price of commodity 1/the discounted price, which is used to indicate how much money is used to purchase commodity 1 in this consumption. If there are other commodities in the shopping cart, such as commodity 2 and commodity 3, they are all displayed one by one on the payment interface. After the user selects the payment account and enters the payment password, he can click the "OK" virtual button so that the terminal device obtains the account transfer request. In a possible embodiment, the user can directly purchase the commodity instead of putting it in the shopping cart and enter the payment interface. The payment interface only displays the consumption type and consumption amount of commodity 1.

在一种可能的实施例中,用户不需要手动输入商品的消费类型,而是终端设备自动根据商品的商品标识找到该商品对应的消费类型,具体是根据商品的消费类型与商品标识的关联关系找到该商品对应的消费类型,表2为本申请实施例中商品标识与消费类型的关联关系表格,如表2所示,蛋糕对应的消费类型为伙食费,牙刷对应的消费类型为日常用品消费,在实际应用中,还可以设定若干个关联关系,这些关联关系可以预先设定,并存储在终端设备或电商平台的服务器中。In a possible embodiment, the user does not need to manually input the consumption type of the product. Instead, the terminal device automatically finds the consumption type corresponding to the product based on the product identification of the product. Specifically, the consumption type corresponding to the product is found based on the association between the consumption type of the product and the product identification. Table 2 is a table of associations between product identifications and consumption types in the embodiment of the present application. As shown in Table 2, the consumption type corresponding to the cake is meal expenses, and the consumption type corresponding to the toothbrush is daily necessities consumption. In actual applications, several associations can also be set. These associations can be pre-set and stored in the terminal device or the server of the e-commerce platform.

表2Table 2

商品标识Product identification 消费类型Consumption Type 蛋糕cake 伙食费Meal expenses 牙刷toothbrush 日常用品消费Daily necessities consumption

在本申请实施例中,进行网上购物的终端设备可以是手机或电脑,在实际应用中,还可以是平板等设备,具体此处不做限定。In the embodiments of the present application, the terminal device for online shopping may be a mobile phone or a computer. In actual applications, it may also be a tablet or other device, which is not specifically limited here.

1702、根据账户转账请求中的账户标识以及消费类型,通过智能合约确定消费限额,消费限额与账户标识具有关联关系,且消费限额与消费类型具有关联关系;1702. According to the account identifier and the consumption type in the account transfer request, the consumption limit is determined through the smart contract, and the consumption limit is associated with the account identifier, and the consumption limit is associated with the consumption type;

在本申请实施例中,步骤1702与前述图2对应的各个实施例中步骤202类似,此处不再赘述。In the embodiment of the present application, step 1702 is similar to step 202 in each embodiment corresponding to FIG. 2 above, and will not be repeated here.

1703、若消费金额小于或等于消费限额,则通过区块链同步账户转账请求。1703. If the consumption amount is less than or equal to the consumption limit, the account transfer request is synchronized through the blockchain.

在本申请实施例中,该账户转账请求包括多个商品的转账,其中,多个商品的消费类型可能相同,例如,商品1的消费类型和商品2的消费类型相同,则终端设备将商品1的消费金额与商品2的消费金额相加作为该消费类型的消费金额。例如,用户购买了蛋糕和雪糕,这两个商品都属于伙食费这一消费类型,则终端设备可以根据商品将消费类型对应的消费金额确定为蛋糕的消费金额加雪糕的消费金额。然后,终端设备将统计后的消费类型对应的消费金额与消费限额比较,若消费金额小于或等于消费限额,则终端设备通过区块链同步账户转账请求。In an embodiment of the present application, the account transfer request includes the transfer of multiple commodities, wherein the consumption types of the multiple commodities may be the same. For example, the consumption type of commodity 1 is the same as the consumption type of commodity 2, and the terminal device adds the consumption amount of commodity 1 to the consumption amount of commodity 2 as the consumption amount of the consumption type. For example, if a user buys cake and ice cream, both of which belong to the consumption type of food expenses, the terminal device can determine the consumption amount corresponding to the consumption type as the consumption amount of cake plus the consumption amount of ice cream according to the commodity. Then, the terminal device compares the consumption amount corresponding to the consumption type after statistics with the consumption limit. If the consumption amount is less than or equal to the consumption limit, the terminal device synchronizes the account transfer request through the blockchain.

终端设备通过区块链同步账户转账请求的详细情况与前述图2对应的各个实施例中步骤203类似,此处不再赘述。The details of the terminal device synchronizing the account transfer request through the blockchain are similar to step 203 in each embodiment corresponding to Figure 2 above, and will not be repeated here.

可选地,在本申请实施例图17对应的一种消费处理的方法的一个可选实施例中,获取账户转账请求之前,方法还包括:获取存款请求,存款请求包括账户标识,消费类型以及存款金额;根据账户标识,消费类型以及存款金额,确定智能合约;向区块链同步存款请求以及智能合约。Optionally, in an optional embodiment of a consumption processing method corresponding to Figure 17 of the embodiment of the present application, before obtaining an account transfer request, the method also includes: obtaining a deposit request, the deposit request including an account identifier, a consumption type and a deposit amount; determining a smart contract based on the account identifier, the consumption type and the deposit amount; and synchronizing the deposit request and the smart contract to the blockchain.

可选地,在本申请实施例图17对应的一种消费处理的方法的一个可选实施例中,向区块链同步存款请求以及智能合约包括:向区块链同步存款请求;向区块链同步智能合约;其中,向区块链同步智能合约包括:通过私钥加密智能合约,得到加密后的智能合约;向区块链同步加密后的智能合约。Optionally, in an optional embodiment of a consumption processing method corresponding to Figure 17 of the embodiment of the present application, synchronizing a deposit request and a smart contract to the blockchain includes: synchronizing a deposit request to the blockchain; synchronizing the smart contract to the blockchain; wherein synchronizing the smart contract to the blockchain includes: encrypting the smart contract by a private key to obtain an encrypted smart contract; synchronizing the encrypted smart contract to the blockchain.

在本申请实施例中,终端设备进行存款以及私钥加密的步骤与前述图2对应的各个实施例类似,此处不再赘述。In the embodiment of the present application, the steps of the terminal device for depositing and encrypting the private key are similar to the various embodiments corresponding to the aforementioned FIG. 2 , and will not be repeated here.

可选地,在本申请实施例图17对应的一种消费处理的方法的一个可选实施例中,根据账户转账请求中的账户标识以及消费类型,通过智能合约确定消费限额之后,方法还包括:Optionally, in an optional embodiment of a consumption processing method corresponding to FIG. 17 of the embodiment of the present application, after determining the consumption limit through a smart contract according to the account identifier and the consumption type in the account transfer request, the method further includes:

若消费金额大于消费限额,则生成提示消息,提示消息用于提示转账失败。If the consumption amount is greater than the consumption limit, a prompt message is generated to indicate that the transfer has failed.

在本申请实施例中,终端设备提示转账失败的情况与前述图2对应的各个实施例类似,此处不再赘述。In the embodiment of the present application, the situation where the terminal device prompts that the transfer failed is similar to the various embodiments corresponding to the aforementioned Figure 2, and will not be repeated here.

可选地,在本申请实施例图17对应的一种消费处理的方法的一个可选实施例中,向区块链同步账户转账请求之后,方法还包括:Optionally, in an optional embodiment of a consumption processing method corresponding to FIG. 17 of the embodiment of the present application, after requesting a transfer to the blockchain synchronization account, the method further includes:

根据消费限额与消费金额确定更新后的消费限额。The updated consumption limit is determined based on the consumption limit and the consumption amount.

在本申请实施例中,终端设备更新消费限额的情况与前述图2对应的各个实施例类似,此处不再赘述。In the embodiment of the present application, the situation in which the terminal device updates the consumption limit is similar to the various embodiments corresponding to the aforementioned FIG. 2 , and will not be repeated here.

可选地,在本申请实施例图17对应的一种消费处理的方法的一个可选实施例中,方法还包括:Optionally, in an optional embodiment of a consumption processing method corresponding to FIG. 17 of the embodiment of the present application, the method further includes:

根据智能合约中的消费限额生成提醒消息,提醒消息用于展示消费限额。A reminder message is generated based on the consumption limit in the smart contract, and the reminder message is used to display the consumption limit.

在本申请实施例中,终端设备展示消费限额的情况与前述图2对应的各个实施例类似,此处不再赘述。In the embodiment of the present application, the situation in which the terminal device displays the consumption limit is similar to the various embodiments corresponding to the aforementioned FIG. 2 , and will not be repeated here.

可选地,在本申请实施例图2对应的一种消费处理的方法的一个可选实施例中,根据账户转账请求中的账户标识以及消费类型,通过智能合约确定消费限额包括:Optionally, in an optional embodiment of a consumption processing method corresponding to FIG. 2 of the embodiment of the present application, determining the consumption limit through a smart contract according to the account identifier and the consumption type in the account transfer request includes:

根据账户转账请求中的账户标识获取历史消费记录,历史消费记录与账户标识具有关联关系;Obtain historical consumption records according to the account identifier in the account transfer request, where the historical consumption records are associated with the account identifier;

根据账户转账请求中的账户标识、消费类型以及历史消费记录,通过智能合约确定消费限额。The consumption limit is determined through a smart contract based on the account ID, consumption type, and historical consumption records in the account transfer request.

在本申请实施例中,终端设备确定消费限额的情况与前述图2对应的各个实施例类似,此处不再赘述。In the embodiment of the present application, the situation in which the terminal device determines the consumption limit is similar to the various embodiments corresponding to the aforementioned FIG. 2 , and will not be repeated here.

在一种可能的实施例中,用户通过终端设备连接服务器,终端设备生成账户转账请求后将账户转账请求发送至服务器,服务器接收到账户转账请求后执行如图2或图17对应的各个实施例的方法。用户的终端设备仅需生成并发送账户转账请求,减轻了用户的终端设备负担,且服务器可以管理各个终端设备的账户转账情况。In a possible embodiment, the user connects to the server through a terminal device, and the terminal device generates an account transfer request and sends the account transfer request to the server. After receiving the account transfer request, the server executes the method of each embodiment corresponding to FIG2 or FIG17. The user's terminal device only needs to generate and send an account transfer request, which reduces the burden on the user's terminal device, and the server can manage the account transfer status of each terminal device.

图19为一种消费处理的方法的应用例示意图,可见,该应用例中,终端设备预先签订智能合约,智能合约与图7对应的描述类似,此处不再赘述。终端设备签订智能合约后,将智能合约同步至区块链。FIG19 is a schematic diagram of an application example of a consumption processing method. It can be seen that in this application example, the terminal device signs a smart contract in advance. The smart contract is similar to the description corresponding to FIG7 and will not be repeated here. After the terminal device signs the smart contract, the smart contract is synchronized to the blockchain.

用户需要消费,产生用户消费行为,终端设备生成账户转账请求,并从网络中获取该账户的智能合约以及历史消费情况,然后终端设备根据智能合约以及历史消费情况确定消费限额,进一步确定当前支付行为是否满足智能合约,即账户转账请求是否满足智能合约,若是,则支付成功并将数据同步至区块链,若否,则支付失败,终端设备可以在界面上提示支付失败的信息,如图14所示。The user needs to consume and generates user consumption behavior. The terminal device generates an account transfer request and obtains the smart contract and historical consumption of the account from the network. Then the terminal device determines the consumption limit based on the smart contract and historical consumption, and further determines whether the current payment behavior satisfies the smart contract, that is, whether the account transfer request satisfies the smart contract. If so, the payment is successful and the data is synchronized to the blockchain. If not, the payment fails. The terminal device can prompt the payment failure information on the interface, as shown in Figure 14.

图20为本申请实施例提供的一种消费处理的装置的示意图,可见,本申请实施例提供的一种消费处理的装置2000包括:FIG. 20 is a schematic diagram of a consumption processing device provided in an embodiment of the present application. It can be seen that a consumption processing device 2000 provided in an embodiment of the present application includes:

获取单元2001,用于获取账户转账请求,账户转账请求包括账户标识,账户转账请求还包括消费类型、消费类型对应的消费金额以及位置信息中的至少一种;An acquisition unit 2001 is used to acquire an account transfer request, where the account transfer request includes an account identifier, and the account transfer request also includes at least one of a consumption type, a consumption amount corresponding to the consumption type, and location information;

处理单元2002,用于根据账户转账请求,通过智能合约确定消费权限,消费权限与账户标识具有对应关系;The processing unit 2002 is used to determine the consumption authority through the smart contract according to the account transfer request, and the consumption authority has a corresponding relationship with the account identifier;

处理单元2002还用于若账户转账请求满足消费权限,则通过区块链同步账户转账请求。The processing unit 2002 is also used to synchronize the account transfer request through the blockchain if the account transfer request meets the consumption authority.

可选地,在本申请实施例图20对应的一种消费处理的装置的一个可选实施例中,还包括存款单元2003,如图21所示,图21为本申请实施例提供的一种消费处理的装置的另一个示意图,存款单元2003用于:Optionally, in an optional embodiment of a consumption processing device corresponding to FIG. 20 of the embodiment of the present application, a deposit unit 2003 is further included, as shown in FIG. 21 , which is another schematic diagram of a consumption processing device provided by the embodiment of the present application, and the deposit unit 2003 is used to:

获取存款请求,存款请求包括账户标识,消费类型以及存款金额;Get a deposit request, which includes account ID, consumption type, and deposit amount;

根据账户标识,消费类型以及存款金额,确定智能合约;Determine the smart contract based on the account ID, consumption type and deposit amount;

向区块链同步存款请求以及智能合约。Sync the deposit request and smart contract to the blockchain.

可选地,在本申请实施例图21对应的一种消费处理的装置的一个可选实施例中,存款单元2003还用于:Optionally, in an optional embodiment of a consumption processing device corresponding to FIG. 21 of the embodiment of the present application, the deposit unit 2003 is further used for:

向区块链同步存款请求;Synchronize deposit request to blockchain;

向区块链同步智能合约;Synchronize smart contracts to the blockchain;

其中,向区块链同步智能合约包括:Among them, synchronizing smart contracts to the blockchain includes:

通过私钥加密智能合约,得到加密后的智能合约;Encrypt the smart contract with the private key to obtain the encrypted smart contract;

向区块链同步加密后的智能合约。Synchronize the encrypted smart contract to the blockchain.

可选地,在本申请实施例图20对应的一种消费处理的装置的一个可选实施例中,处理单元2002还用于:Optionally, in an optional embodiment of a consumption processing device corresponding to FIG. 20 of the embodiment of the present application, the processing unit 2002 is further used for:

若消费金额大于消费限额,则生成提示消息,提示消息用于提示转账失败。If the consumption amount is greater than the consumption limit, a prompt message is generated to indicate that the transfer has failed.

可选地,在本申请实施例图20对应的一种消费处理的装置的一个可选实施例中,处理单元2002还用于:Optionally, in an optional embodiment of a consumption processing device corresponding to FIG. 20 of the embodiment of the present application, the processing unit 2002 is further used for:

根据消费限额与消费金额确定更新后的消费限额。The updated consumption limit is determined based on the consumption limit and the consumption amount.

可选地,在本申请实施例图20对应的一种消费处理的装置的一个可选实施例中,处理单元2002还用于:Optionally, in an optional embodiment of a consumption processing device corresponding to FIG. 20 of the embodiment of the present application, the processing unit 2002 is further used for:

根据智能合约中的消费限额生成提醒消息,提醒消息用于展示消费限额。A reminder message is generated based on the consumption limit in the smart contract, and the reminder message is used to display the consumption limit.

可选地,在本申请实施例图20对应的一种消费处理的装置的一个可选实施例中,处理单元2002还用于:Optionally, in an optional embodiment of a consumption processing device corresponding to FIG. 20 of the embodiment of the present application, the processing unit 2002 is further used for:

根据账户转账请求中的账户标识获取历史消费记录,历史消费记录与账户标识具有关联关系;Obtain historical consumption records according to the account identifier in the account transfer request, where the historical consumption records are associated with the account identifier;

根据账户转账请求中的账户标识、消费类型以及历史消费记录,通过智能合约确定消费限额。The consumption limit is determined through a smart contract based on the account ID, consumption type, and historical consumption records in the account transfer request.

本申请实施例还提供一种节点设备,该节点设备可以是终端设备或服务器,下面将对该节点设备为终端设备的情况进行详细的描述:The embodiment of the present application further provides a node device, which may be a terminal device or a server. The case where the node device is a terminal device is described in detail below:

本申请实施例还提供了另一种消费处理的装置,如图22所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该终端可以为包括手机、平板电脑、个人数字助理(personal digital assistant,PDA)、销售终端(point of sales,POS)、车载电脑等任意终端设备,以终端为手机为例:The embodiment of the present application also provides another consumption processing device, as shown in FIG22. For the sake of convenience, only the part related to the embodiment of the present application is shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The terminal can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (PDA), a point of sales (POS), a car computer, etc., taking the mobile phone as an example:

图22示出的是与本申请实施例提供的终端相关的手机的部分结构的框图。参考图22,手机包括:射频(radio frequency,RF)电路2210、存储器2220、输入单元2230、显示单元2240、传感器2250、音频电路2260、无线保真(wireless fidelity,WiFi)模块2270、处理器2280、以及电源2290等部件。本领域技术人员可以理解,图22中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG22 is a block diagram showing a partial structure of a mobile phone related to a terminal provided in an embodiment of the present application. Referring to FIG22 , the mobile phone includes: a radio frequency (RF) circuit 2210, a memory 2220, an input unit 2230, a display unit 2240, a sensor 2250, an audio circuit 2260, a wireless fidelity (WiFi) module 2270, a processor 2280, and a power supply 2290 and other components. It can be understood by those skilled in the art that the mobile phone structure shown in FIG22 does not constitute a limitation on the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

下面结合图22对手机的各个构成部件进行具体的介绍:The following is a detailed introduction to the various components of the mobile phone in conjunction with Figure 22:

RF电路2210可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器2280处理;另外,将设计上行的数据发送给基站。通常,RF电路2210包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(low noiseamplifier,LNA)、双工器等。此外,RF电路2210还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(globalsystem of mobile communication,GSM)、通用分组无线服务(general packet radioservice,GPRS)、码分多址(code division multiple access,CDMA)、宽带码分多址(wideband code division multiple access,WCDMA)、长期演进(long term evolution,LTE)、电子邮件、短消息服务(short messaging service,SMS)等。The RF circuit 2210 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is sent to the processor 2280 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 2210 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 2210 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to the global system of mobile communication (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), email, short messaging service (SMS), etc.

存储器2220可用于存储软件程序以及模块,处理器2280通过运行存储在存储器2220的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器2220可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器2220可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 2220 can be used to store software programs and modules. The processor 2280 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 2220. The memory 2220 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 2220 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

输入单元2230可用于接收输入的数字或字符信息,以及产生与手机的用户设置以及功能控制有关的键信号输入。具体地,输入单元2230可包括触控面板2231以及其他输入设备2232。触控面板2231,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板2231上或在触控面板2231附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板2231可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器2280,并能接收处理器2280发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板2231。除了触控面板2231,输入单元2230还可以包括其他输入设备2232。具体地,其他输入设备2232可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 2230 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the input unit 2230 may include a touch panel 2231 and other input devices 2232. The touch panel 2231, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 2231 or near the touch panel 2231 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 2231 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 2280, and can receive and execute commands sent by the processor 2280. In addition, the touch panel 2231 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 2231, the input unit 2230 may also include other input devices 2232. Specifically, the other input devices 2232 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.

显示单元2240可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元2240可包括显示面板2241,可选的,可以采用液晶显示器(liquidcrystal display,LCD)、有机发光二极管(organic light-emitting diode,OLED)等形式来配置显示面板2241。进一步的,触控面板2231可覆盖显示面板2241,当触控面板2231检测到在其上或附近的触摸操作后,传送给处理器2280以确定触摸事件的类型,随后处理器2280根据触摸事件的类型在显示面板2241上提供相应的视觉输出。虽然在图22中,触控面板2231与显示面板2241是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板2231与显示面板2241集成而实现手机的输入和输出功能。The display unit 2240 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 2240 may include a display panel 2241, and optionally, the display panel 2241 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 2231 may cover the display panel 2241, and when the touch panel 2231 detects a touch operation on or near it, it is transmitted to the processor 2280 to determine the type of the touch event, and then the processor 2280 provides a corresponding visual output on the display panel 2241 according to the type of the touch event. Although in Figure 22, the touch panel 2231 and the display panel 2241 are used as two independent components to realize the input and output functions of the mobile phone, in some embodiments, the touch panel 2231 and the display panel 2241 can be integrated to realize the input and output functions of the mobile phone.

手机还可包括至少一种传感器2250,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板2241的亮度,接近传感器可在手机移动到耳边时,关闭显示面板2241和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。The mobile phone may also include at least one sensor 2250, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 2241 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 2241 and/or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.

音频电路2260、扬声器2261,传声器2262可提供用户与手机之间的音频接口。音频电路2260可将接收到的音频数据转换后的电信号,传输到扬声器2261,由扬声器2261转换为声音信号输出;另一方面,传声器2262将收集的声音信号转换为电信号,由音频电路2260接收后转换为音频数据,再将音频数据输出处理器2280处理后,经RF电路2210以发送给比如另一手机,或者将音频数据输出至存储器2220以便进一步处理。The audio circuit 2260, the speaker 2261, and the microphone 2262 can provide an audio interface between the user and the mobile phone. The audio circuit 2260 can transmit the received audio data to the speaker 2261 after converting the electrical signal, which is converted into a sound signal for output; on the other hand, the microphone 2262 converts the collected sound signal into an electrical signal, which is received by the audio circuit 2260 and converted into audio data, and then the audio data is output to the processor 2280 for processing, and then sent to another mobile phone through the RF circuit 2210, or the audio data is output to the memory 2220 for further processing.

WiFi属于短距离无线传输技术,手机通过WiFi模块2270可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图22示出了WiFi模块2270,但是可以理解的是,其并不属于手机的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 2270, which provides users with wireless broadband Internet access. Although FIG. 22 shows the WiFi module 2270, it is understandable that it is not a necessary component of the mobile phone and can be omitted as needed without changing the essence of the invention.

处理器2280是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器2220内的软件程序和/或模块,以及调用存储在存储器2220内的数据,执行手机的各种功能和处理数据。可选的,处理器2280可包括一个或多个处理单元;可选的,处理器2280可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器2280中。The processor 2280 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes various functions of the mobile phone and processes data by running or executing software programs and/or modules stored in the memory 2220 and calling data stored in the memory 2220. Optionally, the processor 2280 may include one or more processing units; optionally, the processor 2280 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 2280.

手机还包括给各个部件供电的电源2290(比如电池),可选的,电源可以通过电源管理系统与处理器2280逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile phone also includes a power supply 2290 (such as a battery) for supplying power to various components. Optionally, the power supply can be logically connected to the processor 2280 through a power management system, thereby managing functions such as charging, discharging, and power consumption management through the power management system.

尽管未示出,手机还可以包括摄像头、蓝牙模块等,在此不再赘述。Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

在本申请实施例中,该终端所包括的处理器2280还具有以下功能:In the embodiment of the present application, the processor 2280 included in the terminal also has the following functions:

获取账户转账请求,账户转账请求包括账户标识,账户转账请求还包括消费类型、消费类型对应的消费金额以及位置信息中的至少一种;Obtaining an account transfer request, the account transfer request including an account identifier, and the account transfer request also including at least one of a consumption type, a consumption amount corresponding to the consumption type, and location information;

根据账户转账请求,通过智能合约确定消费权限,消费权限与账户标识具有对应关系;According to the account transfer request, the consumption authority is determined through the smart contract, and the consumption authority has a corresponding relationship with the account identification;

若账户转账请求满足消费权限,则通过区块链同步账户转账请求;If the account transfer request meets the consumption authority, the account transfer request is synchronized through the blockchain;

在本申请实施例中,该终端所包括的处理器2280还具有以下功能:In the embodiment of the present application, the processor 2280 included in the terminal also has the following functions:

获取存款请求,存款请求包括账户标识,消费类型以及存款金额;Get a deposit request, which includes account ID, consumption type, and deposit amount;

根据账户标识,消费类型以及存款金额,确定智能合约;Determine the smart contract based on the account ID, consumption type and deposit amount;

向区块链同步存款请求以及智能合约。Sync the deposit request and smart contract to the blockchain.

在本申请实施例中,该终端所包括的处理器2280还具有以下功能:In the embodiment of the present application, the processor 2280 included in the terminal also has the following functions:

向区块链同步存款请求;Synchronize deposit request to blockchain;

向区块链同步智能合约;Synchronize smart contracts to the blockchain;

其中,向区块链同步智能合约包括:Among them, synchronizing smart contracts to the blockchain includes:

通过私钥加密智能合约,得到加密后的智能合约;Encrypt the smart contract with the private key to obtain the encrypted smart contract;

向区块链同步加密后的智能合约。Synchronize the encrypted smart contract to the blockchain.

在本申请实施例中,该终端所包括的处理器2280还具有以下功能:In the embodiment of the present application, the processor 2280 included in the terminal also has the following functions:

若消费金额大于消费限额,则生成提示消息,提示消息用于提示转账失败。If the consumption amount is greater than the consumption limit, a prompt message is generated to indicate that the transfer has failed.

在本申请实施例中,该终端所包括的处理器2280还具有以下功能:In the embodiment of the present application, the processor 2280 included in the terminal also has the following functions:

根据消费限额与消费金额确定更新后的消费限额。The updated consumption limit is determined based on the consumption limit and the consumption amount.

在本申请实施例中,该终端所包括的处理器2280还具有以下功能:In the embodiment of the present application, the processor 2280 included in the terminal also has the following functions:

根据智能合约中的消费限额生成提醒消息,提醒消息用于展示消费限额。A reminder message is generated based on the consumption limit in the smart contract, and the reminder message is used to display the consumption limit.

在本申请实施例中,该终端所包括的处理器2280还具有以下功能:In the embodiment of the present application, the processor 2280 included in the terminal also has the following functions:

根据账户转账请求中的账户标识获取历史消费记录,历史消费记录与账户标识具有关联关系;Obtain historical consumption records according to the account identifier in the account transfer request, where the historical consumption records are associated with the account identifier;

根据账户转账请求中的账户标识、消费类型以及历史消费记录,通过智能合约确定消费限额。The consumption limit is determined through a smart contract based on the account ID, consumption type, and historical consumption records in the account transfer request.

下面将对该节点设备为服务器的情况进行详细的描述:The following describes in detail the case where the node device is a server:

图23是本申请实施例提供的一种服务器结构示意图,该服务器2300可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processingunits,CPU)2322(例如,一个或一个以上处理器)和存储器2332,一个或一个以上存储应用程序2342或数据2344的存储介质2330(例如一个或一个以上海量存储设备)。其中,存储器2332和存储介质2330可以是短暂存储或持久存储。存储在存储介质2330的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对服务器中的一系列指令操作。更进一步地,中央处理器2322可以设置为与存储介质2330通信,在服务器2300上执行存储介质2330中的一系列指令操作。23 is a schematic diagram of a server structure provided by an embodiment of the present application. The server 2300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 2322 (for example, one or more processors) and memory 2332, and one or more storage media 2330 (for example, one or more mass storage devices) storing application programs 2342 or data 2344. Among them, the memory 2332 and the storage medium 2330 may be temporary storage or permanent storage. The program stored in the storage medium 2330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 2322 may be configured to communicate with the storage medium 2330 to execute a series of instruction operations in the storage medium 2330 on the server 2300.

服务器2300还可以包括一个或一个以上电源2326,一个或一个以上有线或无线网络接口2350,一个或一个以上输入输出接口2358,和/或,一个或一个以上操作系统2341,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。The server 2300 may also include one or more power supplies 2326, one or more wired or wireless network interfaces 2350, one or more input and output interfaces 2358, and/or one or more operating systems 2341, such as Windows Server , Mac OS X , Unix , Linux , FreeBSD , etc.

上述实施例中由服务器所执行的步骤可以基于该图23所示的服务器结构。The steps executed by the server in the above embodiment can be based on the server structure shown in Figure 23.

在本申请实施例中,中央处理器2322还可以执行以下步骤:In the embodiment of the present application, the central processor 2322 may further perform the following steps:

获取账户转账请求,账户转账请求包括账户标识,账户转账请求还包括消费类型、消费类型对应的消费金额以及位置信息中的至少一种;Obtaining an account transfer request, the account transfer request including an account identifier, and the account transfer request also including at least one of a consumption type, a consumption amount corresponding to the consumption type, and location information;

根据账户转账请求,通过智能合约确定消费权限,消费权限与账户标识具有对应关系;According to the account transfer request, the consumption authority is determined through the smart contract, and the consumption authority has a corresponding relationship with the account identification;

若账户转账请求满足消费权限,则通过区块链同步账户转账请求;If the account transfer request meets the consumption authority, the account transfer request is synchronized through the blockchain;

在本申请实施例中,中央处理器2322还可以执行以下步骤:In the embodiment of the present application, the central processor 2322 may further perform the following steps:

获取存款请求,存款请求包括账户标识,消费类型以及存款金额;Get a deposit request, which includes account ID, consumption type, and deposit amount;

根据账户标识,消费类型以及存款金额,确定智能合约;Determine the smart contract based on the account ID, consumption type and deposit amount;

向区块链同步存款请求以及智能合约。Sync the deposit request and smart contract to the blockchain.

在本申请实施例中,中央处理器2322还可以执行以下步骤:In the embodiment of the present application, the central processor 2322 may further perform the following steps:

向区块链同步存款请求;Synchronize deposit request to blockchain;

向区块链同步智能合约;Synchronize smart contracts to the blockchain;

其中,向区块链同步智能合约包括:Among them, synchronizing smart contracts to the blockchain includes:

通过私钥加密智能合约,得到加密后的智能合约;Encrypt the smart contract with the private key to obtain the encrypted smart contract;

向区块链同步加密后的智能合约。Synchronize the encrypted smart contract to the blockchain.

在本申请实施例中,中央处理器2322还可以执行以下步骤:In the embodiment of the present application, the central processor 2322 may further perform the following steps:

若消费金额大于消费限额,则生成提示消息,提示消息用于提示转账失败。If the consumption amount is greater than the consumption limit, a prompt message is generated to indicate that the transfer has failed.

在本申请实施例中,中央处理器2322还可以执行以下步骤:In the embodiment of the present application, the central processor 2322 may further perform the following steps:

根据消费限额与消费金额确定更新后的消费限额。The updated consumption limit is determined based on the consumption limit and the consumption amount.

在本申请实施例中,中央处理器2322还可以执行以下步骤:In the embodiment of the present application, the central processor 2322 may further perform the following steps:

根据智能合约中的消费限额生成提醒消息,提醒消息用于展示消费限额。A reminder message is generated based on the consumption limit in the smart contract, and the reminder message is used to display the consumption limit.

在本申请实施例中,中央处理器2322还可以执行以下步骤:In the embodiment of the present application, the central processor 2322 may further perform the following steps:

根据账户转账请求中的账户标识获取历史消费记录,历史消费记录与账户标识具有关联关系;Obtain historical consumption records according to the account identifier in the account transfer request, where the historical consumption records are associated with the account identifier;

根据账户转账请求中的账户标识、消费类型以及历史消费记录,通过智能合约确定消费限额。The consumption limit is determined through a smart contract based on the account ID, consumption type, and historical consumption records in the account transfer request.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

Claims (10)

1.一种消费处理的方法,其特征在于,包括:1. A consumption processing method, characterized by comprising: 获取存款请求,所述存款请求包括账户标识、消费类型以及存款金额;Obtain a deposit request, the deposit request including an account identifier, a consumption type, and a deposit amount; 根据所述存款请求中的账户标识、消费类型以及存款金额,确定智能合约;所述智能合约中的消费类型用于限定所述存款金额的用途;所述存款金额用于增加所述智能合约中所述账户标识在所述消费类型下消费限额;Determine a smart contract according to the account identifier, consumption type and deposit amount in the deposit request; the consumption type in the smart contract is used to limit the purpose of the deposit amount; the deposit amount is used to increase the consumption limit of the account identifier in the smart contract under the consumption type; 向区块链同步所述存款请求以及所述智能合约;用户终端与商家终端均接入所述区块链,并基于所述区块链进行交易;The deposit request and the smart contract are synchronized to the blockchain; the user terminal and the merchant terminal are both connected to the blockchain, and transactions are performed based on the blockchain; 获取账户转账请求,所述账户转账请求包括所述账户标识和商家标识,所述账户转账请求还包括消费类型、消费类型对应的消费金额以及位置信息中的至少一种;所述账户转账请求中的消费类型是根据商家标识和消费类型的关联关系确定的;Obtaining an account transfer request, the account transfer request including the account identifier and the merchant identifier, the account transfer request also including at least one of a consumption type, a consumption amount corresponding to the consumption type, and location information; the consumption type in the account transfer request is determined according to an association between the merchant identifier and the consumption type; 根据所述账户转账请求,通过智能合约确定消费权限,具体包括:根据所述账户转账请求中的所述账户标识获取历史消费记录,所述历史消费记录与所述账户标识具有关联关系;根据所述账户转账请求中的所述账户标识、消费类型以及所述历史消费记录,通过智能合约确定所述账户转账请求中的消费类型对应的消费限额,所述消费权限与所述账户标识具有对应关系;所述消费权限包括消费类型对应的消费限额、账户标识对应的消费类型限制条件以及账户标识对应的位置信息限制条件中的至少一种;所述智能合约包括多个消费类型,所述多个消费类型对应不同的消费限额;所述消费类型限制条件包括允许的消费类型;所述位置信息限制条件包括允许消费的位置信息;Determining the consumption authority through a smart contract according to the account transfer request specifically includes: obtaining historical consumption records according to the account identifier in the account transfer request, wherein the historical consumption records are associated with the account identifier; determining the consumption limit corresponding to the consumption type in the account transfer request through a smart contract according to the account identifier, the consumption type and the historical consumption records in the account transfer request, wherein the consumption authority is associated with the account identifier; the consumption authority includes at least one of the consumption limit corresponding to the consumption type, the consumption type restriction condition corresponding to the account identifier and the location information restriction condition corresponding to the account identifier; the smart contract includes multiple consumption types, and the multiple consumption types correspond to different consumption limits; the consumption type restriction condition includes permitted consumption types; the location information restriction condition includes permitted location information for consumption; 根据所述账户转账请求获取所述账户转账请求中的消费类型、消费类型对应的消费金额和位置信息;Acquire the consumption type, the consumption amount corresponding to the consumption type, and the location information in the account transfer request according to the account transfer request; 若所述账户转账请求中的消费类型满足所述账户标识对应的消费类型限制条件,所述账户转账请求中的消费类型对应的消费金额小于或等于所述账户转账请求中的消费类型对应的消费限额,以及所述账户转账请求中的位置信息满足所述账户标识对应的位置信息限制条件,则确定所述账户转账请求满足所述消费权限;否则,确定所述账户转账请求未满足所述消费权限,其中,所述账户标识对应的消费类型限制条件、所述消费类型对应的消费限额以及所述账户标识对应的位置信息限制条件,均为通过所述智能合约确定的;If the consumption type in the account transfer request satisfies the consumption type restriction condition corresponding to the account identifier, the consumption amount corresponding to the consumption type in the account transfer request is less than or equal to the consumption limit corresponding to the consumption type in the account transfer request, and the location information in the account transfer request satisfies the location information restriction condition corresponding to the account identifier, then it is determined that the account transfer request satisfies the consumption authority; otherwise, it is determined that the account transfer request does not satisfy the consumption authority, wherein the consumption type restriction condition corresponding to the account identifier, the consumption limit corresponding to the consumption type, and the location information restriction condition corresponding to the account identifier are all determined by the smart contract; 若所述账户转账请求满足所述消费权限,则通过所述区块链获取所述用户终端和所述商家终端上传的所述账户转账请求,并在所述区块链通过共识机制达成共识后,在所述区块链上同步所述账户转账请求,并根据所述消费限额与所述消费金额确定更新后的智能合约中的消费限额。If the account transfer request satisfies the consumption authority, the account transfer request uploaded by the user terminal and the merchant terminal is obtained through the blockchain, and after the blockchain reaches a consensus through a consensus mechanism, the account transfer request is synchronized on the blockchain, and the consumption limit in the updated smart contract is determined according to the consumption limit and the consumption amount. 2.根据权利要求1所述的方法,其特征在于,所述向区块链同步所述存款请求以及所述智能合约包括:2. The method according to claim 1, wherein synchronizing the deposit request and the smart contract to the blockchain comprises: 向区块链同步所述存款请求;Synchronizing the deposit request to the blockchain; 向区块链同步所述智能合约;Synchronizing the smart contract to the blockchain; 其中,所述向区块链同步所述智能合约包括:Wherein, synchronizing the smart contract to the blockchain includes: 通过私钥加密所述智能合约,得到加密后的所述智能合约;Encrypt the smart contract using a private key to obtain the encrypted smart contract; 向区块链同步加密后的所述智能合约。The encrypted smart contract is synchronized to the blockchain. 3.根据权利要求1所述的方法,其特征在于,所述根据所述账户转账请求,通过智能合约确定消费权限之后,所述方法还包括:3. The method according to claim 1, characterized in that after determining the consumption authority through a smart contract according to the account transfer request, the method further comprises: 若所述消费金额大于所述消费限额,则生成提示消息,所述提示消息用于提示转账失败。If the consumption amount is greater than the consumption limit, a prompt message is generated, wherein the prompt message is used to prompt that the transfer fails. 4.根据权利要求1所述的方法,其特征在于,所述方法还包括:4. The method according to claim 1, characterized in that the method further comprises: 根据所述智能合约中的所述消费限额生成提醒消息,所述提醒消息用于展示所述消费限额。A reminder message is generated according to the consumption limit in the smart contract, and the reminder message is used to display the consumption limit. 5.一种消费处理的装置,其特征在于,包括:5. A consumption processing device, characterized in that it includes: 存款单元,用于获取存款请求,所述存款请求包括账户标识、消费类型以及存款金额;根据所述存款请求中的账户标识、消费类型以及存款金额,确定智能合约;所述智能合约中的消费类型用于限定所述存款金额的用途;所述存款金额用于增加所述智能合约中所述账户标识在所述消费类型下消费限额;向区块链同步所述存款请求以及所述智能合约;用户终端与商家终端均接入所述区块链,并基于所述区块链进行交易;A deposit unit is used to obtain a deposit request, wherein the deposit request includes an account identifier, a consumption type, and a deposit amount; determine a smart contract according to the account identifier, the consumption type, and the deposit amount in the deposit request; the consumption type in the smart contract is used to limit the purpose of the deposit amount; the deposit amount is used to increase the consumption limit of the account identifier in the smart contract under the consumption type; synchronize the deposit request and the smart contract to the blockchain; both the user terminal and the merchant terminal are connected to the blockchain, and transactions are conducted based on the blockchain; 获取单元,用于获取账户转账请求,所述账户转账请求包括所述账户标识和商家标识,所述账户转账请求还包括消费类型、所述消费类型对应的消费金额以及位置信息中的至少一种;所述账户转账请求中的消费类型是根据商家标识和消费类型的关联关系确定的;an acquisition unit, configured to acquire an account transfer request, wherein the account transfer request includes the account identifier and the merchant identifier, and the account transfer request also includes at least one of a consumption type, a consumption amount corresponding to the consumption type, and location information; the consumption type in the account transfer request is determined according to an association between the merchant identifier and the consumption type; 处理单元,用于根据所述账户转账请求,通过智能合约确定消费权限,具体包括:根据所述账户转账请求中的所述账户标识获取历史消费记录,所述历史消费记录与所述账户标识具有关联关系;根据所述账户转账请求中的所述账户标识、消费类型以及所述历史消费记录,通过智能合约确定所述账户转账请求中的消费类型对应的消费限额,所述消费权限与所述账户标识具有对应关系;所述消费权限包括消费类型对应的消费限额、账户标识对应的消费类型限制条件以及账户标识对应的位置信息限制条件中的至少一种;所述智能合约包括多个消费类型,所述多个消费类型对应不同的消费限额;所述消费类型限制条件包括允许的消费类型;所述位置信息限制条件包括允许消费的位置信息;A processing unit, configured to determine consumption authority through a smart contract according to the account transfer request, specifically comprising: obtaining historical consumption records according to the account identifier in the account transfer request, wherein the historical consumption records are associated with the account identifier; determining a consumption limit corresponding to the consumption type in the account transfer request through a smart contract according to the account identifier, the consumption type and the historical consumption records in the account transfer request, wherein the consumption authority is associated with the account identifier; the consumption authority comprises at least one of a consumption limit corresponding to the consumption type, a consumption type restriction condition corresponding to the account identifier and a location information restriction condition corresponding to the account identifier; the smart contract comprises a plurality of consumption types, and the plurality of consumption types correspond to different consumption limits; the consumption type restriction condition comprises permitted consumption types; and the location information restriction condition comprises permitted location information for consumption; 所述处理单元,还用于根据所述账户转账请求获取所述账户转账请求中的消费类型、消费类型对应的消费金额和位置信息;若所述账户转账请求中的消费类型满足所述账户标识对应的消费类型限制条件,所述账户转账请求中的消费类型对应的消费金额小于或等于所述消费类型对应的消费限额,以及所述账户转账请求中的位置信息满足所述账户标识对应的位置信息限制条件,则确定所述账户转账请求满足所述消费权限;否则,确定所述账户转账请求未满足所述消费权限,其中,所述账户标识对应的消费类型限制条件、所述消费类型对应的消费限额以及所述账户标识对应的位置信息限制条件,均为通过所述智能合约确定的;The processing unit is further configured to obtain, according to the account transfer request, a consumption type, a consumption amount corresponding to the consumption type, and location information in the account transfer request; if the consumption type in the account transfer request satisfies the consumption type restriction condition corresponding to the account identifier, the consumption amount corresponding to the consumption type in the account transfer request is less than or equal to the consumption limit corresponding to the consumption type, and the location information in the account transfer request satisfies the location information restriction condition corresponding to the account identifier, then it is determined that the account transfer request satisfies the consumption authority; otherwise, it is determined that the account transfer request does not satisfy the consumption authority, wherein the consumption type restriction condition corresponding to the account identifier, the consumption limit corresponding to the consumption type, and the location information restriction condition corresponding to the account identifier are all determined by the smart contract; 所述处理单元,还用于若所述账户转账请求满足所述消费权限,则通过所述区块链获取所述用户终端和所述商家终端上传的所述账户转账请求,并在所述区块链通过共识机制达成共识后,在所述区块链上同步所述账户转账请求,并根据所述消费限额与所述消费金额确定更新后的智能合约中的消费限额。The processing unit is further configured to obtain, through the blockchain, the account transfer request uploaded by the user terminal and the merchant terminal if the account transfer request satisfies the consumption authority, and synchronize the account transfer request on the blockchain after the blockchain reaches a consensus through a consensus mechanism, and determine the consumption limit in the updated smart contract according to the consumption limit and the consumption amount. 6.根据权利要求5所述的装置,其特征在于,所述存款单元,还用于:6. The device according to claim 5, characterized in that the deposit unit is further used for: 向区块链同步所述存款请求;Synchronizing the deposit request to the blockchain; 向区块链同步所述智能合约;Synchronizing the smart contract to the blockchain; 其中,所述向区块链同步所述智能合约包括:Wherein, synchronizing the smart contract to the blockchain includes: 通过私钥加密所述智能合约,得到加密后的所述智能合约;Encrypt the smart contract using a private key to obtain the encrypted smart contract; 向区块链同步加密后的所述智能合约。The encrypted smart contract is synchronized to the blockchain. 7.根据权利要求5所述的装置,其特征在于,所述处理单元,还用于:7. The device according to claim 5, characterized in that the processing unit is further used for: 若所述消费金额大于所述消费限额,则生成提示消息,所述提示消息用于提示转账失败。If the consumption amount is greater than the consumption limit, a prompt message is generated, wherein the prompt message is used to prompt that the transfer fails. 8.根据权利要求5所述的装置,其特征在于,所述处理单元,还用于:8. The device according to claim 5, characterized in that the processing unit is further used for: 根据所述智能合约中的所述消费限额生成提醒消息,所述提醒消息用于展示所述消费限额。A reminder message is generated according to the consumption limit in the smart contract, and the reminder message is used to display the consumption limit. 9.一种节点设备,其特征在于,包括:存储器、收发器、处理器以及总线系统;9. A node device, comprising: a memory, a transceiver, a processor and a bus system; 其中,所述存储器用于存储程序;Wherein, the memory is used to store programs; 所述处理器用于执行所述存储器中的程序,以执行如权利要求1至4中任一项所述的方法;The processor is used to execute the program in the memory to perform the method according to any one of claims 1 to 4; 所述总线系统用于连接所述存储器以及所述处理器,以使所述存储器以及所述处理器进行通信。The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other. 10.一种计算机可读存储介质,其特征在于,包括指令,当其在计算机上运行时,使得计算机执行如权利要求1至4中任一项所述的方法。10 . A computer-readable storage medium, characterized by comprising instructions, which, when executed on a computer, enable the computer to execute the method according to claim 1 .
CN201910829813.4A 2019-08-30 2019-08-30 A method for consumption processing and related device Active CN110533403B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910829813.4A CN110533403B (en) 2019-08-30 2019-08-30 A method for consumption processing and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910829813.4A CN110533403B (en) 2019-08-30 2019-08-30 A method for consumption processing and related device

Publications (2)

Publication Number Publication Date
CN110533403A CN110533403A (en) 2019-12-03
CN110533403B true CN110533403B (en) 2024-10-01

Family

ID=68666697

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910829813.4A Active CN110533403B (en) 2019-08-30 2019-08-30 A method for consumption processing and related device

Country Status (1)

Country Link
CN (1) CN110533403B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021136963A1 (en) * 2019-12-31 2021-07-08 Nagravision S.A. Techniques for controlling access to segmented data
CN111415159B (en) * 2020-04-27 2023-09-22 中国银行股份有限公司 Block chain-based settlement data processing method, system and relevant nodes
CN113487330B (en) * 2020-06-16 2024-11-15 广西交通一卡通有限公司 A bill management system based on blockchain
CN112508621B (en) * 2020-12-15 2024-08-02 航天信息股份有限公司 Transaction analysis method and device
CN112561198B (en) * 2020-12-23 2023-12-01 iCALC控股有限公司 Block chain-based data processing method, device, equipment and readable storage medium
CN113450122A (en) * 2021-07-15 2021-09-28 中国银行股份有限公司 Block chain-based business transaction method and device for public clients
CN113469668B (en) * 2021-07-15 2025-02-18 中国银行股份有限公司 Public customer transaction restriction method and device based on blockchain
CN114022152A (en) * 2021-11-08 2022-02-08 中国银行股份有限公司 Bank card processing method and device
CN114912993A (en) * 2022-05-16 2022-08-16 中国银行股份有限公司 Capital information processing method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109784020A (en) * 2019-02-15 2019-05-21 上海优扬新媒信息技术有限公司 A kind of block chain right management method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106796685A (en) * 2016-12-30 2017-05-31 深圳前海达闼云端智能科技有限公司 Block chain authority control method and device and node equipment
CN110175842A (en) * 2019-03-27 2019-08-27 阿里巴巴集团控股有限公司 Transfer account method, system, calculating equipment and storage medium based on block chain

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109784020A (en) * 2019-02-15 2019-05-21 上海优扬新媒信息技术有限公司 A kind of block chain right management method and device

Also Published As

Publication number Publication date
CN110533403A (en) 2019-12-03

Similar Documents

Publication Publication Date Title
CN110533403B (en) A method for consumption processing and related device
EP3742323B1 (en) Blockchain generating method, and related device and system
US11928105B2 (en) System for tracking data associated with a digital token
CN110570282B (en) Cross-region resource transfer method, device, equipment and storage medium
Coskun et al. Near field communication (NFC): From theory to practice
TWI556181B (en) Method, mobile computing device, and computer-readable storage medium for wireless communication-enabled promotions and commercial transactions
US20210374736A1 (en) Wireless based methods and systems for federated key management, asset management, and financial transactions
US20140006198A1 (en) Generating and Categorizing Transaction Records
US20150358790A1 (en) Automated mobile system
US20150206122A1 (en) Point of sale normalization and extension services for invoice management
CN108628628A (en) Method and system for mobile application management
CN110148030A (en) Method and apparatus for peer-to-peer assisted shopping
CN109067582B (en) Data management system, method and device
CN111045568B (en) Virtual article processing method, device, equipment and storage medium based on block chain
CN104901864A (en) System and method used for information interaction
US20140351096A1 (en) Techniques for facilitating acquisition and exchange of ebook and other digital content via a computer network
WO2020082987A1 (en) Method and apparatus for credit data management, node device, user equipment, storage medium and system
CN104616143A (en) Virtual bill transfer method and device in social application
US20140289832A1 (en) System, Method, And Apparatus For Using A Virtual Bucket To Transfer Electronic Data
CN111008061A (en) Animation display method and related equipment
CN111476562B (en) A virtual resource transfer method, device, electronic device and storage medium
CN114722262A (en) Order information query system, and query method, device and equipment of order information
CN115630955A (en) Game virtual asset management method and device, storage medium and electronic equipment
CN112150156A (en) Commodity object processing method, commodity object processing device, client and medium
CN113240348A (en) Target delivery capacity allocation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TG01 Patent term adjustment
TG01 Patent term adjustment