CN115330365A - Data processing method and device based on block chain and computer equipment - Google Patents

Data processing method and device based on block chain and computer equipment Download PDF

Info

Publication number
CN115330365A
CN115330365A CN202110507110.7A CN202110507110A CN115330365A CN 115330365 A CN115330365 A CN 115330365A CN 202110507110 A CN202110507110 A CN 202110507110A CN 115330365 A CN115330365 A CN 115330365A
Authority
CN
China
Prior art keywords
block
bill
transaction
information
electronic
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.)
Pending
Application number
CN202110507110.7A
Other languages
Chinese (zh)
Inventor
莫洋
郭懿心
韦德志
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110507110.7A priority Critical patent/CN115330365A/en
Publication of CN115330365A publication Critical patent/CN115330365A/en
Pending legal-status Critical Current

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/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification

Abstract

The embodiment of the application provides a data processing method, a data processing device and computer equipment based on a block chain, and relates to information storage, wherein the method comprises the following steps: acquiring target transaction information generated by performing bill transaction on the electronic bill; acquiring block identification information of a bill information storage block, wherein the bill information storage block is a block for recording bill information of the electronic bill; and generating a target transaction block aiming at the bill transaction, wherein the target transaction information and the block identification information are recorded in the target transaction block. By the method and the device, consumption of the block chain storage resources in electronic bill transaction can be effectively reduced.

Description

