Blockchain-based data processing method, device and computer equipment

By recording only the block identifier of the bill information in the blockchain transaction block, the problem of excessively rapid consumption of storage resources in electronic bill transactions is solved, and efficient information retrieval and storage optimization are achieved.

CN115330365BActive Publication Date: 2026-11-06TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110507110.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-10
Publication Date
2026-11-06
Estimated Expiration
2041-05-10

AI Technical Summary

Technical Problem

In existing technologies, the redundant storage of bill information on the blockchain during electronic bill transactions leads to the problem of excessively rapid consumption of storage resources.

Method used

In the transaction block generated by the bill transaction, the bill information of the corresponding electronic bill is not recorded. Instead, only the block identifier of the block storing the bill information is recorded, so that the bill information can be obtained through the block identifier when querying.

Benefits of technology

This effectively reduces the consumption of blockchain storage resources while ensuring the efficiency and accuracy of ticket information retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115330365B_ABST
    Figure CN115330365B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data processing method and device based on a block chain and a computer device, and relate to information storage. The method comprises: obtaining target transaction information generated by a ticket transaction for an electronic ticket; obtaining block identification information of a ticket information storage block, the ticket information storage block being a block recording ticket information of the electronic ticket; and generating a target transaction block for the ticket transaction, wherein the target transaction block records the target transaction information and the block identification information. The embodiments of the present application can effectively reduce the consumption of block chain storage resources by electronic ticket transactions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and in particular to a blockchain-based data processing method, a blockchain-based data processing device, a computer device, and a computer-readable storage medium. Background Technology

[0002] With the advent of the information age, all industries are implementing informatization. Electronic invoices, as a product of "Internet+", have improved the efficiency and reduced the cost of issuing and circulating invoices, bringing great convenience to consumers, businesses, and tax authorities. The advantages of electronic invoices—cleanliness, environmental friendliness, ease of access, ease of storage, and rapid circulation—mean that traditional paper invoices will gradually be replaced by electronic invoices. However, how to effectively process electronic invoices is currently a hot research topic. Summary of the Invention

[0003] This application provides a data processing method, apparatus, and computer equipment based on blockchain, which can effectively reduce the consumption of blockchain storage resources by electronic bill transactions.

[0004] On one hand, embodiments of this application provide a data processing method based on blockchain, the method comprising:

[0005] Obtain target transaction information generated from bill transactions involving electronic bills;

[0006] Obtain the block identifier information of the bill information storage block, wherein the bill information storage block is the block that records the bill information of the electronic bill;

[0007] A target transaction block is generated for the aforementioned bill transaction, wherein the target transaction block records the target transaction information and the block identifier information.

[0008] On one hand, embodiments of this application provide a blockchain-based data processing device, the device comprising:

[0009] The acquisition unit is used to acquire target transaction information generated from bill transactions involving electronic bills.

[0010] The acquisition unit is further configured to acquire block identifier information of the bill information storage block, wherein the bill information storage block is a block that records the bill information of the electronic bill;

[0011] The processing unit is configured to generate a target transaction block for the bill transaction, wherein the target transaction block records the target transaction information and the block identifier information.

[0012] In one embodiment, the target transaction information is recorded in a first data field of the target transaction block, and the block identifier information is recorded in a second data field of the target transaction block; the first data field and the second data field are different types of data fields in the target transaction block.

[0013] In one embodiment, the processing unit is further configured to, upon receiving a bill information query request for the electronic bill, respond to the bill information query request by obtaining the block identifier information from the target transaction block;

[0014] The data processing device further includes a query unit, used to query the bill information storage block according to the block identifier information, and obtain the bill information of the electronic bill from the bill information storage block.

[0015] In one embodiment, the acquisition unit is specifically used to acquire the block identifier information of the bill information storage block from the reference transaction block, wherein the reference transaction block is the transaction block generated relative to the previous transaction of the electronic bill.

