CN114971611A - Hotspot balance processing method and device for account, processor and electronic equipment - Google Patents

Hotspot balance processing method and device for account, processor and electronic equipment Download PDF

Info

Publication number
CN114971611A
CN114971611A CN202210493612.3A CN202210493612A CN114971611A CN 114971611 A CN114971611 A CN 114971611A CN 202210493612 A CN202210493612 A CN 202210493612A CN 114971611 A CN114971611 A CN 114971611A
Authority
CN
China
Prior art keywords
sub
account
accounts
transaction
balance
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210493612.3A
Other languages
Chinese (zh)
Other versions
CN114971611B (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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210493612.3A priority Critical patent/CN114971611B/en
Publication of CN114971611A publication Critical patent/CN114971611A/en
Application granted granted Critical
Publication of CN114971611B publication Critical patent/CN114971611B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/10Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
    • G06Q20/102Bill distribution or payments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

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

Abstract

The application discloses a hotspot balance processing method and device for an account, a processor and electronic equipment. Relates to the field of block chains, and the method comprises the following steps: splitting a target main account to obtain a plurality of sub-accounts, wherein the plurality of sub-accounts share one root node in a Merkel patricia tree; generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts; receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating a target main account to participate in a transaction; and executing different transaction strategies on the sub-accounts in the sub-account list according to the type of the transaction request, wherein the transaction strategies at least are used for indicating that the transaction amount is deducted or accumulated from the balance of the sub-accounts. By the method and the device, the problems that a hot account is locked for a long time in a subtree due to the fact that a Merkel path is long, other accounts in the subtree are difficult to obtain an updating opportunity, and normal transaction cannot be achieved in the related art are solved.

Description

Hotspot balance processing method and device for account, processor and electronic equipment
Technical Field
The application relates to the field, in particular to a hotspot balancing processing method and device for an account, a processor and electronic equipment.
Background
A merkel patricia tree is often used in account transaction, and is a block chain state tree, and the merkel patricia tree is a modified merkel tree, and is essentially a combination of the merkel tree and a prefix tree and comprises a root node, an expansion node, a branch node and a leaf node; the account is marked with an account address, including balance, nonce, hash. However, when the account transaction is updated, the Merkel tree account is updated, and the Merkel path is synchronously calculated. For example, the balance and the nonce of the account a are updated, and the hashes of the leaf nodes, the extension nodes and the root node need to be updated synchronously.
Therefore, for concurrent update of the hotspot account in the meikerr tree, a meikerr path is long, which may cause long-time locking of a subtree where the hotspot account is located, and thus other accounts in the subtree may not obtain an update opportunity, and normal transaction may not be realized.
Aiming at the problems that in the related technology, the long Merkel path can cause the long-time locking of the subtree where the hotspot account is located, other accounts in the subtree are difficult to obtain the updating opportunity, and normal transaction cannot be realized, an effective solution is not provided at present.
Disclosure of Invention
The application mainly aims to provide a hotspot balance processing method, device, processor and electronic equipment for an account, so as to solve the problems that a long-time locking of a subtree where a hotspot account is located can be caused due to a long mekerr path, so that other accounts in the subtree are difficult to obtain an update opportunity, and normal transaction cannot be realized in the related art.
In order to achieve the above object, according to one aspect of the present application, a hotspot balancing processing method for an account is provided. The method comprises the following steps: splitting the target main account to obtain a plurality of sub-accounts, wherein the plurality of sub-accounts share one root node in the Merkel patricia tree, and the sum of the balances of the plurality of sub-accounts is equal to the balance of the target main account; generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts, wherein the sub-account list comprises: a plurality of sub-accounts; receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating a target main account to participate in a transaction; and executing different transaction strategies for the sub-accounts in the sub-account list according to the type of the transaction request, wherein the transaction strategies are at least used for indicating that the transaction amount is deducted or accumulated from the balance of the sub-accounts.
Optionally, according to the type of the transaction request, different processing strategies are executed on the plurality of sub-accounts in the sub-account list, including: inquiring a sub-account list corresponding to the transaction request according to the corresponding relation; under the condition that the type of the transaction request is determined to be the outward transfer from the target main account, determining a first random number carried by the transaction request; determining a target sub-account to be participated in based on the first random number and the number of the sub-accounts; and deducting the first transaction amount corresponding to the transaction type from the target sub-account.
Optionally, deducting the first transaction amount corresponding to the transaction type from the target sub-account, including: acquiring a minimum balance threshold value of a target sub-account; determining a current balance of the target sub-account; and under the condition that the difference value between the current balance and the first transaction amount is larger than the minimum balance threshold value, deducting the first transaction amount corresponding to the transaction type from the target sub-account.
Optionally, the method further includes: the difference between the current balance and the first transaction amount is less than the minimum balance threshold; or under the condition that the current balance is smaller than the first transaction amount, acquiring the balances of all the sub-accounts in the sub-account list; determining an average of the balances of all sub-accounts; and updating the current balance of the target sub-account to be the average value, and deducting the first transaction amount from the target sub-account.
Optionally, the method further includes: and under the condition that the transaction request is abnormal, acquiring the sub-account with the minimum balance in the sub-account list, and rolling back the first transaction amount corresponding to the transaction request to the sub-account with the minimum balance.
Optionally, according to the type of the transaction request, different processing strategies are executed on the plurality of sub-accounts in the sub-account list, including: inquiring a sub-account list corresponding to the transaction request according to the corresponding relation; and under the condition that the transaction type is determined to be that other main accounts transfer to the target main account, selecting any one sub account from the sub account list, and accumulating the second transaction amount indicated by the transaction request to any one sub account.
Optionally, the method further includes: under the condition that the transaction request is abnormal, acquiring a sub-account with the maximum balance in a sub-account list, and determining the current balance of the sub-account with the maximum balance; acquiring a lowest balance threshold value of a sub account with the largest balance; and when the difference value between the current balance and the second transaction amount is larger than the minimum balance threshold value, deducting the second transaction amount from the sub-account with the maximum balance.
Optionally, the method further includes: when the difference between the current balance and the second transaction amount is less than the minimum balance threshold; or under the condition that the current balance is smaller than the second transaction amount, acquiring the balances of all the sub-accounts in the sub-account list; determining an average of the balances of all sub-accounts; and updating the current balance of the sub-account with the maximum balance as an average value, and deducting the second transaction amount from the sub-account with the maximum balance.
Optionally, the method further includes: determining a preset time period according to the transaction request amount of the historical time period, wherein the preset time period is the time period with the minimum transaction request amount; inquiring each sub-account in the sub-account list within a preset time period, determining the balance corresponding to each sub-account, and determining the total balance of the target main account according to the balance corresponding to each sub-account.
According to another aspect of the embodiments of the present application, there is also provided an account hotspot balancing processing apparatus, including: the system comprises a splitting module, a storage module and a processing module, wherein the splitting module is used for splitting a target main account to obtain a plurality of sub-accounts, the plurality of sub-accounts share one root node in a Merkelpattelix tree, and the sum of balances of the plurality of sub-accounts is equal to the balance of the target main account; the generation module is used for generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts, wherein the sub-account list comprises: a plurality of sub-accounts; the receiving module is used for receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating the target main account to participate in the transaction; and the execution module is used for executing different transaction strategies on the sub-accounts in the sub-account list according to the type of the transaction request, wherein the transaction strategies are at least used for indicating that the transaction amount is deducted or accumulated from the balance of the sub-accounts.
According to another aspect of the embodiments of the present application, a processor is further provided, where the processor is configured to execute a program, and when the program runs, the hotspot balancing processing method of any account is performed.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including one or more processors and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement any one of the hotspot balancing processing methods of the account.
Through the application, the following steps are adopted: splitting the target main account to obtain a plurality of sub-accounts, wherein the plurality of sub-accounts share one root node in the Merkel patricia tree, and the sum of the balances of the plurality of sub-accounts is equal to the balance of the target main account; generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts, wherein the sub-account list comprises: a plurality of sub-accounts; receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating a target main account to participate in a transaction; according to the type of the transaction request, different transaction strategies are executed for the sub-accounts in the sub-account list, wherein the transaction strategies are at least used for indicating to deduct or accumulate transaction amount from the balance of the sub-accounts, and the problems that in the related technology, due to the fact that a Merkel path is long, a sub-tree where a hotspot account is located is locked for a long time, other accounts in the sub-tree are difficult to obtain updating opportunities, and normal transactions cannot be achieved are solved. Furthermore, the effects that a single hot spot account is divided into a plurality of sub-accounts, a root node is shared among sub-account addresses, the calculation amount of the single hot spot account for updating the Merkel path is dispersed to the plurality of sub-accounts, the length of the Merkel path is shortened, and the concurrent calculation efficiency of the Merkel path is improved are achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, are included to provide a further understanding of the application, and the description of the exemplary embodiments of the application are intended to be illustrative of the application and are not intended to limit the application. In the drawings:
fig. 1 is a schematic structural view of a merkel patricia tree in the related art;
fig. 2 is a flowchart of a hotspot balancing processing method of an account provided according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an exemplary Merkel patricia tree structure of the present application;
fig. 4 is a schematic structural diagram of a hotspot balancing processing device of an account according to an embodiment of the present application;
fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a schematic diagram of a structure of a related art merkel patricia tree, as shown in fig. 1, the structure includes account addresses b422001, b48a611, b4f2002, and b48a6f 1. The above accounts all have a prefix b4, and thus b4 is recorded in extension node 1. b4 is followed by three prefixes 2, 8 and f, which are placed in branch node 1. The account with prefix 2 suffix 2001 is stored in leaf node 1. The merkel path of each account is stored in an expansion node, for example, the expansion node 2 stores the hash of the leaf node 3 and the leaf node 4. As described above, the synchronization of the meikerr paths is required when the meikerr tree account is updated. For example, the balance and the nonce of the account b48a6f1 need to be updated synchronously with the hashes of the leaf node 4, the extension node 2, the extension node 1 and the root node. It can be understood that for concurrent updating of a hotspot account in a meikel tree, because the meikel path in the related art is long, the computation of the meikel path may cause long-time locking of the subtree where the hotspot account is located, and other accounts in the subtree may be more difficult to obtain an updating opportunity.
In order to solve the above problem, the present invention provides a hotspot balancing processing method for an account, which is described below with reference to preferred implementation steps, and fig. 2 is a flowchart of the hotspot balancing processing method for an account provided in an embodiment of the present application, and as shown in fig. 2, the method includes the following steps:
step S101, splitting a target main account to obtain a plurality of sub-accounts, wherein the plurality of sub-accounts share one root node in a Merkelpattelia tree, and the sum of balances of the plurality of sub-accounts is equal to the balance of the target main account;
step S102, generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts, wherein the sub-account list comprises: a plurality of sub-accounts;
step S103, receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating a target main account to participate in transaction;
and step S104, executing different transaction strategies for the sub-accounts in the sub-account list according to the type of the transaction request, wherein the transaction strategies are at least used for indicating that the transaction amount is deducted or accumulated from the balance of the sub-accounts.
In the account hotspot balancing processing method, a target main account is split to obtain a plurality of sub-accounts, wherein the plurality of sub-accounts share one root node in a Merkel patricia tree, and the sum of balances of the plurality of sub-accounts is equal to the balance of the target main account; generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts, wherein the sub-account list comprises: a plurality of sub-accounts; receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating a target main account to participate in a transaction; according to the type of the transaction request, different transaction strategies are executed for the sub-accounts in the sub-account list, wherein the transaction strategies are at least used for indicating to deduct or accumulate transaction amount from the balance of the sub-accounts, and the problems that in the related technology, due to the fact that a Merkel path is long, a sub-tree where a hotspot account is located is locked for a long time, other accounts in the sub-tree are difficult to obtain updating opportunities, and normal transactions cannot be achieved are solved. Furthermore, the effects that a single hot spot account is divided into a plurality of sub-accounts, a root node is shared among sub-account addresses, the calculation amount of the single hot spot account for updating the Merkel path is dispersed to the plurality of sub-accounts, the length of the Merkel path is shortened, and the concurrent calculation efficiency of the Merkel path is improved are achieved.
In some embodiments of the present application, the executing different processing strategies for the plurality of sub-accounts in the sub-account list according to the type of the transaction request includes: inquiring a sub-account list corresponding to the transaction request according to the corresponding relation; under the condition that the type of the transaction request is determined to be the outward transfer from the target main account, determining a first random number carried by the transaction request; determining a target sub-account to be participated in based on the first random number and the number of the sub-accounts; and deducting the first transaction amount corresponding to the transaction type from the target sub-account.
Specifically, deducting the first transaction amount corresponding to the transaction type from the target sub-account may be implemented as follows: acquiring a minimum balance threshold value of a target sub-account; determining a current balance of the target sub-account; and under the condition that the difference value between the current balance and the first transaction amount is larger than the minimum balance threshold value, deducting the first transaction amount corresponding to the transaction type from the target sub-account.
It should be noted that the difference between the current balance and the first transaction amount is less than the minimum balance threshold; or under the condition that the current balance is smaller than the first transaction amount, acquiring the balances of all the sub-accounts in the sub-account list; determining an average of balances of all sub-accounts; and updating the current balance of the target sub-account to be the average value, and deducting the first transaction amount from the target sub-account. I.e. to trigger the sub-account balance handling mechanism.
In some embodiments of the present application, when a transaction request is abnormal, a sub-account with the minimum balance in the sub-account list is acquired, and a first transaction amount corresponding to the transaction request is rolled back to the sub-account with the minimum balance.
To facilitate understanding of the processing strategy of the present application in the case where the transaction type is the outward transfer of the target primary account, a specific embodiment will now be described:
first, a merkel patricia tree structure with sub-accounts may be created, and specifically, a hot main account (target main account) may be split into N sub-accounts, each of which contains an account number, a sub-account, a balance, a nonce, and a hash. Wherein the account serial number is 1.. N which is increased by oneself; the sub-account is used for keeping an account naming rule for compatible stock processing; the sum of the balance accumulated by the sub-accounts is equal to the balance of the main account, and the balance of the sub-accounts can be obtained by uniformly dividing the balance of the main account into N parts; the nonce is the nonce of the sub-account itself; the hash is the hash of the sub-account itself. The sub-accounts are directly hung under a root node of a Merkel patricia tree as leaf nodes, a main account is deleted in the Merkel patricia tree, corresponding relation caches of the main account and the sub-accounts can be established, the main account and the sub-accounts are used for being positioned to the sub-accounts from the main account in the transaction when the transaction occurs, as shown in FIG. 3, an exemplary Merkel patricia tree structure is shown in FIG. 3, the main account b48a6f1 is assumed to be a hot account and is divided into 4 sub-accounts b422002, b422003, b422004 and b422005, serial numbers of the sub-accounts are 1 to 4 respectively, balances are 1.00, a nonce primary value of the sub-account 1 is a current value of a nonce of the main account, and nonces primary values of the other sub-accounts are sequentially added with 1. And 4 sub-accounts are hung below the root node as leaf nodes. That is, the original main account b48a6f1 needs to be deleted from the merkel patricia tree, so that after the leaf node 4 shown in fig. 1 is deleted, the leaf node 3 where the account b48a611 is located does not have a node with a common prefix, and therefore the leaf node 3 can be merged with the branch node 2 and the extension node 2, and finally the leaf node 3 shown in fig. 2 is obtained.
And transferring outwards when the transaction type is the target main account, namely, the transaction of the transfer-out account is carried out on the sub-account, the transfer-out main account and the nonce are obtained from the transaction, a sub-account list is cached and searched out from the corresponding relation between the main account and the sub-account, and the nonce is used for taking the balance of the number of the sub-accounts as the serial number of the sub-accounts, so that the transferred-out sub-accounts are positioned. And checking the sub-account nonce and the transaction nonce according to the stock nonce check rule, wherein the transaction nonce is the sub-account nonce and the like, and is used for eliminating double flowers. And if the verification is passed, deducting the balance of the sub-account according to the amount in the transaction, accumulating the sub-account nonce by 1, and updating the account hash. And finally, updating the hash of the root node.
In order to avoid balance imbalance among the sub-accounts, a minimum balance threshold value can be set for the balance of the sub-accounts. If the deducted balance of the sub-account is smaller than the minimum balance threshold value or the balance of the sub-account is insufficient, the balance processing of the sub-account can be triggered. And if the balance of the sub-account is still insufficient after balance balancing processing of the sub-account, returning to update transaction failure.
For example, if the amount of money needs to be transferred from the primary account b48a6f1 to the account b422001, the main fields of the transaction message are as follows:
{
roll-out account b48a6f1,
the transfer-in to the account b422001,
nonce:2,
amount of money 2.00
};
Checking the list of the sub-accounts through the main account b48a6f1, locating the sub-account b422003 through the remainder of 2 with the nonce, checking that the transaction nonce is consistent with the sub-account nonce, and deducting the balance of the sub-account b422003 to be larger than the minimum balance threshold value, deducting the amount of the sub-account b422003, accumulating the nonce of the sub-account b422003 by 1, updating the hash of the sub-account b422003, and finally updating the hash of the root node.
It should be noted that, if the balance of the sub-account after subtraction is less than the minimum balance threshold or the balance of the sub-account is insufficient, the balance balancing process of the sub-account is triggered. The balance process requires averaging the balances of all sub-accounts, then adjusting the balances of all sub-accounts to the average balance, and then attempting to subtract again. The balance processing needs to lock the sub-accounts, and the cost is high. In order to avoid repeated triggering of the equalization processing caused by too low total balance of all the sub-accounts, the upper limit of the equalization processing times within a period of time can be controlled.
By way of example: if the amount of money needs to be transferred from the primary account b48a6f1 to the account b422001, the main fields of the transaction message are as follows:
{
roll-out accounts b48a6f1,
the transfer-in to the account b422001,
nonce:2,
amount of money 2.00
};
The current sub-account balances of the main account b48a6f1 are:
sub-account b 422002: nonce 1, balance 3.00;
sub-account b 422003: nonce 2, balance 1.00;
sub-account b 422004: nonce is 3, balance 2.00;
sub-account b 422005: nonce 4, balance 2.00;
checking a sub-account list through the main account b48a6f1, locating the sub-account b422003 through the remainder of 2-degree, checking that the transaction nonce is consistent with the sub-account nonce, and after deduction, if the balance of the sub-account b422003 is-1, triggering sub-account balance balancing processing, setting the balance of all sub-accounts as an average value, and obtaining:
sub-account b 422002: 1, 2.00 for nonce and balance;
sub-account b 422003: nonce 2, balance 2.00;
sub-account b 422004: nonce is 3, balance 2.00;
sub-account b 422005: nonce 4, balance 2.00;
the deduction again from sub-account b422003 may be successful.
If the transaction is abnormal, the transaction needs to be rolled back. In order to avoid aggravating balance imbalance among the sub-accounts, the sub-account with the smallest balance can be selected for rollback, the balance is accumulated in the transaction amount, the sub-account hash is updated, and the nonce does not need to be modified. And finally, updating the hash of the root node.
In other embodiments of the present application, the executing different processing strategies for the plurality of sub-accounts in the sub-account list according to the type of the transaction request includes: inquiring a sub-account list corresponding to the transaction request according to the corresponding relation; and under the condition that the transaction type is determined to be that the other main accounts transfer to the target main account, selecting any one sub account from the sub account list, and accumulating the second transaction amount indicated by the transaction request to any one sub account.
It should be noted that, in some embodiments of the present application, in the case that a transaction request is abnormal, a sub-account with the largest balance in the sub-account list may be acquired, and the current balance of the sub-account with the largest balance is determined; then, acquiring a lowest balance threshold of the sub-account with the largest balance; and when the difference value between the current balance and the second transaction amount is larger than the minimum balance threshold value, deducting the second transaction amount from the sub-account with the maximum balance.
Specifically, the difference between the current balance of the sub-account with the largest balance and the second transaction amount is smaller than the lowest balance threshold; or under the condition that the current balance is smaller than the second transaction amount, acquiring the balances of all the sub-accounts in the sub-account list; determining an average of the balances of all sub-accounts; and updating the current balance of the sub-account with the maximum balance as an average value, and deducting the second transaction amount from the sub-account with the maximum balance.
In some embodiments of the present application, a preset time period may also be determined according to a transaction request amount in a historical time period, where the preset time period is a time period with the minimum transaction request amount; inquiring each sub-account in the sub-account list within a preset time period, determining the balance corresponding to each sub-account, and determining the total balance of the target main account according to the balance corresponding to each sub-account. Namely, the balance of each sub-account is inquired in the period of the least transaction request amount so as to prevent traffic jam.
In the case that the transaction type is transfer from other main accounts to the target main account, that is, the sub-account is a transfer account, if the transaction type is normal, the transfer main account is acquired from the transaction, a sub-account list is cached from the main account-sub account correspondence, then one sub-account is randomly selected, the transaction amount is accumulated to the sub-account, the sub-account hash is updated, and finally the root node hash is updated. It will be appreciated that the reason for randomly selecting one sub-account is that the normal transaction frequency is high, and selecting the sub-account with the smallest balance will cause all sub-accounts to be locked. And when the transaction is abnormal and rollback processing is required, acquiring a transferred main account from the transaction, caching and checking a sub-account list from the corresponding relation between the main account and the sub-accounts, selecting the sub-account with the largest balance to perform rollback so as to avoid aggravating balance imbalance among the sub-accounts, deducting the transaction amount from the balance, updating the sub-account hash, and finally updating the root node hash. If the balance of the sub-account is smaller than the minimum balance threshold value or the balance of the sub-account is insufficient after deduction, balance processing of the sub-account is also triggered.
It should be noted that, the main account balance inquiry needs to lock each sub-account, and then sum the sub-account balances to obtain the sum, so that the overhead is large. The primary account balance inquiry should not be performed during peak traffic hours, nor should it be performed frequently. The main account balance inquiry is executed when the transaction pressure is small, or statistical data is needed to be obtained at the end of the day and the end of the month.
Fig. 4 is a hotspot equalization processing device of an account according to an embodiment of the present application, and as shown in fig. 4, the device includes:
the splitting module 40 is configured to split the target main account to obtain a plurality of sub-accounts, where the plurality of sub-accounts share one root node in the merkel patricia tree, and a sum of balances of the plurality of sub-accounts is equal to a balance of the target main account;
a generating module 42, configured to generate a sub-account list corresponding to the target main account according to a corresponding relationship between the target main account and the multiple sub-accounts, where the sub-account list includes: a plurality of sub-accounts;
a receiving module 44, configured to receive a transaction request and determine a type of the transaction request, where the transaction request is used to indicate that the target primary account participates in the transaction;
and the execution module 46 is configured to execute different transaction policies for the sub-accounts in the sub-account list according to the type of the transaction request, where the transaction policies are at least used for indicating to deduct or accumulate the transaction amount from the balance of the sub-accounts.
In the hotspot balancing processing device of the account, a splitting module 40 is used for splitting a target main account to obtain a plurality of sub-accounts, wherein the plurality of sub-accounts share one root node in a Merkel patricia tree, and the sum of the balances of the plurality of sub-accounts is equal to the balance of the target main account; a generating module 42, configured to generate a sub-account list corresponding to the target main account according to a corresponding relationship between the target main account and the multiple sub-accounts, where the sub-account list includes: a plurality of sub-accounts; a receiving module 44, configured to receive a transaction request and determine a type of the transaction request, where the transaction request is used to indicate that the target primary account participates in the transaction; and the execution module 46 is configured to execute different transaction policies for the sub-accounts in the sub-account list according to the type of the transaction request, where the transaction policies are at least used to indicate to deduct or accumulate transaction amount from the balance of the sub-accounts, so that the problem that in the related art, a long-time locking of a sub-tree where the hot account is located is caused due to a long mekerr path, so that other accounts in the sub-tree are difficult to obtain an update opportunity, and normal transactions cannot be realized is solved. Furthermore, the effects that a single hot spot account is divided into a plurality of sub-accounts, a root node is shared among sub-account addresses, the calculation amount of the single hot spot account for updating the Merkel path is dispersed to the plurality of sub-accounts, the length of the Merkel path is shortened, and the concurrent calculation efficiency of the Merkel path is improved are achieved.
According to another aspect of the embodiments of the present application, there is also provided a processor, where the processor is configured to execute a program, where the program executes a hotspot balancing processing method for any account when running.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including one or more processors and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement any one of the hotspot balancing processing methods of the account.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than here.
The hot spot balancing processing device of the account comprises a processor and a memory, wherein the splitting module, the generating module and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. One or more kernels can be set, and the problem that in the related technology, the long-time locking of a subtree where a hotspot account is located can be caused due to a long Merkel path, so that other accounts in the subtree are difficult to obtain an updating chance and normal transaction cannot be realized is solved by adjusting kernel parameters. Furthermore, the effects that a single hot spot account is divided into a plurality of sub-accounts, a root node is shared among sub-account addresses, the calculation amount of the single hot spot account for updating the Merkel path is dispersed to the plurality of sub-accounts, the length of the Merkel path is shortened, and the concurrent calculation efficiency of the Merkel path is improved are achieved.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The embodiment of the invention provides a computer-readable storage medium, wherein a program is stored on the computer-readable storage medium, and the program realizes the hot spot balancing processing method of the account when being executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the hotspot balancing processing method of an account is executed when the program runs.
In the related embodiment of the application, a plurality of sub-accounts are obtained by splitting a target main account, wherein the plurality of sub-accounts share one root node in a Merkel patricia tree, and the sum of balances of the plurality of sub-accounts is equal to the balance of the target main account; generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts, wherein the sub-account list comprises: a plurality of sub-accounts; receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating a target main account to participate in a transaction; according to the type of the transaction request, different transaction strategies are executed for the sub-accounts in the sub-account list, wherein the transaction strategies are at least used for indicating to deduct or accumulate transaction amount from the balance of the sub-accounts, and the problems that in the related technology, due to the fact that a Merkel path is long, a sub-tree where a hotspot account is located is locked for a long time, other accounts in the sub-tree are difficult to obtain updating opportunities, and normal transactions cannot be achieved are solved. Furthermore, the effects that a single hot spot account is divided into a plurality of sub-accounts, a root node is shared among sub-account addresses, the calculation amount of the single hot spot account for updating the Merkel path is dispersed to the plurality of sub-accounts, the length of the Merkel path is shortened, and the concurrent calculation efficiency of the Merkel path is improved are achieved.
As shown in fig. 5, an embodiment of the present invention provides an electronic device, where the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor executes the program to implement the following steps: splitting the target main account to obtain a plurality of sub-accounts, wherein the plurality of sub-accounts share one root node in the Merkel patricia tree, and the sum of the balances of the plurality of sub-accounts is equal to the balance of the target main account; generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts, wherein the sub-account list comprises: a plurality of sub-accounts; receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating a target main account to participate in a transaction; and executing different transaction strategies for the sub-accounts in the sub-account list according to the type of the transaction request, wherein the transaction strategies are at least used for indicating that the transaction amount is deducted or accumulated from the balance of the sub-accounts. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: splitting the target main account to obtain a plurality of sub-accounts, wherein the plurality of sub-accounts share one root node in the Merkel patricia tree, and the sum of the balances of the plurality of sub-accounts is equal to the balance of the target main account; generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts, wherein the sub-account list comprises: a plurality of sub-accounts; receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating a target main account to participate in a transaction; and executing different transaction strategies for the sub-accounts in the sub-account list according to the type of the transaction request, wherein the transaction strategies are at least used for indicating that the transaction amount is deducted or accumulated from the balance of the sub-accounts.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (12)

1. A hotspot balancing processing method of an account is characterized by comprising the following steps:
splitting a target main account to obtain a plurality of sub-accounts, wherein the plurality of sub-accounts share one root node in a Merkel patricia tree, and the sum of balances of the plurality of sub-accounts is equal to the balance of the target main account;
generating a sub-account list corresponding to the target main account according to the corresponding relation between the target main account and the plurality of sub-accounts, wherein the sub-account list comprises: the plurality of sub-accounts;
receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating that the target main account participates in transaction;
and executing different transaction strategies on the sub-accounts in the sub-account list according to the type of the transaction request, wherein the transaction strategies are at least used for indicating that the transaction amount is deducted or accumulated from the balance of the sub-accounts.
2. The method of claim 1, wherein performing different processing policies for the plurality of sub-accounts in the sub-account list according to the type of the transaction request comprises:
inquiring the sub-account list corresponding to the transaction request according to the corresponding relation;
under the condition that the type of the transaction request is determined to be the outward transfer from the target main account, determining a first random number carried by the transaction request;
determining a target sub-account to participate in based on the first random number and the number of the sub-accounts;
and deducting a first transaction amount corresponding to the transaction type from the target sub-account.
3. The method of claim 2, wherein deducting from the target sub-account a first transaction amount corresponding to the transaction type comprises:
acquiring a minimum balance threshold value of the target sub-account;
determining a current balance of the target sub-account;
and when the difference between the current balance and the first transaction amount is larger than the minimum balance threshold, deducting the first transaction amount corresponding to the transaction type from the target sub-account.
4. The method of claim 3, further comprising:
when the difference between the current balance and the first transaction amount is less than the minimum balance threshold; or under the condition that the current balance is smaller than the first transaction amount, acquiring the balances of all sub-accounts in a sub-account list;
determining an average of the balances of all the sub-accounts; and updating the current balance of the target sub-account to the average value, and deducting the first transaction amount from the target sub-account.
5. The method of claim 4, further comprising:
and under the condition that the transaction request is abnormal, acquiring the sub-account with the minimum balance in the sub-account list, and rolling back the first transaction amount corresponding to the transaction request to the sub-account with the minimum balance.
6. The method of claim 1, wherein performing different processing policies for the plurality of sub-accounts in the sub-account list according to the type of the transaction request comprises:
inquiring the sub-account list corresponding to the transaction request according to the corresponding relation;
and under the condition that the transaction type is determined to be that the other main accounts transfer to the target main account, selecting any one sub account from the sub account list, and accumulating a second transaction amount indicated by the transaction request to the any one sub account.
7. The method of claim 6, further comprising:
under the condition that the transaction request is abnormal, acquiring a sub-account with the maximum balance in the sub-account list, and determining the current balance of the sub-account with the maximum balance;
acquiring a lowest balance threshold value of the sub account with the largest balance;
and when the difference between the current balance and the second transaction amount is greater than the minimum balance threshold, deducting the second transaction amount from the sub-account with the maximum balance.
8. The method of claim 7, further comprising:
(ii) the difference between the current balance and the second transaction amount is less than the minimum balance threshold; or under the condition that the current balance is smaller than the second transaction amount, acquiring the balances of all the sub-accounts in the sub-account list;
determining an average of the balances of all the sub-accounts; and updating the current balance of the sub-account with the maximum balance as the average value, and deducting the second transaction amount from the sub-account with the maximum balance.
9. The method of any one of claims 1 to 8, further comprising:
determining a preset time period according to the transaction request amount of the historical time period, wherein the preset time period is the time period with the minimum transaction request amount;
inquiring each sub-account in the sub-account list within the preset time period, determining the balance corresponding to each sub-account, and determining the total balance of the target main account according to the balance corresponding to each sub-account.
10. A hotspot equalization processing device of an account is characterized by comprising:
the system comprises a splitting module, a storage module and a processing module, wherein the splitting module is used for splitting a target main account to obtain a plurality of sub-accounts, the plurality of sub-accounts share one root node in a Merkel patricia tree, and the sum of the balances of the plurality of sub-accounts is equal to the balance of the target main account;
a generating module, configured to generate a sub-account list corresponding to the target main account according to a correspondence between the target main account and the plurality of sub-accounts, where the sub-account list includes: the plurality of sub-accounts;
the receiving module is used for receiving a transaction request and determining the type of the transaction request, wherein the transaction request is used for indicating the target main account to participate in a transaction;
and the execution module is used for executing different transaction strategies on the sub-accounts in the sub-account list according to the type of the transaction request, wherein the transaction strategies are at least used for indicating that the transaction amount is deducted or accumulated from the balance of the sub-accounts.
11. A processor, configured to execute a program, wherein the program executes the method for hotspot balancing of an account according to any one of claims 1 to 9.
12. An electronic device comprising one or more processors and memory storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of hotspot balancing for accounts of any of claims 1-9.
CN202210493612.3A 2022-05-07 2022-05-07 Hot spot balance processing method and device for account, processor and electronic equipment Active CN114971611B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210493612.3A CN114971611B (en) 2022-05-07 2022-05-07 Hot spot balance processing method and device for account, processor and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210493612.3A CN114971611B (en) 2022-05-07 2022-05-07 Hot spot balance processing method and device for account, processor and electronic equipment

Publications (2)

Publication Number Publication Date
CN114971611A true CN114971611A (en) 2022-08-30
CN114971611B CN114971611B (en) 2024-08-13

Family

ID=82982112

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210493612.3A Active CN114971611B (en) 2022-05-07 2022-05-07 Hot spot balance processing method and device for account, processor and electronic equipment

Country Status (1)

Country Link
CN (1) CN114971611B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115456612A (en) * 2022-10-28 2022-12-09 深圳市小赢信息技术有限责任公司 Method, system, terminal and storage medium for keeping balance base table

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446975A (en) * 2018-03-28 2018-08-24 上海数据交易中心有限公司 A kind of quota control method and device
CN111833037A (en) * 2020-07-01 2020-10-27 中国建设银行股份有限公司 Account management method and device
CN112132674A (en) * 2020-09-16 2020-12-25 建信金融科技有限责任公司 Transaction processing method and device
CN112184229A (en) * 2020-10-14 2021-01-05 深圳壹账通智能科技有限公司 Block chain-based sub-account transaction processing method, system and equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446975A (en) * 2018-03-28 2018-08-24 上海数据交易中心有限公司 A kind of quota control method and device
CN111833037A (en) * 2020-07-01 2020-10-27 中国建设银行股份有限公司 Account management method and device
CN112132674A (en) * 2020-09-16 2020-12-25 建信金融科技有限责任公司 Transaction processing method and device
CN112184229A (en) * 2020-10-14 2021-01-05 深圳壹账通智能科技有限公司 Block chain-based sub-account transaction processing method, system and equipment
WO2022078398A1 (en) * 2020-10-14 2022-04-21 深圳壹账通智能科技有限公司 Blockchain-based sub-account transaction processing method and system, device and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115456612A (en) * 2022-10-28 2022-12-09 深圳市小赢信息技术有限责任公司 Method, system, terminal and storage medium for keeping balance base table
CN115456612B (en) * 2022-10-28 2023-03-24 深圳市小赢信息技术有限责任公司 Accounting method, system, terminal and storage medium for balance base table

Also Published As

Publication number Publication date
CN114971611B (en) 2024-08-13

Similar Documents

Publication Publication Date Title
US11710131B2 (en) Method and apparatus of identifying a transaction risk
CN108985742B (en) Transaction processing method and device and block chain system
US20190182313A1 (en) Apparatus and method for processing blockchain transaction in distributed manner
CN106407207B (en) Real-time newly-added data updating method and device
CN110473030B (en) Block chain-based electronic bill number claiming method and device and electronic equipment
JP6388339B2 (en) Distributed caching and cache analysis
CN111147229A (en) Consensus method and device with block hash to be generated as seed and medium
US20190229931A1 (en) Distributed telephone number ledger and register
CN114971611A (en) Hotspot balance processing method and device for account, processor and electronic equipment
CN107967279A (en) The data-updating method and device of distributed data base
CN113570459A (en) Block chain data deleting method and device
CN113886135A (en) Block chain data recovery method and device
CN111611599A (en) Block chain consensus algorithm implementation method, equipment and medium
CN115456772A (en) Intelligent contract creating method and device
CN111125115A (en) Data storage method, device and medium based on block chain
CN114691732A (en) Method and device for positioning abnormal transaction, nonvolatile storage medium and processor
CN111008404A (en) Service call auditing method, equipment and medium based on block chain
CN112596959A (en) Distributed storage cluster data backup method and device
CN111191007A (en) Article keyword filtering method and device based on block chain and medium
CN112583742A (en) Message processing method and device
CN114816509A (en) Block chain version compatibility verification method and device and electronic equipment
CN114969073A (en) Wind control method and device based on block chain
CN117057799B (en) Asset data processing method, device, equipment and storage medium
CN110766546A (en) Bank account management method
CN110620703A (en) Http-based service node state determination method

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