A user balance verification method based on blockchain

By generating parallel virtual chains in the blockchain to save user balance information, and locking the user's wallet address through the time stamp of the virtual chain for balance verification, the problem of blockchain's performance degradation when verifying user balances is solved, and efficient user balance verification is achieved.

CN114612097BActive Publication Date: 2025-05-13SHENZHEN FACTORY TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210199755.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-02
Publication Date
2025-05-13
Estimated Expiration
2042-03-02

AI Technical Summary

Technical Problem

When verifying user balances, blockchain needs to visit the entire blockchain, resulting in performance degradation when there are too many blocks and it is impossible to efficiently verify user balances.

Method used

While the blockchain generates a block, a second block parallel to the block is generated to form a virtual chain parallel to the original blockchain to save the user's balance information. Lock the user's wallet address through the timestamp of the block in the virtual chain, and directly retrieve the balance information to verify whether the user's balance is sufficient.

Benefits of technology

It greatly reduces the time for user balance verification, improves the performance of blockchain, and solves the problem of blockchain performance degradation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114612097B_ABST
    Figure CN114612097B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for verifying user balance based on blockchain, which includes the following steps: while generating a block in the blockchain, generating a second block parallel to the block; all the second blocks form a virtual chain parallel to the original blockchain, wherein the second block is used to store the balance information of users; regarding the time stamp T of the block in the virtual chain k as the public wallet address corresponding to the user balance information, and as the user balance information is updated, the wallet address information of the user will be continuously updated; when verifying the user balance, directly retrieve the balance information of the wallet address corresponding to the user to check whether the user balance is sufficient; through the public wallet address of the user balance information established by the present invention, it is possible to directly query whether the user balance is sufficient by accessing the wallet address.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of blockchain, and in particular to a user balance verification method based on blockchain. Background Art

[0002] Blockchain technology is a novel ledger technology for processing and storing data. Blockchain has many advantages, such as decentralization, traceability and immutability. Decentralization means that the blockchain is not controlled by a single center, but by all nodes with accounting rights. Traceability means that a transaction through the blockchain can be traced back to the block where the user's previous transaction was located. Immutability means that the blockchain records accounts through all accounting nodes. The accounting nodes of the blockchain are widely distributed, and it is impossible for one organization or individual to have the accounting rights of a large number of blocks. The minority obeys the majority, which makes the transaction information written into the blockchain immutable.

[0003] The blockchain ledger stores the hash value corresponding to the user's transaction information. The hash value corresponding to the user's transaction information must be agreed upon by the entire network before being written into the blockchain. When the user sends the transaction information to the blockchain, the blockchain will first verify the user's signature information and user balance. The way to verify the user's balance is to retrieve all the transaction information of the user on the entire blockchain, calculate the user's balance from all the transaction information through simple addition and subtraction operations, and then determine whether the user's balance is sufficient based on the new transaction information sent by the user.

[0004] When verifying user balance transaction information, the blockchain needs to retrieve all the user's transaction information on the blockchain, that is, it needs to visit all the blocks on the entire blockchain. When there are too many blocks in the blockchain, it will take more time to search, which will inevitably lead to a decline in blockchain performance. At the same time, reducing the time for blockchain balance verification will be a key factor in improving blockchain performance. Summary of the invention

[0005] In order to overcome the problems existing in the above technologies, the present invention provides a user balance verification method based on blockchain, which includes:

[0006] When a block is generated in the blockchain, a second block is generated in parallel with the block, where the second block has the same timestamp as the original blockchain block;

[0007] All second blocks form a virtual chain parallel to the original blockchain, where the second blocks are used to store the user's balance information;

[0008] The balance information is the balance information corresponding to the user who has transaction information in the original blockchain block parallel to the second block;

[0009] The timestamp T of the block in the virtual chain k It is regarded as the public wallet address corresponding to the user's balance information. As the user's balance information is updated, the user's wallet address information will be continuously updated;

[0010] When verifying the user's balance, check whether the user's balance is sufficient by directly retrieving the balance information of the user's corresponding wallet address.

[0011] Furthermore, the generating of a second block parallel to the block while the blockchain generates a block includes: generating a new block through a consensus mechanism in a blockchain accounting cycle, and generating a second block parallel to the new block while generating the new block, that is, the block timestamp T of the block in the original blockchain and the second block corresponding to it k same.