[0016] In one embodiment, the query unit is further configured to: query the bill information storage block indicated by the block identifier information obtained from the reference transaction block; if the query result indicates that the bill information storage block indicated by the block identifier information contains the bill information of the electronic bill, then trigger the processing unit to generate a target transaction block for the bill transaction.

[0017] In one embodiment, the acquisition unit is further configured to acquire historical transaction information of the electronic bill from the reference transaction block, wherein the target transaction block also records the historical transaction information.

[0018] In one embodiment, the processing unit is further configured to: add a first identifier to the target transaction block, the first identifier indicating that the electronic bill has not been traded; and add a second identifier to the reference transaction block, the second identifier indicating that the electronic bill has been traded.

[0019] On one hand, embodiments of this application provide a computer device, including: a processor, a communication interface, and a memory, wherein the processor, the communication interface, and the memory are interconnected, wherein the memory stores executable program code, and the processor is used to call the executable program code to execute the blockchain-based data processing method provided in embodiments of this application.

[0020] Accordingly, this application also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the blockchain-based data processing method provided in this application.

[0021] Accordingly, embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the blockchain-based data processing method provided in embodiments of this application.

[0022] This application embodiment, by not recording the corresponding electronic bill information in the transaction block generated for bill transactions, but only recording the block identifier of the block storing the bill information, can effectively reduce the consumption of blockchain storage resources while ensuring that the corresponding bill information can be retrieved based on the information recorded in the transaction block. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a schematic diagram of the architecture of a distributed system provided in an embodiment of this application;

[0025] Figure 2 This is a schematic diagram of the structure of a block provided in an embodiment of this application;

[0026] Figure 3 This is a schematic diagram of the architecture of a blockchain network provided in an embodiment of this application;

[0027] Figure 4 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application;

[0028] Figure 5 This application illustrates an information storage method provided by an embodiment of the present application;

[0029] Figure 6 This application illustrates another information storage method provided by an embodiment of the present application;

[0030] Figure 7This is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of this application;

[0031] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0033] To better understand the embodiments of this application, the blockchain technology involved in the embodiments of this application will be introduced below.

[0034] Blockchain (or blockchain chain) is a chain of linked text records (also known as blocks) that uses cryptography to connect and protect content. Each block contains the cryptographic hash of the previous block, a corresponding timestamp, and transaction data (usually represented by a hash value calculated using a Merkle tree algorithm). This design makes the block content difficult to tamper with. The distributed ledger linked by blockchain technology allows two parties to effectively record transactions and permanently verify these transactions.

[0035] A blockchain network is a distributed system that can be formed by multiple nodes (any form of computing device connected to the network, such as servers or user terminals) connected through network communication. See also Figure 1 This is a schematic diagram of an optional architecture for a distributed system applied to a blockchain network, as provided in this application embodiment. The blockchain network consists of multiple nodes forming a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In the blockchain network, any machine, such as a server or terminal, can join and become a node. A node includes a hardware layer, a middleware layer, an operating system layer, and an application layer.

[0036] See Figure 1 The functions of each node in the blockchain network shown include:

[0037] 1) Routing: A basic function of nodes used to support communication between nodes.

[0038] In addition to routing capabilities, nodes can also have the following functions:

[0039] 2) A blockchain consists of a series of blocks that are sequentially generated. Once a new block is added to the blockchain, it will not be removed. The blocks record the data submitted by the nodes in the blockchain network, such as transaction data.

[0040] See Figure 2 This is an optional schematic diagram of the block structure provided in this application embodiment. Each block includes the hash value of the data record stored in this block (the hash value of this block) and the hash value of the previous block. The blocks are connected through their hash values ​​to form a blockchain. Additionally, the block may include information such as a timestamp when it was generated. A blockchain, in essence, is a decentralized database, a chain of data blocks linked using cryptographic methods. Each data block contains relevant information used to verify the validity of the information (anti-counterfeiting) and to generate the next block.