Data processing method and device based on block chain and computer equipment
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a data processing method based on a block chain, a data processing apparatus based on a block chain, a computer device, and a computer-readable storage medium.
Background
With the advent of the information age, all industries are implementing informatization. The electronic bill is used as an internet plus product, so that the efficiency of making bills and bill circulation is improved, the cost of making bills and bill circulation is reduced, and great convenience is brought to consumers, enterprises and tax authorities; the electronic bill has the advantages of cleanness, environmental protection, convenient acquisition, easy storage and quick circulation, so that the traditional paper bill can be gradually replaced by the electronic bill. How to realize the processing of electronic bills is a research hotspot at present.
Disclosure of Invention
The embodiment of the application provides a data processing method and device based on a block chain and computer equipment, which can effectively reduce consumption of block chain storage resources in electronic bill transaction.
In one aspect, an embodiment of the present application provides a data processing method based on a block chain, where the method includes:
acquiring target transaction information generated by performing bill transaction on the electronic bill;
acquiring block identification information of a bill information storage block, wherein the bill information storage block is a block for recording bill information of the electronic bill;
and generating a target transaction block aiming at the bill transaction, wherein the target transaction information and the block identification information are recorded in the target transaction block.
In one aspect, an embodiment of the present application provides a data processing apparatus based on a block chain, where the apparatus includes:
the acquisition unit is used for acquiring target transaction information generated by performing bill transaction on the electronic bill;
the acquisition unit is further used for acquiring block identification information of a bill information storage block, wherein the bill information storage block is a block for recording the bill information of the electronic bill;
and the processing unit is used for generating a target transaction block aiming at the bill transaction, wherein the target transaction information and the block identification information are recorded in the target transaction block.
In one embodiment, 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; the first data field and the second data field are different types of data fields in the target transaction block.
In an embodiment, the processing unit is further configured to, when receiving a ticket information query request for the electronic ticket, obtain the block identification information from the target transaction block in response to the ticket information query request;
the data processing device also comprises a query unit which is used for querying the bill information storage block according to the block identification information and acquiring the bill information of the electronic bill from the bill information storage block.
In an embodiment, the obtaining unit is specifically configured to obtain the block identification information of the ticket information storage block from a reference transaction block, where the reference transaction block is a transaction block generated by performing a transaction on the electronic ticket last time with respect to a current ticket transaction.
In an embodiment, the query unit is further configured to: inquiring a bill information storage block indicated by the block identification information according to the block identification information acquired from the reference transaction block; and if the query result indicates that the bill information of the electronic bill is recorded in the bill information storage block indicated by the block identification information, triggering the processing unit to generate a target transaction block for the bill transaction.
In an embodiment, the obtaining unit is further configured to obtain historical transaction information of the electronic ticket from the reference transaction block, where the historical transaction information is further recorded in the target transaction block.
In an embodiment, the processing unit is further configured to: adding a first identifier to the target trading block, wherein the first identifier is used for indicating that the electronic bill is not traded; and adding a second identifier to the reference trading block, wherein the second identifier is used for indicating that the electronic bill is traded.
In one aspect, an embodiment of the present application provides a computer device, including: the data processing system comprises a processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are connected with each other, executable program codes are stored in the memory, and the processor is used for calling the executable program codes and executing the data processing method based on the block chain provided by the embodiment of the application.
Accordingly, an embodiment of the present application further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the computer is caused to execute the data processing method based on the blockchain provided in the embodiment of the present application.
Accordingly, embodiments of the present application also provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, so that the computer device executes the data processing method based on the blockchain provided by the embodiment of the application.
According to the method and the device, the bill information of the corresponding electronic bill is not recorded in the transaction block generated aiming at the bill transaction, and only the block identification of the block in which the bill information is stored is recorded, so that the consumption of block chain storage resources is effectively reduced on the basis of ensuring that the corresponding bill information can be inquired based on the information recorded in the transaction block.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic architecture diagram of a distributed system according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a block according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram illustrating a block chain network according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a data processing method based on a block chain according to an embodiment of the present application;
FIG. 5 shows an information storage method provided by an embodiment of the present application;
FIG. 6 illustrates another information storage method provided by an embodiment of the present application;
fig. 7 is a schematic structural diagram of a data processing apparatus based on a block chain according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
For better understanding of the embodiments of the present application, the block chain technology related to the embodiments of the present application will be described below.
Block chains: block or block chain is a concatenated text record (also called block) that is cryptographically concatenated and protects content. Each chunk contains the cryptographic hash of the previous chunk, the corresponding time stamp, and transaction data (represented by the hash values typically computed using the merkel tree algorithm), such a design makes the contents of the chunk tamper-resistant. The distributed account book concatenated by the block chain technology can effectively record the transaction by two parties and permanently check the transaction.
A blockchain network is a distributed system that can be formed by a plurality of nodes (any form of computing device in an access network, such as servers, user terminals) connected in a network communication manner. Referring to fig. 1, it is a schematic diagram of an alternative architecture of a distributed system applied to a blockchain network according to an embodiment of the present application. The block chain network is formed by a plurality of nodes, a point-To-point (P2P) network is formed by the nodes, and the P2P Protocol is an application layer Protocol operating on a Transmission Control Protocol (TCP). In a blockchain network, any machine such as a server or a terminal can be added to become a node, and the node comprises a hardware layer, a middle layer, an operating system layer and an application layer.
Referring to the functions of each node in the blockchain network shown in fig. 1, the functions involved include:
1) Routing, the basic function a node has for supporting communication between nodes.
Besides the routing function, the node may also have the following functions:
2) The Block chain comprises a series of blocks (blocks) which are connected with each other according to the generated chronological order, new blocks cannot be removed once being added into the Block chain, and recorded data submitted by nodes in the Block chain network, such as transaction data and the like, are recorded in the blocks.
Referring to fig. 2, which is an optional schematic diagram of a Block Structure (Block Structure) provided in the embodiment of the present application, each Block includes a hash value of a data record stored in the Block (hash value of the Block) and a hash value of a previous Block, and the blocks are connected by the hash values to form a Block chain (Block chain). The block may also include information such as a time stamp at the time of block generation. A blockchain, which is essentially a decentralized database, is a string of data blocks associated using cryptography, each data block containing relevant information for verifying the validity of the information (anti-counterfeiting) and generating the next block.
3) The application is used for being deployed in a block chain, realizing specific services according to actual service requirements, recording data related to the realization functions to form recorded data, carrying a digital signature in the recorded data to represent a source of task data, and sending the recorded data to other nodes in the block chain network, so that the recorded data is added to a temporary block when the other nodes verify the source and the integrity of the recorded data successfully.
For example, the services implemented by the application include:
3.1 Wallet) for providing the function of transaction of virtual resources, which includes initiating transaction, that is, sending the transaction record of the current transaction to other nodes in the blockchain network, and after the other nodes successfully verify the transaction, storing the record data of the transaction in a temporary block of the blockchain as a response for confirming that the transaction is valid.
3.2 Shared account book, which is used for providing functions of operations such as storage, query and modification of account data, sending record data of the operations on the account data to other nodes in the block chain network, and after the other nodes verify that the record data is valid, storing the record data into a temporary block as a response for acknowledging that the account data is valid, and also sending confirmation to the node initiating the operations.
3.3 Intelligent contracts, computerized agreements) that can enforce the terms of a contract, implemented by code deployed on a shared ledger for execution when certain conditions are met, for completing automated transactions according to actual business requirement code, e.g. querying the logistic status of goods purchased by a buyer, transferring virtual resources of the buyer to the address of a merchant after the buyer signs for goods; of course, smart contracts are not limited to executing contracts for trading, but may also execute contracts that process received information.
4) And the consensus is used for solving and ensuring the consistency and correctness of each transaction or data on all accounting nodes. The consensus mechanism of blockchains is the way to determine a certain consensus and maintain consensus. The consensus mechanism of the block chain enables the block chain to still cooperate and complete the operation efficiently in a large scale without depending on centralized organization.
After the electronic ticket is generated, a transaction is also typically conducted with respect to the electronic ticket, such as reimbursement with the electronic ticket, and so on. To facilitate querying of the ticket information (e.g., amount, ticket code, time of billing, etc.) of the electronic ticket, for each transaction of the electronic ticket implemented based on the blockchain, the ticket information of the corresponding electronic ticket may be recorded in a transaction block generated for the ticket transaction. However, if the transaction frequency of the electronic bill is large, and the bill information of the corresponding electronic bill is recorded in the transaction block generated for the bill transaction each time, the problem that the block chain storage resource is consumed too fast due to multiple redundant storage of the bill information exists.
Based on this, the embodiment of the application provides a data processing method based on a blockchain, so as to effectively reduce consumption of blockchain storage resources for electronic bill transaction. The data processing method is applicable to the blockchain network shown in fig. 3, and the nodes in the blockchain network include common nodes (such as common nodes a, b, and c in fig. 3) and other types of nodes (such as node x in fig. 3). The consensus node is a node having a block output function and a consensus function in the blockchain network, and may be a full node storing a complete blockchain in the blockchain network. The consensus node and other types of nodes may be computer devices such as terminals or servers. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN, and a big data and artificial intelligence platform. The terminal may be a smart phone (such as an Android phone, an iOS phone, and the like), a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, and the like, but is not limited thereto. The nodes may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
The data processing method based on the block chain provided by the embodiment of the application can be executed by any common identification node in the block chain network shown in fig. 3, and the data processing method only records the block identification of the block in which the bill information is stored by not recording the bill information of the corresponding electronic bill in the transaction block generated aiming at the bill transaction, so that the consumption of the storage resource of the block chain can be effectively reduced on the basis of ensuring that the information recorded based on the transaction block can be inquired about the corresponding bill information.
The data processing method based on the block chain provided in the embodiment of the present application is described in detail below. Please refer to fig. 4, which is a flowchart illustrating a data processing method based on a block chain according to an embodiment of the present application. The data processing method can be executed by a consensus node in a blockchain network, and includes but is not limited to the following steps:
s401, target transaction information generated by performing bill transaction on the electronic bill is acquired.
In the embodiment of the application, the bill transaction is a transaction aiming at the electronic bill, and comprises bill circulation, bill collection and the like. The target transaction information includes the type of the ticket transaction, the source of the ticket, the ticket transfer information, the transaction result, etc. In the block chain, each transaction costs one input to generate one output, the bill transaction performed on the electronic bill can be regarded as a kind of data processing, the input data includes the related historical data of the electronic bill, and the input data is processed according to the bill transaction to be executed currently to obtain the output data. The input data may be output data generated from a previous transaction for the electronic instrument with respect to the current instrument transaction.
In a possible implementation manner, the consensus node executing the data processing method provided by the embodiment of the present application may perform a ticket transaction on an electronic ticket, so as to directly obtain target transaction information generated by the ticket transaction. In another possible implementation manner, the consensus node executing the data processing method provided by the embodiment of the present application may obtain target transaction information generated by a ticket transaction from other nodes in the blockchain network responsible for the ticket transaction for the electronic ticket.
S402, acquiring block identification information of a bill information storage block, wherein the bill information storage block is a block for recording bill information of the electronic bill.
In this embodiment, the ticket information storage block may be stored in the block chain, and the ticket information of the electronic ticket is recorded, where the block identification information includes a hash value corresponding to the ticket information storage block.
The ticket information includes ticket information of the electronic ticket, and the ticket information includes, but is not limited to, a ticket identifier (including a ticket code, a ticket number, a ticket check code, and the like, which can uniquely identify the electronic ticket), an invoicing time, a resource amount (such as a transaction amount), a transaction object (such as a purchaser and a seller), and the like. In one embodiment, the electronic ticket may be an electronic invoice, and the ticket information of the electronic invoice may further include: the name of the purchaser, the taxpayer identification number, the address, the telephone, the account opening row and the account number, the name of the seller, the taxpayer identification number, the address, the telephone, the account opening row and the account number, the tax rate, the tax amount, the payee, the rechecker and the invoker.
The ticket information storage section may be a section that is generated accordingly at the electronic ticket generation stage. In a possible embodiment, the electronic ticket generation may also be regarded as a transaction, and the ticket information storage block may be an initial transaction block generated for the electronic ticket generation transaction, in which case the initial transaction block records both transaction information related to the electronic ticket generation transaction and ticket information of the generated electronic ticket. In another possible embodiment, the ticket information storage block may be a block specially generated for recording the ticket information of the electronic ticket, besides the initial transaction block, in which the block identification information of the ticket information storage block may be recorded.
In an embodiment, since the transaction block generated for the ticket transaction in the embodiment of the present application does not record the ticket information of the corresponding electronic ticket, but only records the block identifier of the block in which the ticket information is stored, when the block identifier information of the ticket information storage block is obtained, the block identifier information of the ticket information storage block can be obtained from a reference transaction block, where the reference transaction block is a transaction block generated by performing a transaction on the electronic ticket last time relative to the current ticket transaction. The block identification information of the bill information storage block is inquired and obtained from the transaction block generated in the last bill transaction, so that the information inquiry times can be reduced, and the information inquiry efficiency is improved. Note that the block identification information of the ticket information storage block may also be acquired from a transaction block generated with respect to another ticket transaction (ticket transaction for the electronic ticket) prior to the current ticket transaction.
In a possible implementation manner, after the block identification information is acquired from the reference transaction block, the ticket information storage block indicated by the block identification information is queried according to the block identification information acquired from the reference transaction block; if the query result indicates that the bill information of the electronic bill is recorded in the bill information storage block indicated by the block identification information, step S403 is executed. On the contrary, if the query result indicates that the bill information of the electronic bill is not recorded in the bill information storage block indicated by the block identification information, the initial transaction block generated by the transaction generated for the electronic bill generation can be queried to obtain the correct block identification of the bill information storage block. By adopting the mode, the block identification of the bill information storage block which is acquired and recorded in the transaction block subsequently can be ensured to be correct.
And S403, generating a target transaction block aiming at the bill transaction, wherein the target transaction block records the target transaction information and the block identification information.
In the embodiment of the application, the block identification information of the bill information storage block is recorded in the target transaction block, so that the block identification information is acquired from the target transaction block when the bill information of the electronic bill needs to be inquired later, and further the bill information of the electronic bill is acquired from the bill information storage block indicated by the block identification information. The target transaction information is recorded in the target transaction block, so that the transaction evidence can be stored, and the transaction condition of the electronic bill can be conveniently inquired.
In one embodiment, the target transaction information is recorded in a first data field of the target transaction block, the block identification information is recorded in a second data field of the target transaction block, and the first data field and the second data field are different types of data fields in the target transaction block. In a possible embodiment, the first data field may be a service data field (or data field), i.e. a data field that can be adjusted (e.g. adding transaction information, deleting transaction information); the second data field may be a metadata field (or meta data field), i.e. a data field that cannot be adjusted. By storing the transaction information and tile identification information in different types of data fields, rapid acquisition of transaction information or tile identification information from a transaction tile is facilitated.
In an embodiment, in order to facilitate the subsequent query of the historical transaction condition of the electronic bill, in the transaction block generated for the bill transaction, in addition to the block identifier of the block storing the corresponding bill information, the embodiment of the application also records the historical transaction information and the current transaction information of the electronic bill. Based on this, it is possible to acquire the historical transaction information of the electronic ticket from the reference transaction block (the transaction block generated for the transaction for the electronic ticket performed last time with respect to the current ticket transaction), and record the historical transaction information and the target transaction information generated for the current ticket transaction in the target transaction block generated for the current ticket transaction. The historical transaction information and the target transaction information can be recorded in a first data field of a target transaction block. It should be noted that the historical transaction information may refer to transaction information generated with respect to each ticket transaction prior to the current ticket transaction.
In an embodiment, after the current ticket transaction of the electronic ticket is completed, the latest relevant data of the electronic ticket, including the latest transaction information and the like, is recorded in the target transaction block generated for the current ticket transaction, and at this time, a first identifier may be added to the target transaction block to indicate that the electronic ticket recorded by the target transaction block is not transacted, that is, to indicate that the electronic ticket recorded by the target transaction block is the latest relevant data of the electronic ticket. The first identification may include a ticket identification (e.g., ticket code) and an untrammeled identification (e.g., 0) of the electronic ticket. 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, and at this time, a second identifier may be added to the reference transaction block to indicate that the electronic bill recorded therein has been traded, that is, to indicate that the electronic bill recorded therein is historical relevant data of the electronic bill. The original first identifier of the reference transaction block may be adjusted to be the second identifier, or the second identifier may be added to the original first identifier on the basis of saving the original first identifier. The second identification may include a ticket identification (e.g., ticket code) and a transacted identification (e.g., 1) of the electronic ticket. The method adds different identifications to the transaction block, so that the transaction block recorded with the latest relevant data of the electronic bill can be inquired conveniently and quickly.
In the embodiment of the present application, after a target transaction block is generated, the target transaction block is broadcasted to each consensus node in a block chain network, so that each consensus node performs consensus on the target transaction block. Each common identification node links the target transaction block after the target transaction block passes common identification. When receiving a bill information query request aiming at the electronic bill, a node in the block chain network responds to the bill information query request to query the target transaction block from the block chain and obtains the block identification information of the bill information storage block corresponding to the electronic bill from the target transaction block; and inquiring the bill information storage block from the block chain according to the block identification information so as to acquire the bill information of the electronic bill from the bill information storage block.
According to the method and the device, the bill information of the corresponding electronic bill is not recorded in the transaction block generated aiming at the bill transaction, and only the block identification of the block in which the bill information is stored is recorded, so that the consumption of block chain storage resources is effectively reduced on the basis of ensuring that the corresponding bill information can be inquired based on the information recorded in the transaction block.
The following describes an example in which the data processing method provided in the embodiment of the present application is implemented in conjunction with the UTXO technology, and with reference to fig. 5 and 6. UTXO, i.e., the Unspent Transaction Output (Unpending Transaction Output), as the most basic unit of a Transaction; each transaction costs an input, producing an output, and the output produced is the "unspent transaction output".
The blockchain electronic ticket can adopt UTXO to perform generation and circulation management of the ticket assets. As shown in fig. 5 and 6, whenever a new electronic ticket is created, a new UTXO asset is generated, and if the electronic ticket is circulated (corresponding to the ticket transaction as described above), the UTXO of the electronic ticket is set as an input and used as an STXO (spent transaction output), and thus a new UTXO is generated as an identifier of the circulated ticket asset.
In each generation phase of the UTXO, the information storage manner shown in fig. 5 may be used to store the ticket surface information (corresponding to the ticket information described above) and the ticket circulation information (corresponding to the transaction information described above), that is, the ticket surface 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. And each electronic bill has a plurality of links such as billing, circulation, receipt and the like, and each link can generate a new UTXO, so that bill face information stored in a meta field in a last transaction block and bill circulation information stored in a data field in the last UTXO are copied and stored. By adopting the information storage mode, the full information of the corresponding electronic bill can be obtained only by inquiring the appointed transaction block and the UTXO information owned by the user, and the information inquiry operation can be simplified. However, because the ticket information of the electronic ticket is not changed, once the electronic ticket has more circulation times, the ticket information of the electronic ticket needs to be redundantly stored for many times in the middle, and therefore consumption of block chain storage resources can be accelerated.
Based on this, in order to reduce the consumption of the block chain storage resource, in the stages of generation and circulation management of the ticket asset, the information storage can be performed in the manner shown in fig. 6, that is, only the ticket information of the electronic ticket is recorded in the meta field of the initial transaction block generated in the stage of generating the electronic ticket, in the later stage of generating the UTXO, the ticket circulation information is stored through the data field of the generated UTXO, the ticket information 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 in the stage of generating the electronic ticket is stored, so that the ticket information of the electronic ticket can be indirectly recorded, and the purpose of reducing the stored data can be achieved.
In the process of inquiring the face information of the electronic bill, the block identification of the initial transaction block generated in the electronic bill generation stage is acquired from the latest transaction block of the electronic bill, and the face information of the electronic bill can be acquired by inquiring the initial transaction block according to the block identification.
The information storage mode shown in fig. 6 is optimized relative to the mode shown in fig. 5 in which the bill face information needs to be recorded for each transaction, and redundant records of the bill face information generated in the electronic bill circulation link can be reduced by recording only the index form of the initial transaction block (which records the bill face information) without recording the bill face information, so that the consumption of block chain storage resources by the block chain electronic invoice is effectively saved.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a data processing apparatus based on a block chain according to an embodiment of the present disclosure. The data processing apparatus described in the embodiment of the present application may correspond to a consensus node for performing the data processing method described above, and the data processing apparatus includes an obtaining unit 701, a processing unit 702, and an inquiring unit 703. Wherein:
an acquisition unit 701 for acquiring target transaction information generated by performing a ticket transaction for an electronic ticket;
the acquiring unit 701 is further configured to acquire block identification information of a bill information storage block, where the bill information storage block is a block in which the bill information of the electronic bill is recorded;
a processing unit 702, configured to generate a target transaction block for the ticket transaction, where the target transaction information and the block identification information are recorded in the target transaction block.
In one embodiment, 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; the first data field and the second data field are different types of data fields in the target transaction block.
In an embodiment, the processing unit 702 is further configured to, when receiving a ticket information query request for the electronic ticket, obtain the block identification information from the target transaction block in response to the ticket information query request;
the data processing apparatus further includes an inquiring unit 703 configured to inquire the ticket information storage block according to the block identification information, and obtain the ticket information of the electronic ticket from the ticket information storage block.
In an embodiment, the obtaining unit 701 is specifically configured to obtain the block identification information of the ticket information storage block from a reference transaction block, where the reference transaction block is a transaction block generated by performing a transaction on the electronic ticket last time with respect to a current ticket transaction.
In an embodiment, the querying unit 703 is further configured to: inquiring a bill information storage block indicated by the block identification information according to the block identification information acquired from the reference transaction block; if the query result indicates that the bill information of the electronic bill is recorded in the bill information storage block indicated by the block identification information, the processing unit 702 is triggered to generate a target transaction block for the bill transaction.
In an embodiment, the obtaining unit 701 is further configured to obtain historical transaction information of the electronic ticket from the reference transaction block, where the historical transaction information is further recorded in the target transaction block.
In an embodiment, the processing unit 702 is further configured to: adding a first identifier to the target trading block, wherein the first identifier is used for indicating that the electronic bill is not traded; and adding a second identifier to the reference trading block, wherein the second identifier is used for indicating that the electronic bill is traded.
It can be understood that the functions of the functional units of the data processing apparatus provided in the embodiment of the present application may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the relevant description in the foregoing method embodiment, which is not described herein again.
According to the method and the device, the bill information of the corresponding electronic bill is not recorded in the transaction block generated aiming at the bill transaction, and only the block identification of the block in which the bill information is stored is recorded, so that the consumption of block chain storage resources is effectively reduced on the basis of ensuring that the corresponding bill information can be inquired based on the information recorded in the transaction block.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure. The computer device described in the embodiment of the present application may correspond to the 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, the communication interface 802, and the memory 803 may be connected by a bus or other means, and the bus is taken as an example in the present embodiment.
The processor 801 (or referred to as a Central Processing Unit (CPU)) is a computing core and a control core of the computer device, and can analyze various instructions in the computer device and process various data of the computer device, for example: the CPU can be used for analyzing a power-on and power-off instruction sent to the computer equipment by a user and controlling the computer equipment to carry out power-on and power-off operation; the following steps are repeated: the CPU may transmit various types of interactive data between the internal structures of the computer device, and so on. The communication interface 802 may optionally include a standard wired interface, a wireless interface (e.g., wi-Fi, mobile communication interface, etc.), controlled by the processor 801 for transceiving data. The Memory 803 (Memory) is a Memory device in the computer device for storing programs and data. It is understood that the memory 803 herein can comprise both the built-in memory of the computer device and, of course, the expansion memory supported by the computer device. The memory 803 provides storage space that stores the operating system of the computer device, which may include, but is not limited to: android system, iOS system, windows Phone system, etc., which are not limited in this application.
In the embodiment of the present application, the processor 801 executes the executable program code in the memory 803 to perform the following operations:
acquiring target transaction information generated by performing bill transaction on the electronic bill; acquiring block identification information of a bill information storage block, wherein the bill information storage block is a block for recording bill information of the electronic bill; and generating a target transaction block aiming at the bill transaction, wherein the target transaction information and the block identification information are recorded in the target transaction block.
In one embodiment, the processor 801 may obtain target transaction information generated by a ticketing transaction from other nodes in the blockchain network responsible for the ticketing transaction for an electronic ticket through the communication interface 802.
In one embodiment, 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; the first data field and the second data field are different types of data fields in the target transaction block.
In one embodiment, the processor 801 is further configured to: when a bill information query request for the electronic bill is received through the communication interface 802, the block identification information is acquired from the target transaction block in response to the bill information query request; and inquiring the bill information storage block according to the block identification information, and acquiring the bill information of the electronic bill from the bill information storage block.
In an embodiment, when the processor 801 obtains the block identification information of the ticket information storage block, it is specifically configured to: and acquiring the block identification information of the bill information storage block from a reference transaction block, wherein the reference transaction block is a transaction block generated by performing transaction on the electronic bill in the last transaction relative to the current bill.
In one embodiment, the processor 801 is further configured to: inquiring a bill information storage block indicated by the block identification information according to the block identification information acquired from the reference transaction block; and if the query result indicates that the bill information storage block indicated by the block identification information records the bill information of the electronic bill, generating a target transaction block aiming at the bill transaction.
In one embodiment, the processor 801 is further configured to: and acquiring 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.
In one embodiment, the processor 801 is further configured to: adding a first identifier to the target trading block, wherein the first identifier is used for indicating that the electronic bill is not traded; and adding a second identifier for the reference trading block, wherein the second identifier is used for indicating that the electronic bill has traded.
In a specific implementation, the processor 801, the communication interface 802, and the memory 803 described in this embodiment of the present application may execute the implementation described in the data processing method based on a block chain provided in this embodiment of the present application, and may also execute the implementation described in the data processing apparatus based on a block chain provided in this embodiment of the present application, which is not described herein again.
According to the method and the device, the bill information of the corresponding electronic bill is not recorded in the transaction block generated aiming at the bill transaction, and only the block identification of the block in which the bill information is stored is recorded, so that the consumption of block chain storage resources can be effectively reduced on the basis of ensuring that the corresponding bill information can be inquired based on the information recorded in the transaction block.
The embodiments of the present application also provide a computer-readable storage medium, where a computer program is stored, and when the computer program runs on a computer, the computer is enabled to execute the data processing method based on the blockchain provided in the embodiments of the present application. For a specific implementation, reference may be made to the foregoing description, which is not repeated herein.
Embodiments of the present application also provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, so that the computer device executes the data processing method based on the blockchain provided by the embodiment of the application. For a specific implementation, reference may be made to the foregoing description, which is not repeated herein.
It should be noted that, for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the order of acts described, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by hardware related to instructions of a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, read-Only memories (ROMs), random Access Memories (RAMs), magnetic or optical disks, and the like.
The above disclosure is only a few examples of the present application, and certainly should not be taken as limiting the scope of the present application, which is therefore intended to cover all modifications that are within the scope of the present application and which are equivalent to the claims.