[0012] Furthermore, all the second blocks form a virtual chain parallel to the original blockchain, including: in the process of generating blocks in the original blockchain, all the second blocks generated are linked together to form a virtual chain, and the blocks in the virtual chain are connected by a hash chain; the original blockchain is a blockchain that stores complete transaction information of users.

[0013] Furthermore, the second block is used to store the user's balance information, including: the block in the virtual chain is used to store the user's balance information, and the balance information is the balance information corresponding to the user who has transaction information in the original blockchain block parallel to the block in the virtual chain.

[0014] Furthermore, the second block used to store the user's balance information also includes: a block in the original blockchain parallel to the second block is used to store the user's complete transaction information.

[0015] Furthermore, the timestamp T of the block in the virtual chain k The public wallet address corresponding to the user balance information includes: the public wallet address refers to the timestamp T of the block in the virtual chain k It is regarded as the wallet address of all user balance information in this block.

[0016] Furthermore, as the user balance information is updated, the user's wallet address information will be continuously updated, including: as the user transaction information continues to occur, the block timestamp T corresponding to the transaction information generated by the user k The constant changes make the user balance information corresponding to the block in the virtual chain constantly updated, and the corresponding user's wallet address information constantly updated.

[0017] Furthermore, as the user balance information is updated, the user's wallet address information will be continuously updated, and also includes: the wallet address information of the user who has no transaction information in the virtual chain will remain unchanged.

[0018] Furthermore, when verifying the user's balance, directly retrieving the balance information of the user's corresponding wallet address to query whether the user's balance is sufficient includes: when it is necessary to verify the user's balance information, the block timestamp T corresponding to the user's last transaction information is used. k Lock the user's wallet address, obtain the user's balance information in the block through the wallet address, and determine whether the user's balance information is sufficient.

[0019] The beneficial effects of the present invention are:

[0020] The present invention establishes a virtual chain parallel to the original blockchain, and sets the user's public wallet address in the block on the virtual chain. When verifying the balance of transaction information sent by the user, the block timestamp T corresponding to the last transaction information of the user on the virtual chain is retrieved. k Locking the user's wallet address and obtaining the user's balance information in the block through the wallet address greatly reduces the time required for user balance verification and improves blockchain performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 : A flowchart of a blockchain-based user balance verification method.

[0022] Figure 2 : Schematic diagram of the original blockchain and virtual blockchain structure. DETAILED DESCRIPTION

[0023] The specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. It should be understood that the specific embodiments given here are only used to illustrate and explain the present invention, and cannot be used to limit the present invention.

[0024] like Figure 1 As shown: a flowchart of a user balance verification method based on blockchain; the flowchart includes the following steps: step S100, while the blockchain generates a block, a second block parallel to the block is generated, and the parallel means that the second block has the same timestamp as the original blockchain block; step S101, all second blocks form a virtual chain parallel to the original blockchain, wherein the second block is used to store the user's balance information; step S102, the balance information is the balance information corresponding to the user who has transaction information in the original blockchain block parallel to the second block; step S103, the timestamp T of the block in the virtual chain is k It is regarded as the public wallet address corresponding to the user's balance information. As the user's balance information is updated, the user's wallet address information will be continuously updated; step S104, when verifying the user's balance, directly retrieve the balance information of the user's corresponding wallet address to check whether the user's balance is sufficient.

[0025] Specifically, the method generates a second block of the new block while the original blockchain generates a new block. The second block only stores the user balance information corresponding to the original blockchain block, and all second blocks are connected through a hash chain to generate a virtual chain parallel to the original blockchain. When verifying the balance information, the public wallet address corresponding to the user's last transaction is locked by retrieving the block information of the blockchain, and the user's balance information is obtained through the wallet address to inquire whether the user's balance is sufficient.

[0026] Step S100, while the blockchain generates a block, generates a second block parallel to the block, wherein the parallel means that the timestamp of the second block is the same as that of the original blockchain block; specifically, while the blockchain generates a block, the method of generating a second block parallel to the block is as follows: in one accounting cycle of the blockchain, a new block is generated through a consensus mechanism, and while generating the new block, a second block parallel to the new block is generated, i.e., the block timestamp T of the block in the original blockchain and the second block corresponding to it is the same as that of the original blockchain. k same.