[0041] 3) Applications are deployed in the blockchain to implement specific business needs. They record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain network. When other nodes successfully verify the source and integrity of the record data, they add the record data to a temporary block.

[0042] For example, the business logic implemented by the application includes:

[0043] 3.1) A wallet is used to provide the function of trading virtual resources, including initiating a transaction, which means sending the transaction record of the current transaction to other nodes in the blockchain network. After the other nodes successfully verify the transaction, they store the transaction record data in a temporary block of the blockchain as a response to acknowledge the validity of the transaction.

[0044] 3.2) Shared ledger, used to provide functions such as storage, query and modification of ledger data. It sends the record data of the operation on the ledger data to other nodes in the blockchain network. After the other nodes verify the validity, as a response to acknowledge the validity of the ledger data, they store the record data in a temporary block. It can also send confirmation to the node that initiated the operation.

[0045] 3.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented through code deployed on a shared ledger that executes when certain conditions are met. Based on actual business needs, the code is used to complete automated transactions, such as querying the logistics status of goods purchased by a buyer and transferring the buyer's virtual resources to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions; they can also execute contracts for processing received information.

[0046] 4) Consensus is used to solve and ensure the consistency and correctness of every transaction or data across all ledger nodes. The consensus mechanism of a blockchain determines how to reach and maintain that consensus. This mechanism enables blockchain to operate on a large scale and efficiently without relying on a centralized organization.

[0047] After an electronic invoice is generated, it is typically used for transactions, such as for reimbursement. To facilitate the retrieval of invoice information (such as amount, invoice code, invoice date, etc.), the invoice information can be recorded in the transaction block generated for each blockchain-based electronic invoice transaction. However, if there are many electronic invoice transactions, recording the invoice information in the transaction block for each transaction would result in redundant storage of invoice information, leading to rapid consumption of blockchain storage resources.