Claims (10)

1. A method for processing data based on a blockchain, the method comprising:
acquiring target transaction information generated by performing bill transaction on the electronic bill;
acquiring block identification information of a bill information storage block, wherein the bill information storage block is a block for recording bill information of the electronic bill;
and generating a target transaction block aiming at the bill transaction, wherein the target transaction information and the block identification information are recorded in the target transaction block.
2. The method of claim 1, 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; the first data field and the second data field are different types of data fields in the target transaction block.
3. The method of claim 1, wherein the method further comprises:
when a bill information query request aiming at the electronic bill is received, responding to the bill information query request to acquire the block identification information from the target transaction block;
and inquiring the bill information storage block according to the block identification information, and acquiring the bill information of the electronic bill from the bill information storage block.
4. The method of any one of claims 1-3, wherein obtaining block identification information for a block of ticket information storage comprises:
and acquiring the block identification information of the bill information storage block from a reference transaction block, wherein the reference transaction block is a transaction block generated by performing transaction on the electronic bill in the last transaction relative to the current bill.
5. The method of claim 4, wherein the method further comprises:
inquiring a bill information storage block indicated by the block identification information according to the block identification information acquired from the reference transaction block;
and if the query result indicates that the bill information of the electronic bill is recorded in the bill information storage block indicated by the block identification information, executing the step of generating the target transaction block aiming at the bill transaction.
6. The method of claim 4, wherein the method further comprises:
and acquiring 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.
7. The method of claim 4, wherein the method further comprises:
adding a first identifier to the target trading block, wherein the first identifier is used for indicating that the electronic bill is not traded;
and adding a second identifier to the reference trading block, wherein the second identifier is used for indicating that the electronic bill is traded.
8. An apparatus for data processing based on a blockchain, the apparatus comprising:
the acquisition unit is used for acquiring target transaction information generated by performing bill transaction on the electronic bill;
the acquisition unit is further used for acquiring block identification information of a bill information storage block, wherein the bill information storage block is a block for recording the bill information of the electronic bill;
and the processing unit is used for generating a target transaction block aiming at the bill transaction, wherein the target transaction information and the block identification information are recorded in the target transaction block.
9. A computer device, comprising: a processor, a communication interface and a memory, which are connected to each other, wherein the memory stores executable program code, and the processor is configured to call the executable program code to execute the method for processing data based on a blockchain according to any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which, when run on a computer, causes the computer to carry out the method of blockchain-based data processing according to any one of claims 1 to 7.
CN202110507110.7A 2021-05-10 2021-05-10 Data processing method and device based on block chain and computer equipment Pending CN115330365A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110507110.7A CN115330365A (en) 2021-05-10 2021-05-10 Data processing method and device based on block chain and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110507110.7A CN115330365A (en) 2021-05-10 2021-05-10 Data processing method and device based on block chain and computer equipment