[0027] The blockchain generates blocks one by one. The time interval between two block accounting is called a blockchain cycle. A blockchain cycle includes the verification of transaction information, the selection of accountants and the writing of legal transaction information.

[0028] Preferably, the present invention generates the second block at the same time as the block on the blockchain, that is, they have a companion relationship; in one cycle, the blockchain first enters the process of selecting the bookkeeper, and when the selection of the bookkeeper is completed, the blockchain generates a new block, and at the same time as the new block is generated, the second block is activated; therefore, the block on the blockchain has the same timestamp as the block generated with it.

[0029] Step S101, all second blocks form a virtual chain parallel to the original blockchain, wherein the second block is used to store the user's balance information; specifically, the method for all second blocks to form a virtual chain parallel to the original blockchain: in the process of generating blocks in the original blockchain, all the generated second blocks are linked together to form a virtual chain, and the blocks in the virtual chain are connected by a hash chain; the original blockchain is a blockchain that stores the user's complete transaction information.

[0030] Specifically, the method of generating a virtual chain is that when a virtual chain generates a block, it is connected to the previous block on the virtual chain through a hash value. The hash chain contains the hash value of the previous block. The blocks formed in this way all contain their own hash value and the hash value of the previous block; the hash value of the previous block is also called the parent hash value; all second blocks are connected between blocks in this way to form a virtual chain parallel to the original blockchain.

[0031] The timestamp T is used between the original blockchain and the virtual chain.k Maintain the connection between the blocks on the original blockchain and the blocks on the virtual blockchain; specifically, Figure 2 The diagram is a schematic diagram of the structure of the original blockchain and the virtual blockchain. The timestamp on the original blockchain is consistent with the timestamp on the virtual blockchain, indicating that the block on the original blockchain and the second block generated by the block are in a companion relationship. The hash values ​​of the blocks with the same timestamp on the original blockchain and the virtual blockchain are different. For example, the timestamp is T 2 The original blockchain block hash value is H 2 , the hash value of the virtual blockchain block is h 2 , proving that the transaction information stored in the original blockchain block is different from that stored in the virtual blockchain block.

[0032] Step S102, the balance information is the balance information corresponding to the user who has transaction information in the original blockchain block parallel to the second block; specifically, the second block is used to save the user's balance information: the block in the virtual chain is used to save the user's balance information, and the balance information is the balance information corresponding to the user who has transaction information in the original blockchain block parallel to the block in the virtual chain.

[0033] Specifically, the second block is used to save the user's balance information: the block in the original blockchain parallel to the second block is used to save the user's complete transaction information.

[0034] Preferably, the method for the second block to store the user's balance information is divided into two categories: one is that the user's balance information is recorded on the virtual blockchain, and the other is that the user's balance information is not recorded on the virtual blockchain;

[0035] In the above embodiment, the user balance information is recorded in the virtual blockchain, and the new balance information of the user after the transaction occurs is determined by accessing the balance information of the user on the virtual chain.

[0036] In the above embodiment, if the user balance information is not recorded on the virtual blockchain, the user is a newly registered user; the user's fund information is verified through the original blockchain, and the fund information is regarded as the user's balance information and directly written into the newly formed block of the virtual blockchain.

[0037] Step S103: Timestamp T of the block in the virtual chain k As the public wallet address corresponding to the user's balance information, the user's wallet address information will be continuously updated as the user's balance information is updated; specifically, the timestamp T of the block in the virtual chain k The method of viewing it as the public wallet address corresponding to the user's balance information: the timestamp T of the block in the virtual chain k It is regarded as the wallet address of all user balance information in the block. As the blocks on the virtual chain are continuously updated, the wallet addresses of users in the new blocks are also continuously updated.

[0038] Specifically, as the user's balance information is updated, the user's wallet address information will be continuously updated: as the user's transaction information continues to occur, the block timestamp T corresponding to the user's transaction information k The constant changes make the user balance information corresponding to the block in the virtual chain constantly updated, and the corresponding user's wallet address information constantly updated.

[0039] Specifically, in a cycle on the blockchain, the balance information of the user who has made a transaction will change in this cycle, that is, the user wallet address T on the virtual chain k Change has occurred.