[0048] Based on this, embodiments of this application provide a blockchain-based data processing method to effectively reduce the consumption of blockchain storage resources by electronic invoice transactions. This data processing method is applicable to... Figure 3 In the blockchain network shown, the nodes in the blockchain network include consensus nodes (such as...) Figure 3 Consensus nodes a, b, c) and other types of nodes (such as consensus ... Figure 3(Node x in the blockchain). A consensus node is a node in a blockchain network that has block-producing and consensus functions, and can be a full node storing the complete blockchain. Consensus nodes and other types of nodes can be computer devices such as terminals or servers. Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms, etc. Terminals can be smartphones (such as Android phones, iOS phones, etc.), tablets, laptops, desktop computers, smart speakers, smartwatches, etc., but are not limited to these. Nodes can be directly or indirectly connected through wired or wireless communication, which is not limited in this application.

[0049] The blockchain-based data processing method provided in this application embodiment can be derived from... Figure 3 The data processing method, executed by any consensus node in the blockchain network shown, does not record the corresponding electronic bill information in the transaction block generated for the bill transaction, but only records the block identifier of the block storing the bill information. This effectively reduces the consumption of blockchain storage resources while ensuring that the corresponding bill information can be retrieved based on the information recorded in the transaction block.

[0050] The following provides a detailed description of the blockchain-based data processing method provided in the embodiments of this application. Please refer to... Figure 4 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application. This data processing method can be executed by consensus nodes in a blockchain network, and includes, but is not limited to, the following steps:

[0051] S401. Obtain target transaction information generated from bill transactions for electronic bills.

[0052] In this embodiment, the bill transaction refers to the transaction of electronic bills, including bill transfer, bill receipt, etc. The target transaction information includes the bill transaction type, bill source, bill transfer information, transaction result, etc. In a blockchain, each transaction requires one input and produces one output. A bill transaction for an electronic bill can be viewed as data processing. The input data includes relevant historical data of the electronic bill. The input data is processed according to the bill transaction to be executed, resulting in output data. The input data can be the output data generated from the previous transaction for the same electronic bill relative to the current transaction.

[0053] In one feasible implementation, the consensus node executing the data processing method provided in this application embodiment may conduct a bill transaction for the electronic bill, thereby directly obtaining the target transaction information generated by the bill transaction. In another feasible implementation, the consensus node executing the data processing method provided in this application embodiment may obtain the target transaction information generated by the bill transaction from other nodes in the blockchain network responsible for conducting bill transactions for the electronic bill.

[0054] S402. Obtain the block identifier information of the bill information storage block, wherein the bill information storage block is the block that records the bill information of the electronic bill.

[0055] In this embodiment of the application, the bill information storage block can be stored on the blockchain and records the bill information of the electronic bill. The block identification information includes the hash value corresponding to the bill information storage block.

[0056] The invoice information includes the invoice's face information, which includes, but is not limited to, invoice identification (including invoice code, invoice number, invoice verification code, and other information that can uniquely identify the electronic invoice), invoice issuance time, resource quantity (such as transaction amount), transaction counterparty (such as buyer, seller), etc. In one embodiment, the electronic invoice can be an electronic invoice, and the invoice information of the electronic invoice may further include: the buyer's name, taxpayer identification number, address, telephone number, bank and account number; the seller's name, taxpayer identification number, address, telephone number, bank and account number; tax rate; tax amount; payee; reviewer; and invoice issuer, among one or more of these.

[0057] The bill information storage block can be a block generated during the electronic bill generation stage. In one feasible implementation, electronic bill generation can also be viewed as a transaction, and the bill information storage block can be an initial transaction block generated for the electronic bill generation transaction. In this case, the initial transaction block records both the transaction information related to the electronic bill generation transaction and the bill information of the generated electronic bill. In another feasible implementation, the bill information storage block can also be a block specifically generated outside of the initial transaction block to record the bill information of the electronic bill. In this case, the initial transaction block can record the block identifier information of the bill information storage block.

[0058] In one embodiment, since the transaction block generated for a bill transaction in this application does not record the bill information of the corresponding electronic bill, but only records the block identifier of the block storing the bill information, when obtaining the block identifier information of the bill information storage block, it can be obtained from a reference transaction block. This reference transaction block is the transaction block generated from the previous transaction for the same electronic bill relative to the current bill transaction. Querying the block identifier information of the bill information storage block from the transaction block generated from the previous bill transaction can reduce the number of information queries and improve information query efficiency. It should be noted that the block identifier information of the bill information storage block can also be obtained from transaction blocks generated from other bill transactions (bill transactions for the same electronic bill) prior to the current bill transaction.

[0059] In a feasible implementation, after obtaining the block identifier information from the reference transaction block, the system first queries the bill information storage block indicated by the block identifier information. If the query result indicates that the bill information storage block indicated by the block identifier information contains the bill information of the electronic bill, then step S403 is executed. Conversely, if the query result indicates that the bill information storage block indicated by the block identifier information does not contain the bill information of the electronic bill, then the system queries the initial transaction block generated by the exchange that generated the electronic bill to obtain the correct block identifier of the bill information storage block. By using the above method, it can be ensured that the obtained and subsequently recorded bill information storage block identifier is correct.

[0060] S403. Generate a target transaction block for the bill transaction, wherein the target transaction block records the target transaction information and the block identifier information.

[0061] In this embodiment, the block identifier information of the bill information storage block is recorded in the target transaction block so that when it is necessary to query the bill information of the electronic bill later, the block identifier information can be obtained from the target transaction block, and then the bill information of the electronic bill can be obtained from the bill information storage block indicated by the block identifier information. Recording the target transaction information in the target transaction block can realize transaction notarization and facilitate querying the transaction status of the electronic bill.

[0062] In one embodiment, the target transaction information is recorded in a first data field of the target transaction block, and the block identifier information is recorded in a second data field of the target transaction block. The first and second data fields are different types of data fields in the target transaction block. In feasible implementations, the first data field can be a business data field (or a data field), that is, a data field that can be adjusted (e.g., adding or deleting transaction information); the second data field can be a metadata field (or a meta data field), that is, a data field that cannot be adjusted. By storing the transaction information and block identifier information in different types of data fields, it is beneficial to quickly obtain the transaction information or block identifier information from the transaction block.

[0063] In one embodiment, to facilitate subsequent querying of historical transaction information for electronic bills, this embodiment records, in addition to the block identifier of the block storing the corresponding bill information, historical transaction information and current transaction information of the electronic bill in the transaction block generated for the bill transaction. Based on this, historical transaction information of the electronic bill can be obtained from the reference transaction block (the transaction block generated from the previous transaction of the electronic bill relative to the current bill transaction), and this historical transaction information, along with the target transaction information generated by the current bill transaction, is recorded in the target transaction block generated for the current bill transaction. Both the historical transaction information and the target transaction information can be recorded in the first data field of the target transaction block. It should be noted that historical transaction information can refer to the transaction information generated by every bill transaction prior to the current bill transaction.

[0064] In one embodiment, after the current transaction of the electronic bill is completed, the target transaction block generated for the current bill transaction records the latest relevant data of the electronic bill, including the latest transaction information, etc. At this time, a first identifier can be added to the target transaction block to indicate that the electronic bill recorded therehas not been traded, that is, to indicate that the latest relevant data of the electronic bill has been recorded. The first identifier may include the bill identifier (such as the bill code) and the untraded identifier (such as 0) of the electronic bill. Since the latest relevant data of the electronic bill is recorded in the target transaction block, the relevant data of the electronic bill recorded in the reference transaction block becomes historical data. At this time, a second identifier can be added to the reference transaction block to indicate that the electronic bill recorded therehas been traded, that is, to indicate that it records the historical relevant data of the electronic bill. This can be done by adjusting the original first identifier of the reference transaction block to the second identifier, or by adding the second identifier while retaining the original first identifier. The second identifier may include the bill identifier (such as the bill code) and the traded identifier (such as 1) of the electronic bill. The above method adds different identifiers to transaction blocks, which facilitates quick retrieval of transaction blocks that record the latest relevant data of electronic invoices.

[0065] In this embodiment, after generating the target transaction block, the target transaction block is broadcast to each consensus node in the blockchain network, enabling the consensus nodes to reach a consensus on the target transaction block. After the consensus on the target transaction block is passed, each consensus node uploads the target transaction block to the blockchain. When a node in the blockchain network receives a query request for the electronic invoice's information, it responds by querying the target transaction block on the blockchain and obtaining the block identifier information of the corresponding invoice information storage block from the target transaction block; based on the block identifier information, it then queries the invoice information storage block on the blockchain to obtain the invoice information of the electronic invoice from the invoice information storage block.

[0066] This application embodiment, by not recording the corresponding electronic bill information in the transaction block generated for bill transactions, but only recording the block identifier of the block storing the bill information, can effectively reduce the consumption of blockchain storage resources while ensuring that the corresponding bill information can be retrieved based on the information recorded in the transaction block.

[0067] The following example uses the data processing method provided in the embodiments of this application combined with UTXO technology, and combines it with Figure 5 and Figure 6Let me explain. UTXO stands for Unspent Transaction Output, which is the most basic unit of a transaction. Every transaction consumes one input and produces one output, and the output it produces is the "unspent transaction output".

[0068] Blockchain-based electronic invoices can utilize UTXOs for the generation and management of invoice assets. For example... Figure 5 and Figure 6 As shown, whenever a new electronic bill is created, a new UTXO asset is generated. If the electronic bill is transferred (corresponding to the bill transaction mentioned above), the UTXO of the electronic bill is set as input and used as STXO (spent transaction output), and a new UTXO is generated as the identifier of the transferred bill asset.

[0069] During each UTXO generation stage, the following can be adopted: Figure 5 The information storage method shown stores both the ticket face information (corresponding to the ticket information mentioned earlier) and the ticket circulation information (corresponding to the transaction information mentioned earlier). Specifically, the ticket face information is stored in the meta field of the corresponding transaction block, and the ticket circulation information is stored in the data field of the generated UTXO. Each electronic ticket involves multiple stages, including issuance, circulation, and receipt. Each stage generates a new UTXO, requiring the copying of the ticket face information stored in the meta field of the previous transaction block, as well as the copying of the ticket circulation information stored in the data field of the previous UTXO. Using this information storage method, users only need to query the specified transaction block and UTXO information they own to obtain the full information of the corresponding electronic ticket, simplifying the information query operation. However, since the ticket face information of an electronic ticket is immutable, if an electronic ticket circulates many times, the ticket face information needs to be redundantly stored multiple times, which will accelerate the consumption of blockchain storage resources.

[0070] Therefore, to reduce the consumption of blockchain storage resources, the following methods can be adopted during the generation and circulation management of bill assets: Figure 6 The information storage method shown is to record the face value of the electronic ticket only in the meta field of the initial transaction block generated during the electronic ticket generation stage. In the subsequent UTXO generation stage, the ticket circulation information is stored through the data field of the generated UTXO. The face value of the electronic ticket is not stored in the meta field of the corresponding transaction block, but only the block identifier of the initial transaction block generated during the electronic ticket generation stage is stored. This allows the face value of the electronic ticket to be recorded indirectly, and also reduces the amount of data stored.

[0071] During the process of querying the face value of an electronic bill, the block identifier of the initial transaction block generated during the generation stage of the electronic bill is obtained from the latest transaction block of the electronic bill. By querying the initial transaction block based on the block identifier, the face value of the electronic bill can be obtained.

[0072] Figure 6 The information storage method shown is relatively Figure 5 The method of recording the ticket information for each transaction has been optimized. By not recording the ticket information but only recording the index of the initial transaction block (which records the ticket information), redundant recording of ticket information generated in the electronic ticket circulation process can be reduced, thereby effectively saving the blockchain storage resources consumed by blockchain electronic invoices.

[0073] Please see Figure 7 , Figure 7 This is a schematic diagram of a blockchain-based data processing device provided in an embodiment of this application. The data processing device described in this embodiment corresponds to a consensus node executing the data processing method described above. The data processing device includes an acquisition unit 701, a processing unit 702, and a query unit 703. Wherein:

[0074] The acquisition unit 701 is used to acquire target transaction information generated by bill transactions for electronic bills;

[0075] The acquisition unit 701 is further configured to acquire block identifier information of the bill information storage block, wherein the bill information storage block is a block that records the bill information of the electronic bill;

[0076] Processing unit 702 is used to generate a target transaction block for the bill transaction, wherein the target transaction block records the target transaction information and the block identifier information.

[0077] In one embodiment, the target transaction information is recorded in a first data field of the target transaction block, and the block identifier information is recorded in a second data field of the target transaction block; the first data field and the second data field are different types of data fields in the target transaction block.

[0078] In one embodiment, the processing unit 702 is further configured to, upon receiving a bill information query request for the electronic bill, respond to the bill information query request by obtaining the block identifier information from the target transaction block;

[0079] The data processing device further includes a query unit 703, used to query the bill information storage block according to the block identifier information, and obtain the bill information of the electronic bill from the bill information storage block.

[0080] In one embodiment, the acquisition unit 701 is specifically used to acquire the block identifier information of the bill information storage block from the reference transaction block, wherein the reference transaction block is the transaction block generated relative to the previous transaction of the electronic bill.

[0081] In one embodiment, the query unit 703 is further configured to: query the bill information storage block indicated by the block identifier information obtained from the reference transaction block; if the query result indicates that the bill information storage block indicated by the block identifier information contains the bill information of the electronic bill, then trigger the processing unit 702 to generate a target transaction block for the bill transaction.

[0082] In one embodiment, the acquisition unit 701 is further configured to acquire historical transaction information of the electronic bill from the reference transaction block, wherein the historical transaction information is also recorded in the target transaction block.

[0083] In one embodiment, the processing unit 702 is further configured to: add a first identifier to the target transaction block, the first identifier being used to indicate that the electronic bill has not been traded; and add a second identifier to the reference transaction block, the second identifier being used to indicate that the electronic bill has been traded.

[0084] It is understood that the functions of each functional unit of the data processing device provided in the embodiments of this application can be specifically implemented according to the methods in the above method embodiments, and the specific implementation process can be referred to the relevant descriptions in the above method embodiments, which will not be repeated here.

[0085] This application embodiment, by not recording the corresponding electronic bill information in the transaction block generated for bill transactions, but only recording the block identifier of the block storing the bill information, can effectively reduce the consumption of blockchain storage resources while ensuring that the corresponding bill information can be retrieved based on the information recorded in the transaction block.

[0086] Please see Figure 8 , Figure 8 This is a schematic diagram of a computer device provided in an embodiment of this application. The computer device described in this embodiment corresponds to a consensus node that executes the data processing method described above, and includes: a processor 801, a communication interface 802, and a memory 803. The processor 801, communication interface 802, and memory 803 can be connected via a bus or other means; this embodiment uses a bus connection as an example.

[0087] The processor 801 (or CPU, Central Processing Unit) is the computing and control core of the computer device. It can parse various instructions and process various data within the computer device. For example, the CPU can parse power-on / off commands sent by the user and control the computer device to perform power-on / off operations; it can also transmit various interactive data between internal structures of the computer device. The communication interface 802 may optionally include standard wired interfaces or wireless interfaces (such as Wi-Fi, mobile communication interfaces, etc.), and is controlled by the processor 801 for sending and receiving data. The memory 803 is the storage device in the computer device, used to store programs and data. It is understood that the memory 803 here can include the computer device's built-in memory, or it can include extended memory supported by the computer device. The memory 803 provides storage space for the computer device's operating system, which may include, but is not limited to, Android, iOS, Windows Phone, etc., and this application does not limit this.

[0088] In this embodiment of the application, the processor 801 performs the following operations by running the executable program code in the memory 803:

[0089] Obtain target transaction information generated from bill transactions for electronic bills; obtain block identifier information of a bill information storage block, wherein the bill information storage block is a block that records the bill information of the electronic bill; generate a target transaction block for the bill transaction, wherein the target transaction block records the target transaction information and the block identifier information.

[0090] In one embodiment, the processor 801 can obtain the target transaction information generated by the electronic bill transaction from other nodes in the blockchain network that are responsible for bill transactions for electronic bills through the communication interface 802.

[0091] In one embodiment, the target transaction information is recorded in a first data field of the target transaction block, and the block identifier information is recorded in a second data field of the target transaction block; the first data field and the second data field are different types of data fields in the target transaction block.

[0092] In one embodiment, the processor 801 is further configured to: upon receiving a bill information query request for the electronic bill through the communication interface 802, respond to the bill information query request by obtaining the block identifier information from the target transaction block; query the bill information storage block according to the block identifier information, and obtain the bill information of the electronic bill from the bill information storage block.

[0093] In one embodiment, when the processor 801 obtains the block identifier information of the bill information storage block, it is specifically used to: obtain the block identifier information of the bill information storage block from the reference transaction block, wherein the reference transaction block is the transaction block generated relative to the previous transaction for the electronic bill.

[0094] In one embodiment, the processor 801 is further configured to: query the bill information storage block indicated by the block identifier information obtained from the reference transaction block; if the query result indicates that the bill information storage block indicated by the block identifier information contains the bill information of the electronic bill, then generate a target transaction block for the bill transaction.

[0095] In one embodiment, the processor 801 is further configured to: obtain historical transaction information of the electronic bill from the reference transaction block, wherein the historical transaction information is also recorded in the target transaction block.

[0096] In one embodiment, the processor 801 is further configured to: add a first identifier to the target transaction block, the first identifier indicating that the electronic bill has not been traded; and add a second identifier to the reference transaction block, the second identifier indicating that the electronic bill has been traded.

[0097] In specific implementations, the processor 801, communication interface 802, and memory 803 described in the embodiments of this application can execute the implementation methods described in the blockchain-based data processing method provided in the embodiments of this application, or they can execute the implementation methods described in the blockchain-based data processing device provided in the embodiments of this application, which will not be repeated here.

[0098] This application embodiment, by not recording the corresponding electronic bill information in the transaction block generated for bill transactions, but only recording the block identifier of the block storing the bill information, can effectively reduce the consumption of blockchain storage resources while ensuring that the corresponding bill information can be retrieved based on the information recorded in the transaction block.

[0099] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute the blockchain-based data processing method provided in this application. The specific implementation can be found in the foregoing description and will not be repeated here.

[0100] This application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the blockchain-based data processing method provided in this application. Specific implementation details can be found in the preceding description and will not be repeated here.

[0101] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0102] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0103] The above-disclosed embodiments are only some of the embodiments of this application, and should not be construed as limiting the scope of this application. Therefore, any equivalent changes made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A data processing method based on blockchain, characterized in that, The method includes: Obtain target transaction information generated from bill transactions involving electronic bills; Obtain the block identifier information of the bill information storage block from the reference transaction block. The bill information storage block is a block that records the bill information of the electronic bill. The reference transaction block is a transaction block generated relative to the previous transaction of the electronic bill. A target transaction block is generated for the bill transaction, wherein the target transaction information is recorded in the first data field of the target transaction block, and the block identification information is recorded in the second data field of the target transaction block. The first data field and the second data field are different types of data fields in the target transaction block.