Publications (1)

Publication Number Publication Date
CN115330365A true CN115330365A (en) 2022-11-11

Family

ID=83911931

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110507110.7A Pending CN115330365A (en) 2021-05-10 2021-05-10 Data processing method and device based on block chain and computer equipment

Country Status (1)

Country Link
CN (1) CN115330365A (en)

Similar Documents

Publication Publication Date Title
US11388009B2 (en) Token management system and token management method
US10937111B2 (en) Managing energy purchase agreements on a blockchain
CN111274045B (en) Multi-platform docking method and device, computer equipment and readable storage medium
CN110910230A (en) Accounting method, accounting system and storage medium
CN112613877B (en) Intelligent contract triggering method and device applied to block chain network and related equipment
CN110597919A (en) Data management method, device and equipment based on block chain and storage medium
CN111488626A (en) Data processing method, device, equipment and medium based on block chain
CN110955724A (en) Data processing method and device based on block chain, node equipment and storage medium
CN110738471A (en) bill management method based on block chain network and related equipment
WO2021139778A1 (en) System scheduling workflow generation method, system, apparatus, and computer readable storage medium
CN110930152A (en) Data processing method based on block chain and related equipment
CN111915301A (en) Data processing method and device based on block chain, electronic equipment and readable medium
CN111311277B (en) Bill processing method and device based on block chain network and related equipment
CN113706313A (en) Financing method, system and computer readable storage medium based on block chain
CN110781134A (en) Data processing method and device, computer storage medium and electronic equipment
CN110766403A (en) Data processing device and method based on block chain and storage medium
CN112685391B (en) Service data migration method and device, computer equipment and storage medium
CN110599133A (en) Data processing method and device based on block chain network and storage medium
CN111177099A (en) Data processing method and device of business system, electronic equipment and storage medium
CN109271564A (en) Declaration form querying method and equipment
US20220311595A1 (en) Reducing transaction aborts in execute-order-validate blockchain models
CN115330365A (en) Data processing method and device based on block chain and computer equipment
CN113159935A (en) To-do service processing method and device based on block chain
CN115619395A (en) Data processing method based on block chain and related equipment
CN111209337A (en) Financial report generation system, method, device, equipment and medium based on block chain

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