[0040] Specifically, in a cycle on the blockchain, the balance information of users who have not made transactions in this cycle will not change, that is, the wallet address information of users who have not made transactions in the virtual chain will remain unchanged.

[0041] Step S104, when verifying the user's balance, directly retrieve the balance information of the user's corresponding wallet address to check whether the user's balance is sufficient. Specifically, when verifying the user's balance, directly retrieve the balance information of the user's corresponding wallet address to check whether the user's balance is sufficient: when it is necessary to verify the user's balance information, the block timestamp T corresponding to the user's last transaction information is used. k Lock the user's wallet address, obtain the user's balance information in the block through the wallet address, and determine whether the user's balance information is sufficient.

[0042] Preferably, by retrieving the Merkle tree structure of the block on the virtual chain, it is retrieved whether the user has made a transaction in the corresponding original blockchain block, and by retrieving the block timestamp T corresponding to the user's last transaction information k Lock the user's wallet address, obtain the user's balance information in the block through the wallet address, and check whether the balance information is sufficient. If the balance information is sufficient, the transaction can be carried out. If the balance information is insufficient, the transaction cannot continue.

[0043] It should be understood that the above-mentioned embodiments are one or more embodiments of the present invention, and there are many other embodiments and variations thereof based on the present invention; the variations and modifications made by ordinary technicians in this industry through the present invention without making pioneering innovations all fall within the scope of protection of the present invention.

Claims

1. A user balance verification method based on blockchain, characterized in that: The method comprises the following steps: When a block is generated in the blockchain, a second block is generated in parallel with the block, where the second block has the same timestamp as the original blockchain block; All second blocks form a virtual chain parallel to the original blockchain, wherein the second block is used to store the user's balance information, and the virtual chain is a virtual blockchain; The balance information is the balance information corresponding to the user who has transaction information in the original blockchain block parallel to the second block; The timestamp T of the block in the virtual chain k As the public wallet address corresponding to the user's balance information, the user's wallet address information will be continuously updated as the user's balance information is updated; the user's wallet address information will be continuously updated including: as the user's transaction information continues to occur, the block timestamp T corresponding to the user's transaction information k The constant changes make the user balance information corresponding to the block in the virtual chain constantly updated, and the corresponding user's wallet address information constantly updated; in addition, the wallet address information of users who have not made transactions in the virtual chain will remain unchanged; When verifying the user's balance, the user's balance is checked by directly retrieving the balance information of the user's corresponding wallet address to check whether the user's balance is sufficient; the block timestamp T corresponding to the user's last transaction information is used to verify the user's balance. k Lock the user's wallet address, obtain the user's balance information in the block through the wallet address, and determine whether the user's balance information is sufficient.

2. A blockchain-based user balance verification method according to claim 1, characterized in that: The generating of a second block parallel to the block while the blockchain generates a block includes: generating a new block through a consensus mechanism in a blockchain accounting cycle, and generating a second block parallel to the new block while generating the new block, that is, the block timestamp T of the block in the original blockchain and the second block corresponding to it k same.

3. A blockchain-based user balance verification method according to claim 1, characterized in that: All the second blocks form a virtual chain parallel to the original blockchain, including: in the process of generating blocks in the original blockchain, all the generated second blocks are linked together to form a virtual chain, and the blocks in the virtual chain are connected with hash chains; the original blockchain is a blockchain that stores complete transaction information of users.

4. A blockchain-based user balance verification method according to claim 1, characterized in that: The second block is used to store the user's balance information, including: the block in the virtual chain is used to store the user's balance information, and the balance information is the balance information corresponding to the user who has transaction information in the original blockchain block parallel to the block in the virtual chain.

5. A blockchain-based user balance verification method according to claim 1, characterized in that: The second block for storing the user's balance information also includes: a block in the original blockchain parallel to the second block for storing the user's complete transaction information.

6. A blockchain-based user balance verification method according to claim 1, characterized in that: The timestamp T of the block in the virtual chain k The public wallet address corresponding to the user balance information includes: the public wallet address refers to the timestamp T of the block in the virtual chain k It is regarded as the wallet address of all user balance information in this block.

Citation Information

Patent Citations

  • Block chain extension account book technology

    CN113327110A