2. The method as described in claim 1, characterized in that, The method further includes: Upon receiving a bill information query request for the electronic bill, the system responds to the bill information query request by retrieving the block identifier information from the target transaction block; The electronic invoice information is retrieved from the invoice information storage block by querying the block identifier information.

3. The method as described in claim 1 or 2, characterized in that, The method further includes: Based on the block identifier information obtained from the reference transaction block, query the bill information storage block indicated by the block identifier information; If the query result indicates that the electronic bill information is recorded in the bill information storage block indicated by the block identifier information, then the step of generating a target transaction block for the bill transaction is executed.

4. The method as described in claim 1 or 2, characterized in that, The method further includes: The historical transaction information of the electronic bill is obtained from the reference transaction block, wherein the historical transaction information is also recorded in the target transaction block.

5. The method as described in claim 1 or 2, characterized in that, The method further includes: Add a first identifier to the target transaction block, the first identifier being used to indicate that the electronic ticket has not been traded; A second identifier is added to the reference transaction block, the second identifier being used to indicate that the electronic ticket has been traded.

6. A data processing device based on blockchain, characterized in that, The device includes: The acquisition unit is used to acquire target transaction information generated from bill transactions involving electronic bills. The acquisition unit is further configured to acquire the block identifier information of the bill information storage block from the reference transaction block, wherein the bill information storage block is a block that records the bill information of the electronic bill, and the reference transaction block is a transaction block generated relative to the previous transaction for the electronic bill. The processing unit is configured to generate a target transaction block for the bill transaction, wherein the target transaction information is recorded in a first data field of the target transaction block, and the block identification information is recorded in a second data field of the target transaction block, wherein the first data field and the second data field are different types of data fields in the target transaction block.

7. A computer device, characterized in that, include: The processor, the communication interface, and the memory are interconnected, wherein the memory stores executable program code, and the processor is used to call the executable program code to execute the blockchain-based data processing method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the blockchain-based data processing method as described in any one of claims 1-5.

9. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the blockchain-based data processing method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Bill processing method and device based on blockchain network and related equipment

    CN111311277A

  • Electronic bill processing method and device, medium and electronic equipment

    CN112434114A