CN109726229B - Block chain data storage method and device - Google Patents

Block chain data storage method and device Download PDF

Info

Publication number
CN109726229B
CN109726229B CN201811464549.0A CN201811464549A CN109726229B CN 109726229 B CN109726229 B CN 109726229B CN 201811464549 A CN201811464549 A CN 201811464549A CN 109726229 B CN109726229 B CN 109726229B
Authority
CN
China
Prior art keywords
transaction
node
request
block
consensus node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811464549.0A
Other languages
Chinese (zh)
Other versions
CN109726229A (en
Inventor
刘新
宫亚明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology 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 Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN201811464549.0A priority Critical patent/CN109726229B/en
Publication of CN109726229A publication Critical patent/CN109726229A/en
Application granted granted Critical
Publication of CN109726229B publication Critical patent/CN109726229B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the application discloses a block chain data storage method and device. Wherein the method comprises the following steps: the first consensus node receives a first transaction request; the first consensus node verifies the validity of the first transaction request; if the first transaction request meets the legitimacy, the first consensus node sends the first transaction request to an accounting node; the first consensus node receives a first block sent by the accounting node, and the first block is generated according to the first transaction request; the first chunk includes the first transaction requesting the first consensus node to store a chunk header of the first chunk to a local database of the first consensus node. The embodiment of the application can effectively reduce the occupied space of the block chain data in the local memory of the consensus node.

Description

Block chain data storage method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for storing blockchain data.
Background
Trade on the internet almost always needs to process electronic payment information by means of a trusted third party credit organization, the intrinsic nature of the system is limited by a credit-based mode, and the blockchain technology is based on the principle of cryptography and is not based on credit, any agreed two parties can pay directly, so that participation of a third party intermediary is not needed, and the blockchain is a basic technology for constructing a bit coin blockchain network and encrypting transmission of transaction information.
Blockchains are a kind of chained data structures that combine blocks of data in a sequential manner in time order, and cryptographically guaranteed, non-tamperable and non-counterfeitable distributed ledgers. Blockchains have gained extensive attention and research in recent years as an emerging technology. In existing blockchain platforms, transactions are packaged into blocks and recorded onto the blockchain by all network nodes participating in the consensus. The local disk of the consensus node must store the complete blockchain data to verify the transaction, and then package and link the legal transaction.
As the running time and the transaction number of the blockchain platform increase, blockchain data also increases, which causes insufficient local disk memory of the consensus node, and expansion is required to accommodate the complete blockchain data.
Disclosure of Invention
The embodiment of the application provides a block chain data storage method and device, which reduce the occupied space of block chain data in a local memory of a consensus node.
In a first aspect, an embodiment of the present application provides a blockchain data storage method, including the following steps:
the first consensus node receives a first transaction request;
The first consensus node verifies the legitimacy of the first transaction request;
if the first transaction request meets the legitimacy, the first consensus node sends the first transaction request to the billing node;
a first consensus node receives a first block sent by an accounting node, the first block generated by the accounting node according to the first transaction request;
the first consensus node stores a block header of the first block to a local database of the first consensus node.
In the embodiment of the application, the first common node stores the block header of the first block into the local database of the first common node, and the local database of the first common node stores the block header.
Optionally, the method further comprises: the first consensus node receives a first query request for querying a second transaction. The first consensus node queries a second transaction from a local database of the first consensus node. And if the first consensus node does not inquire the second transaction from the local database of the first consensus node, sending a first inquiry request to a database server. The first consensus node receives a query result of a first query request sent by a database server.
In the implementation of the application, when the first consensus node receives the first inquiry request, the first consensus node firstly inquires the second transaction from the local database of the first consensus node. If the second transaction is not queried in the local database of the first consensus node, a query request is sent to a database server, and the second transaction is queried through the database server. In summary, although only part of the blockchain data is stored in the local database of the first consensus node, the first consensus node still has the transaction inquiry function through the scheme in the embodiment of the application.
Optionally, the first transaction request includes: the digital signature of the initiator of the first transaction request and the basic information of the first transaction request, wherein the basic information of the first transaction request comprises a transaction serial number corresponding to the first transaction request and a transaction type of the first transaction request.
Optionally, the first consensus node verifies the validity of the first transaction request, specifically including: the first consensus node verifies whether the digital signature of the first transaction request originator is correct. If the digital signature of the first transaction request initiator is correct, the history of the first transaction request is queried. And judging the validity of the basic information of the first transaction request according to the history record of the first transaction request.
In the embodiment of the application, the first consensus node verifies the validity of the first transaction request through the scheme. Therefore, although only part of the blockchain data is stored in the local database of the first consensus node, the first consensus node still has the function of verifying the validity of the transaction request through the scheme in the embodiment of the application.
The embodiment of the application also provides a block chain data storage method, which mainly comprises the following steps:
the accounting node receives a first transaction request sent by a first consensus node;
the accounting node verifies the validity of the first transaction request;
if the first transaction request meets the legitimacy, the billing node encapsulates the first transaction into a first block when the first billing period is over;
the accounting node stores the block header of the first block to a local database of the accounting node;
the accounting node sends the first block to the first consensus node and the database server.
In the embodiment of the application, the accounting node stores the block header of the first block into the local database of the accounting node, and the local database of the accounting node stores the block header, so that the occupied space of the block chain data in the local memory of the accounting node can be effectively reduced relative to the storage of the complete block data.
Optionally, the method further comprises: the billing node receiving a third query request for querying a third transaction; the accounting node queries a third transaction from the local database of the accounting node; if the accounting node does not inquire the third transaction from the local database of the accounting node, a fourth inquiry request is sent to a database server; the accounting node receives the query result of the fourth query request sent by the database server.
In the implementation of the application, when the accounting node receives a third query request, the third transaction is first queried from the local database of the accounting node. If the third transaction is not queried from the local database of the accounting node, a query request is sent to the database server, and the third transaction is queried through the database server. In summary, although only a portion of blockchain data is stored in the local database of the accounting node, the accounting node still has the function of querying the transaction through the solution in the embodiment of the present application.
The embodiment of the application also provides a block chain data storage method, which mainly comprises the following steps:
the database server receives a first block sent by an accounting node;
The database server records the first block into a blockchain ledger;
the database server receives a second query request sent by the first consensus node, wherein the second query request is used for querying a second transaction;
the database server queries the second transaction;
the database server sends the query result of the second query request to the first consensus node;
or the database server receives a fourth query request sent by the accounting node, wherein the fourth query request is used for querying the third transaction;
the database server queries a third transaction;
the database server sends the query result of the fourth query request to the billing node.
In the implementation of the application, the first block is recorded into the blockchain ledger through the database server, the complete blockchain data is stored in the database server, and the database server can realize the transaction inquiry function, thereby providing inquiry service for the consensus node and the billing node.
In a fourth aspect, an embodiment of the present application further provides a device for storing blockchain data, where the device can implement the function of the first common node in the blockchain data storage method of the first aspect and the alternative embodiment thereof, so that the beneficial effects of the blockchain data storage method of the first aspect and the alternative embodiment thereof can also be implemented. The functions of the device can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes at least one module corresponding to the above functions.
Optionally, the apparatus includes a first receiving unit, a first verifying unit, a first transmitting unit, a first receiving unit, and a first storing unit.
The first receiving unit is used for receiving a first transaction request.
And the first verification unit is used for verifying the validity of the first transaction request.
And the first sending unit is used for sending the first transaction request to an accounting node if the first transaction request meets the validity.
The first receiving unit is further configured to receive a first block sent by the accounting node, where the first block is generated by the accounting node according to the first transaction request.
And the first storage unit is used for storing the block head of the first block.
In a fifth aspect, an embodiment of the present application further provides a blockchain node device, where the blockchain node device can implement the function of the first consensus node in the blockchain data storage method of the first aspect and the optional embodiment thereof, so that the beneficial effects of the blockchain data storage method of the first aspect and the optional embodiment thereof can also be implemented. The function of the blockchain node device can be realized by hardware or by executing corresponding software by hardware. The hardware or software includes at least one module corresponding to the above functions. The blockchain node device comprises a memory, a processor and a transceiver, wherein the memory is used for storing a computer program for supporting the blockchain node device to execute the method, the computer program comprises program instructions, the processor is used for controlling and managing actions of the blockchain node device according to the program instructions, and the transceiver is used for supporting communication between the blockchain node device and other communication devices.
In a sixth aspect, an embodiment of the present application further provides a blockchain data storage device, where the device can implement the function of the accounting node in the blockchain data storage method of the second aspect and the optional embodiment thereof, so that the beneficial effects of the blockchain data storage method of the second aspect and the optional embodiment thereof can also be implemented. The functions of the device can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes at least one module corresponding to the above functions.
Optionally, the apparatus includes a second receiving unit, a second verifying unit, a packaging unit, a second storing unit, and a second transmitting unit.
And the second receiving unit is used for receiving the first transaction request sent by the first consensus node.
And the second verification unit is used for verifying the validity of the first transaction request.
A packaging unit for packaging the first transaction request into the first block when the first accounting period is over if the first transaction request meets the validity
And the second storage unit is used for storing the block head of the first block.
And the second sending unit is used for broadcasting the first block and sending the first block to the first consensus node and the database server.
In a seventh aspect, the present application further provides a blockchain node device, where the blockchain node device can implement the function of the accounting node in the blockchain data storage method of the second aspect and the optional embodiment thereof, so that the beneficial effects of the blockchain data storage method of the second aspect and the optional embodiment thereof can also be implemented. The function of the blockchain node device can be realized by hardware or by executing corresponding software by hardware. The hardware or software includes at least one module corresponding to the above functions. The blockchain node device comprises a memory, a processor and a transceiver, wherein the memory is used for storing a computer program for supporting the blockchain node device to execute the method, the computer program comprises program instructions, the processor is used for controlling and managing actions of the blockchain node device according to the program instructions, and the transceiver is used for supporting communication between the blockchain node device and other communication devices.
In an eighth aspect, an embodiment of the present application further provides a blockchain data storage device, where the device can implement a function of a database server in the blockchain data storage method of the third aspect, so that the device can also implement the beneficial effects of the blockchain data storage method of the third aspect. The functions of the device can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes at least one module corresponding to the above functions.
Optionally, the apparatus includes a third receiving unit, a third storage unit, and a third transmitting unit.
And the third receiving unit is used for receiving the first block sent by the accounting node.
And the third storage unit is used for recording the first block into the blockchain ledger.
The third receiving unit is further configured to receive a second query request sent by the first consensus node, where the second query request is used to query a second transaction.
And the first inquiring unit is used for inquiring the second transaction.
And the third sending unit is used for sending the query result of the second query request to the first consensus node.
Or the third receiving unit is further configured to receive a fourth query request sent by the accounting node, where the fourth query request is used to query the third transaction;
and the first inquiring unit is used for inquiring the third transaction.
And the third sending unit is used for sending the query result of the fourth query request to the accounting node.
In a ninth aspect, an embodiment of the present application further provides a server, where the server can implement a function of a database server in the third aspect of the blockchain data storage method, so that the beneficial effects of the third aspect of the blockchain data storage method can also be implemented. The functions of the server can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes at least one module corresponding to the above functions. The server comprises a memory for storing a computer program supporting the server to perform the method described above, the computer program comprising program instructions, a processor for controlling and managing the actions of the server in accordance with the program instructions, and a transceiver for supporting the communication of the server with other communication devices.
In a ninth aspect, embodiments of the present application further provide a blockchain data storage system, the system including: the system comprises a consensus node, an accounting node and a database server, wherein the consensus node, the accounting node and the database server are connected with each other through a network to form a blockchain network.
In a tenth aspect, embodiments of the present application provide a computer readable storage medium having instructions stored thereon that, when executed on a processor, cause the processor to perform the blockchain data storage method of the first aspect and alternative embodiments thereof described above.
In an eleventh aspect, embodiments of the present application provide a computer readable storage medium having instructions stored thereon that, when executed on a processor, cause the processor to perform the blockchain data storage method of the second aspect and alternative embodiments thereof described above.
In a twelfth aspect, embodiments of the present application provide a computer readable storage medium having instructions stored thereon that, when executed on a processor, cause the processor to perform the blockchain data storage method described in the third aspect above.
In a thirteenth aspect, embodiments of the present application provide a computer program product comprising instructions which, when run on a processor, cause the processor to perform the blockchain data storage method of the description of the first aspect and alternative embodiments thereof.
In a fourteenth aspect, embodiments of the present application provide a computer program product comprising instructions which, when run on a processor, cause the processor to perform the blockchain data storage method of the description of the second aspect and alternative embodiments thereof described above. In a fifteenth aspect, embodiments of the present application provide a computer program product comprising instructions which, when run on a processor, cause the processor to perform the blockchain data storage method of the description of the third aspect and alternative embodiments thereof.
Drawings
The drawings that accompany the detailed description can be briefly described as follows.
FIG. 1 is a system architecture diagram of a blockchain data storage system provided by an embodiment of the present application;
FIG. 2 is a schematic block chain node device according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a server according to an embodiment of the present application;
FIG. 4 is a flowchart of a block chain data storage method according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating another exemplary method for storing blockchain data according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating another exemplary method for storing blockchain data according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a block chain data storage device according to an embodiment of the present application;
FIG. 8 is a schematic diagram of another blockchain data storage device according to an embodiment of the present application;
FIG. 9 is a schematic diagram of another block chain data storage device according to an embodiment of the present application.
Detailed Description
The technical solutions in embodiments of the present application will be described below with reference to the accompanying drawings in embodiments of the present application, it should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, indicate the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is noted that the terminology used in the embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be noted that, in the embodiment of the present application, the block link point device may be a conventional server capable of supporting services and guaranteeing service capabilities, or may be a terminal device registered in a block chain and having a processor, a hard disk, a memory, and a system bus structure and capable of supporting services and guaranteeing service capabilities. The embodiment of the present application is not particularly limited.
In a narrow sense, a blockchain is a distributed ledger that combines blocks of data in a sequential manner in time order into a chain data structure, and that is cryptographically secured against tampering and counterfeiting. Broadly speaking, the blockchain technology is a brand new distributed infrastructure and computing mode that uses a blockchain data structure to verify and store data, uses a distributed node consensus algorithm to generate and update data, uses a cryptography mode to ensure the security of data transmission and access, and uses a first intelligent contract composed of automated script code to program and operate the data. The blockchains can be divided into three types, namely public blockchains, alliance blockchains and private blockchains, and the blockchain data storage method provided by the embodiment of the application is applicable to the alliance blockchains and the private blockchains. The federated blockchain refers to: designating a plurality of preselected nodes as billboards from within a group, the generation of each block is determined by all preselected nodes together, other access nodes can participate in the transaction, but no account is taken, and any other person can conduct a limited inquiry through the data interface of the blockchain opening. Private blockchains refer to: accounting is performed by using only the general ledger technique of the blockchain, and the accounting can be a company or a person, and the writing authority of the blockchain is shared independently.
FIG. 1 is a block chain data storage system 100 according to an embodiment of the present application. As can be seen in FIG. 1, the blockchain data storage system 100 is comprised of a consensus node 101 and a database server 102, wherein the consensus node 101 includes an accounting node 103. The consensus node 101 and the database server 102 are connected to each other via a network to form a blockchain network. It is to be appreciated that communication between the various devices in the blockchain data storage system 100 can be based on any wired and wireless network, including but not limited to the internet, wide area networks, metropolitan area networks, local area networks, virtual private networks (Virtual Private Network, VPN), wireless communication networks, and the like.
As can be seen from FIG. 1, the database servers 102 in the blockchain data storage system 100 may be in a master-slave database structure, i.e., the blockchain data storage system 100 includes 1 master database server 102 and K backup database servers 102. The primary database server 102 and the K backup database servers 102 each hold the complete blockchain data of the blockchain data storage system 100 described above. By adopting the master-slave database structure, the data in the block chain data storage system 100 can be ensured to have a plurality of disaster recovery copies, and the safety of the data can be improved. When the primary database server 102 fails, it can switch to other database servers 102 immediately, improving the availability of the system. In the blockchain data storage system 100, after each accounting period starts, the accounting node 103 of the accounting period is selected by a plurality of consensus nodes 101 through a consensus mechanism, where the consensus mechanism may be a practical bayer fault tolerance algorithm (english: practical Byzantine Fault Tolerance, acronym: PBFT) or a Raft protocol consensus mechanism, and the application is not limited thereto. Each consensus node 101 can query and read data from database server 102, but only accounting node 103 can write data to database server 102, each database server 102 holds the complete blockchain data of the system, however each consensus node 101 can optionally hold part of the blockchain data in the local database in order to relieve the memory pressure of each consensus node.
The consensus node 101 and the accounting node 103 are block link point devices, which may be network devices with intelligent computing functions, such as servers, mobile terminals, personal computers, and the like, and can perform communication interaction with other devices. The function of the blockchain node device will be described in detail in the following embodiments.
Referring to fig. 2, fig. 2 is a schematic hardware structure of a block link point apparatus 200 according to an embodiment of the present application, where the block link point apparatus 200 includes: memory 201, transceiver 202, and processor 203 coupled to the memory 201 and transceiver 202. The memory 201 is used for storing a computer program comprising program instructions, the processor 203 is used for executing the program instructions stored in the memory 201, and the transceiver 202 is used for communicating with other devices under the control of the processor 203. The blockchain data storage method may be performed according to program instructions when the processor 203 is executing the instructions.
The processor 203 may be a central processing unit (central processing unit, CPU), a general purpose processor, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (application-specific integrated circuit, ASIC), a field programmable gate array (field programmable gate array, FPGA), or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. A processor may also be a combination that performs computing functions, e.g., including one or more microprocessors, a combination of a DSP and a microprocessor, and so forth. The transceiver 202 may be a communication interface, a transceiver circuit, etc., where the communication interface is generally referred to and may include one or more interfaces, such as an interface between a blockchain node device and a terminal.
Optionally, the block link point device 200 may also include a bus 204. Wherein the memory 201, transceiver 202, and processor 203 may be interconnected via a bus 204; bus 204 may be a peripheral component interconnect standard (English: peripheral component interconnect; PCI) bus or an extended industry Standard architecture (English: extended industry standard architecture; EISA) bus, among others. The bus 204 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 2, but not only one bus or one type of bus.
In addition to the memory 201, transceiver 202, processor 203, and bus 204 shown in fig. 2, the blockchain node device 200 in the embodiment may further include other hardware according to the actual functions of the blockchain node device, which will not be described herein.
Referring to fig. 3, fig. 3 is a schematic hardware structure of a server 300 according to an embodiment of the present application, where the server may implement a function of a database server in the blockchain data storage method according to the embodiment of the present application, and the server 300 includes: a memory 301, a transceiver 302, and a processor 303 coupled with the memory 301 and the transceiver 302. The memory 301 is used for storing a computer program comprising program instructions, the processor 303 is used for executing the program instructions stored in the memory 301, and the transceiver 302 is used for communicating with other devices under the control of the processor 303. The blockchain data storage method may be performed according to program instructions when the processor 303 is executing the instructions.
The processor 303 may be a central processing unit (central processing unit, CPU), a general purpose processor, a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (application-specific integrated circuit, ASIC), a field programmable gate array (field programmable gate array, FPGA), or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. A processor may also be a combination that performs computing functions, e.g., including one or more microprocessors, a combination of a DSP and a microprocessor, and so forth. Transceiver 302 may be a communication interface, a transceiver circuit, etc., where a communication interface is a generic term and may include one or more interfaces, such as an interface between a server and a block link point device.
Optionally, the server 300 may also include a bus 304. Wherein the memory 301, transceiver 302, and processor 303 may be interconnected by a bus 304; bus 304 may be a peripheral component interconnect standard (English: peripheral component interconnect, PCI) bus, or an extended industry Standard architecture (English: extended industry standard architecture, EISA) bus, among others. The bus 304 may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, only one thick line is shown in fig. 3, but not only one bus or one type of bus.
In addition to the memory 301, the transceiver 302, the processor 303 and the bus 304 shown in fig. 3, the server 300 in the embodiment may further include other hardware according to the actual functions of the server, which will not be described herein.
In the above operating environment, an embodiment of the present application provides a blockchain data storage method, referring to fig. 4, fig. 4 is a flow chart of the blockchain data storage method provided in the embodiment of the present application, as shown in fig. 4, where the method specifically includes:
s401, a first consensus node receives a first transaction request.
Optionally, the first transaction request includes a digital signature of an initiator of the first transaction request and basic information of the first transaction request, and the basic information of the first transaction request includes a transaction serial number corresponding to the first transaction request and a transaction type of the first transaction request.
The digital signature of the initiator of the first transaction request is summary information encrypted by the initiator of the first transaction request with a private key, and the digital signature of the initiator of the first transaction request is used for indicating the validity of the first transaction request. In particular, digital signatures may be used on the one hand to determine that transaction information was indeed issued by a sender signature, as others cannot impersonate the sender's signature; on the other hand, it can also be used to determine the integrity of the message, since the digital signature is characterized in that it represents the characteristics of a file, the value of which will change if it changes, and different files will get different digital digests.
It will be appreciated that various types of transactions may be conducted based on blockchain technology, and embodiments of the application are not specifically limited. For example, for a user of a bank, the types of transactions that may be made are transfers, charges, financing, and offers, etc.
Optionally, for transactions of the same type in the blockchain, the blockchain has a specific transaction serial number according to a transaction sequence and a predetermined numbering rule, and the embodiment of the present application is not specifically limited for the predetermined numbering rule.
Optionally, the basic information of the first transaction request includes other related information of the first transaction request besides the transaction serial number corresponding to the first transaction request and the transaction type of the first transaction request. For example, if the first transaction request is a transfer request initiated by a user of a bank through a terminal device, the basic information of the first transaction may further include account information of the user, account information of a payee, and a transaction amount.
It will be appreciated that the specific content of the basic information of the first transaction request may vary from transaction type to transaction type, and embodiments of the present application are not particularly limited.
For example, the first consensus node receives a transaction request initiated by a user a through a terminal device, the transaction request is a user a request and is 1000 yuan to be transferred to a user B, the transaction request includes a digital signature of the user a and basic information of the transaction request, the basic information of the transaction request includes a transaction serial number corresponding to the transaction request, transaction types of the transaction request, account numbers of the user a and the user B and transaction amounts of the transaction request, the transaction serial number corresponding to the transaction request is H5, the transaction type of the transaction request is transfer, and the transaction amount of the transaction request is 1000 yuan.
S402, the first consensus node verifies the validity of the first transaction request, and if the first transaction request meets the validity, step S403 is executed.
Optionally, the first consensus node verifies the validity of the first transaction request, specifically including the following steps:
s1, the first consensus node verifies whether the digital signature of the initiator of the first transaction request is correct.
It will be appreciated that a digital signature is a string of numbers that cannot be forged by others that can only be generated by the sender of the information, and that this string is also a valid proof of the authenticity of the information sent by the sender of the information.
S2, if the digital signature of the initiator of the first transaction request is correct, the first consensus node queries the history record of the first transaction request.
S3, the first consensus node judges the validity of the basic information of the first transaction request according to the history record of the first transaction request.
Optionally, the first consensus node verifies whether the digital signature of the initiator of the first transaction request is correct, specifically including: the first consensus node decrypts the digital signature of the initiator of the first transaction request by using the public key of the initiator of the first transaction request to obtain first abstract information. A second digest information is generated for the base information of the first transaction request using the HASH function. Comparing the first abstract information with the second abstract information, if the first abstract information and the second abstract information are the same, the digital signature of the initiator of the first transaction request is correct, the information received by the first consensus node is complete and is not modified in the transmission process, otherwise, the digital signature of the initiator of the first transaction request is incorrect, and the first transaction request does not meet the legality.
Optionally, the first consensus node queries a history of the first transaction request, specifically including the steps of: the first consensus node queries a history of the first transaction request from a local database of the first consensus node. If the history of the first transaction request is not queried from the local database of the first consensus node, the first consensus node sends a fifth query request to the database server, wherein the fifth query transaction request is used for querying the history of the first transaction request in the database server. The first consensus receives a history of first transaction requests sent by a database server.
Optionally, the first consensus node judging the validity of the basic information of the first transaction request according to the history of the first transaction request specifically includes: the first consensus node verifies whether the party of the first transaction request is a legal user according to the history of the first transaction request. If the participant of the first transaction request is a legal user, the first consensus node verifies whether the transaction sequence number of the first transaction request is correct according to the history record of the first transaction request. If the transaction serial number of the first transaction request is correct, the first consensus node verifies whether the account information of the participant of the first transaction request meets the transaction condition according to the history record of the first transaction request, and if the account information of the participant of the first transaction request meets the transaction condition, the basic information of the first transaction request meets the validity.
It will be appreciated that the first transaction request is not legitimate if the party to the first transaction request is not a legitimate user. If the transaction sequence number of the first transaction does not conform to the predetermined numbering rules and numbering sequence, the first transaction request is illegal. If the account information of the participant of the first transaction request does not meet the transaction condition, the first transaction request is illegal.
For example, the first consensus node receives a transaction request initiated by a user a through a terminal device, the transaction request is a user a request and is 1000 yuan to be transferred to a user B, the transaction request includes a digital signature of the user a and basic information of the transaction request, the basic information of the transaction request includes a transaction serial number corresponding to the transaction request, transaction types of the transaction request, account numbers of the user a and the user B and transaction amounts of the transaction request, the transaction serial number corresponding to the transaction request is H5, the transaction type of the transaction request is transfer, and the transaction amount of the transaction request is 1000 yuan. The first consensus node queries the history record of the transaction request, wherein the history record of the transaction request comprises the history records of the user A and the user B, and judges the validity of the basic information of the first transaction request according to the history record of the transaction request, and the method specifically comprises the following steps: and verifying whether the user A and the user B are legal users according to the history record of the transaction request. If the user A and the user B are legal users, verifying whether H5 is the correct transaction sequence number according to the history of the first transaction request. If the transaction request is correct, verifying whether the account balance of the user A is greater than or equal to the transaction amount of the transaction request according to the history record of the first transaction request, and if the account balance is greater than the transaction amount of the transaction request, the basic information of the transaction request meets the legality. For example, user A may have an account balance of 1001 yuan, greater than 1000 yuan, sufficient to support the implementation of the transaction request.
S403, the first consensus node sends a first transaction request to the accounting node, and the accounting node receives the first transaction request.
As can be seen from FIG. 1, the current accounting node is also one of the consensus nodes in the blockchain data storage system. The accounting node is a node selected by all consensus nodes in the blockchain data storage system based on a consensus mechanism, and is used for packaging all transactions in the current accounting period into blocks and writing the blocks into a blockchain ledger of a database server, wherein the blockchain ledger is used for storing complete blockchain data of the blockchain data storage system. The billing period is a preset time period, for example, 10 minutes. The consensus mechanism is a mechanism for the consensus node to achieve the whole network consensus on the block information, can ensure that the latest block is accurately added to the block chain, can ensure that the block chain information stored by the consensus node is consistent and not forked, and can even resist malicious attacks. The consensus mechanism mentioned in the embodiment of the application can be a practical Bayesian fault tolerance algorithm (English: practical Byzantine Fault Tolerance, english abbreviation: PBFT) or a Raft protocol consensus mechanism, and the application is not limited to this.
S404, the billing node verifies the validity of the first transaction request, and if the first transaction request meets the validity, step S405 is executed.
Optionally, the accounting node verifies the validity of the first transaction request, and specifically includes the following steps:
t1, the accounting node verifies whether the digital signature of the initiator of the first transaction request is correct.
And T2, if the digital signature of the initiator of the first transaction request is correct, the accounting node inquires the history record of the first transaction request.
And T3, judging the validity of the basic information of the first transaction request by the accounting node according to the history record of the first transaction request.
Optionally, the accounting node queries the history of the first transaction request, specifically including the steps of: the accounting node queries a local database of the accounting node for a history of the first transaction request. If the history of the first transaction request is not queried from the local database of the accounting node, the accounting node sends a sixth query request to the database server, wherein the sixth query transaction request is used for querying the database server for the history of the first transaction request. The billing node receives a history of the first transaction request sent by the database server.
Optionally, the determining, by the accounting node, validity of the basic information of the first transaction request according to the history of the first transaction request specifically includes: the billing node verifies whether the party to the first transaction request is a legitimate user based on the history of the first transaction request. If the party of the first transaction request is a legal user, the accounting node verifies whether the transaction sequence number of the first transaction request is correct according to the history record of the first transaction request. If the transaction sequence number of the first transaction request is correct, the accounting node verifies whether the first transaction request has transaction double flowers according to the history record of the first transaction request. If the first transaction request does not have transaction double flowers, the accounting node verifies whether the account information of the party of the first transaction request meets the transaction conditions according to the history record of the first transaction request, and if the account information of the party of the first transaction request meets the transaction conditions, the basic information of the first transaction request meets the legitimacy.
The transaction double flower means: if user a initiates a transaction with asset a first, user a initiates a second transaction again with asset a before the transaction is confirmed, i.e., when the transaction for the time period of the transaction has not been packaged into blocks.
S405, when the first accounting period ends, the accounting node encapsulates the first transaction into a first block.
The first block includes a block header of the first block and all transactions within the first billing period. The chunk header of the first chunk includes the last chunk hash value, timestamp, version number, and merkle root.
S406, the accounting node stores the block header of the first block into a local database of the accounting node.
Optionally, the accounting node logs the blockhead of the first block onto a blockchain in a local database of the accounting node.
Optionally, the billing node posts the first block to a blockchain in a local database of the billing node.
It will be appreciated that the accounting node may optionally store the block header or first block of the first block, with the local database of the accounting node storing part of the blockchain data storage system.
Optionally, when the local database of the accounting node has insufficient memory, the transaction information in a part of the blocks may be selectively deleted, and only the block header of the part of the blocks is reserved.
S407, the accounting node sends the first block to the first consensus node, and the first consensus node receives the first block.
The billing node broadcasts a first block that all nodes and database servers in the blockchain data storage system may receive.
S408, the first consensus node stores the block header of the first block to a local database of the first consensus node.
Optionally, the first consensus node logs the block header of the first block onto a blockchain in a local database of the first consensus node.
Optionally, the first consensus node logs the first block onto a blockchain in a local database of the first consensus node.
It will be appreciated that the first consensus node may optionally store a block header of the first block or the first block, with a local database of the first consensus node storing a portion of the blockchain data storage system.
Optionally, when the local database of the first consensus node has insufficient memory, transaction information in a part of the blocks may be selectively deleted, and only the block header of the part of the blocks may be reserved.
S409, the accounting node sends the first block to a database server, and the database server receives the first block.
S410, the database server records the first block into the blockchain ledger.
It will be appreciated that the blockchain ledger has recorded therein the complete blockchain data of the blockchain data storage system.
Alternatively, the database servers adopt a master-slave database structure, that is, the blockchain data storage system comprises 1 master database server and K backup database servers. The main database server and the K backup database servers both store the complete blockchain data of the blockchain data storage system. In the embodiment of the application, in order to avoid performance bottleneck of the main database server, the read operation and the write operation can be separated into different database servers, so that the query performance of the query application server is not influenced when the main database server performs the write operation. By adopting the master-slave database structure, the data in the block chain data storage system can be ensured to have a plurality of disaster recovery copies, and the safety of the data can be improved. When the main database server fails, the system can be immediately switched to other servers, and the availability of the system is improved.
The implementation sequence of S407 and S409 is not limited in the embodiment of the present application.
In the embodiment of the application, the first common node stores the block header of the first block into the local database of the first common node, and the local database of the first common node stores the block header, so that the occupied space of the block chain data in the local memory of the common node can be effectively reduced relative to the storage of complete block data. In addition, although only part of the blockchain data is stored in the local database of the first consensus node, the first consensus node still has the function of verifying the validity of the transaction request through the scheme in the embodiment of the application. In the embodiment of the application, the accounting node stores the block header of the first block into the local database of the accounting node, and the local database of the accounting node stores the block header, so that the occupied space of the block chain data in the local memory of the accounting node can be effectively reduced relative to the storage of the complete block data. In addition, although only part of the blockchain data is stored in the local database of the accounting node, the accounting node still has the function of verifying the validity of the transaction request through the scheme in the embodiment of the application. In the implementation of the application, the first block is recorded into the blockchain ledger through the database server, and the complete blockchain data is stored in the database server, so that the completeness of the blockchain data storage system is ensured.
Optionally, as shown in fig. 5, the above blockchain data storage method further includes:
s411, the first consensus node receives a first query request, wherein the first query request is used for querying a second transaction.
Alternatively, the initiator of the first query request may be any node in the blockchain data storage system, or may be a terminal device that accesses the blockchain data storage system.
Optionally, the first query request includes a transaction sequence number of the second transaction.
Optionally, the first query request includes a timestamp of the second transaction and a transaction serial number of the second transaction.
S412, the first consensus node queries the second transaction from the local database of the first consensus node, and if the second transaction is not queried, step S413 is executed.
Optionally, the first query request includes a transaction sequence number of the second transaction, and the first consensus node queries the second transaction from a local database of the first consensus node according to the transaction sequence number of the second transaction.
Optionally, the first query request includes a timestamp of the second transaction and a transaction serial number of the second transaction. The first consensus node locates a second block in which the second transaction is located in the local database according to the timestamp of the second transaction, and queries the second transaction from the second block according to the transaction sequence number of the second transaction.
It can be understood that if the block in which the second transaction is located includes a block header and does not include transaction data, the first consensus node cannot query the second transaction from the second block according to the transaction sequence number of the second transaction.
Optionally, if the second transaction is queried, the first consensus node sends a query result of the first query request to the initiator of the first query request, and if the second transaction is not queried, the first consensus node executes step S413.
S413, the first consensus node sends a second query request to the database server, the second query request is used for querying a second transaction, and the database server receives the second query request.
Optionally, the first consensus node sends a second query request and a block header of the second block to the database server, and the database server receives the first query request and the block header of the second block.
S414, the database server inquires about the second transaction.
Optionally, the database server receives a second query request, where the second query request includes a transaction sequence number of the second transaction. The database server queries the second transaction from the blockchain ledger in the database server according to the transaction sequence number of the second transaction.
Optionally, the database server receives a second query request, where the second query request includes a timestamp of the second transaction and a transaction serial number of the second transaction, and locates a third block where the second transaction is located on the blockchain ledger according to the timestamp of the second transaction, and queries the second transaction from the third block according to the transaction serial number of the second transaction.
Optionally, the database server receives a second query request and a block header of the second block, where the second query request includes a timestamp of the second transaction and a transaction sequence number of the second transaction. The database server searches a third block corresponding to the block header of the second block on the blockchain ledger, and then inquires the second transaction in the third block according to the transaction serial number of the second transaction.
S415, the database server sends the query result of the second query request to the first consensus node, and the first consensus node receives the query result of the second query request.
Optionally, the query result of the second query request includes the complete data of the second transaction and the verification path of the second transaction.
Optionally, the first consensus node verifies a verification path of the second transaction according to the blockchain data of the local database, and if the verification paths of the second transaction are all correct, the third transaction is indicated to be truly present.
It will be appreciated that the first consensus node maintains the blockheads of all the blocks of the blockchain ledger, and thus the first consensus node can verify the verification path of the second transaction.
In the implementation of the application, the first block is recorded into the blockchain account book through the database server, the complete blockchain data is stored in the database server, and the integrity of the blockchain data storage system is ensured, so that the database server can realize the transaction inquiry function, thereby providing inquiry service for the consensus node. In the embodiment of the application, although only part of the blockchain data is stored in the local database of the first consensus node, the first consensus node still has a transaction inquiry function through the scheme in the embodiment of the application.
Optionally, as shown in fig. 6, the above blockchain data storage method further includes:
s416, the accounting node receives a third query request, the third query request being for querying a third transaction.
Optionally, the initiator of the third query request may be any node in the blockchain data storage system, or may be a terminal device accessing the blockchain data storage system.
Optionally, the third query request includes a transaction sequence number of the third transaction.
Optionally, the third query request includes a timestamp of the third transaction and a transaction sequence number of the third transaction.
S417, the accounting node queries the third transaction from the local database of the accounting node, and if the third transaction is not queried, the step S418 is executed.
Optionally, the third query request includes a transaction sequence number of the third transaction, and the accounting node queries the third transaction from a local database of the accounting node according to the transaction sequence number of the third transaction.
Optionally, the third query request includes a timestamp of the third transaction and a transaction sequence number of the third transaction. The accounting node locates a fourth block where the third transaction is located in the local database according to the timestamp of the third transaction, and queries the third transaction from the fourth block according to the transaction serial number of the third transaction.
It will be appreciated that if the block in which the third transaction is located includes a block header and does not include transaction data, the accounting node cannot query the fourth block for the third transaction based on the transaction sequence number of the third transaction.
Optionally, if the third transaction is queried, the accounting node sends the query result of the third query request to the initiator of the third query request, and if the third transaction is not queried, the accounting node performs step S418.
S418, the accounting node sends a fourth query request to the database server, and the database server receives the fourth query request.
Optionally, the accounting node sends a fourth query request and a block header of the fourth block to the database server, and the database server receives the fourth query request and the block header of the fourth block.
S419, the database server inquires a third transaction.
Optionally, the database server receives a fourth query request, where the fourth query request includes a transaction sequence number of the third transaction. The database server queries the third transaction from the blockchain ledger in the database server according to the transaction sequence number of the third transaction.
Optionally, the database server receives a fourth query request, where the fourth query request includes a timestamp of the third transaction and a transaction serial number of the third transaction, and locates a fifth block where the third transaction is located on the blockchain ledger according to the timestamp of the third transaction, and queries the third transaction from the fifth block according to the transaction serial number of the third transaction.
Optionally, the database server receives a fourth query request and a block header of a fourth block, where the fourth query request includes a timestamp of the third transaction and a transaction sequence number of the third transaction. The database server searches a fifth block corresponding to the block header of the fourth block on the blockchain ledger, and then inquires the third transaction in the fifth block according to the transaction serial number of the third transaction.
S420, the database server sends a query result of the fourth query request to the accounting node.
Optionally, the query result of the fourth query request includes the data of the complete third transaction and the verification path of the third transaction.
Optionally, the accounting node verifies a verification path of the third transaction according to the blockchain data of the local database, and if the verification paths of the third transaction are all correct, the accounting node indicates that the third transaction is truly present.
It will be appreciated that the accounting node maintains the blockheads of all the blocks of the blockchain ledger, and thus the accounting node can verify the verification path of the third transaction.
The implementation sequence of S411 and S416 is not limited in the embodiment of the present application.
In the implementation of the application, the first block is recorded into the blockchain ledger through the database server, the complete blockchain data is stored in the database server, and the integrity of the blockchain data storage system is ensured, so that the database server can realize the transaction inquiry function, thereby providing inquiry service for the accounting node. In the implementation of the present application, although only a part of blockchain data is stored in the local database of the accounting node, the accounting node still has the transaction inquiry function through the scheme in the embodiment of the present application.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a blockchain data storage device 700 according to an embodiment of the application, which can implement the function of the first common node in the blockchain data storage method. The functions of the device can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes at least one module corresponding to the above functions.
Optionally, the apparatus includes a first receiving unit 701, a first verifying unit 703, a first transmitting unit 703, and a first storing unit 704.
The first receiving unit 701 is configured to receive a first transaction request.
A first verification unit 702, configured to verify the validity of the first transaction request.
A first sending unit 703, configured to send the first transaction request to an accounting node if the first transaction request meets the validity.
The first receiving unit 701 is further configured to receive a first block sent by the accounting node, where the first block is generated according to the first transaction request.
A first storage unit 704, configured to store a block header of the first block.
Optionally, the blockchain data storage device 700 further includes:
the first receiving unit 701 is further configured to receive a first query request, where the first query request is used to query the second transaction.
A second querying unit configured to query a second transaction from a local database of the blockchain data storage device 700.
The first sending unit 703 is further configured to send a second query request to the database server if the second transaction is not queried from the local database of the blockchain data storage device 400, where the second query request is used to query the second transaction.
The first receiving unit 701 is further configured to receive a query result of the second query request sent by the database server.
Optionally, the first transaction request includes: the digital signature of the initiator of the first transaction request and the basic information of the first transaction request, wherein the basic information of the first transaction request comprises a transaction serial number corresponding to the first transaction request and a transaction type of the first transaction request.
Optionally, the first verification unit specifically includes 702: the device comprises a third verification unit, a third query unit and a judgment unit.
And the third verification unit is used for verifying whether the digital signature of the first transaction request initiator is correct.
And the third inquiring unit is used for inquiring the history record of the first transaction request if the digital signature of the first transaction request initiator is correct.
And the judging unit is used for judging the validity of the basic information of the first transaction request according to the history record of the first transaction request.
Referring to fig. 8, fig. 8 is a schematic diagram of a blockchain data storage device 800 that can implement the accounting node function in the blockchain data storage method according to the embodiment of the application. The functions of the device can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes at least one module corresponding to the above functions.
Optionally, the apparatus includes a second receiving unit 801, a second verifying unit 802, a packaging unit 803, a second storing unit 804, and a second transmitting unit 805.
A second receiving unit 801, configured to receive a first transaction request sent by a first consensus node.
A second verification unit 802, configured to verify the validity of the first transaction request.
A packaging unit 803 for packaging the first transaction request into the first block when the first accounting period is over if the first transaction request meets the validity
The second storage unit 804 is configured to store the block header of the first block.
The second sending unit 805 is configured to broadcast the first block and send the first block to the first consensus node and the database server.
Optionally, the blockchain data storage device 800 further includes:
The second receiving unit 801 is further configured to receive a third query request, where the third query request is used to query a third transaction.
A fourth querying unit configured to query the local database of the blockchain data storage device 800 for the third transaction.
The second sending unit 805 is further configured to send a fourth query request to the database server if the third transaction is not queried from the local database of the blockchain data storage device 800, where the fourth query request is used to query the third transaction.
The second receiving unit 801 is further configured to receive a query result of the fourth query request sent by the database server.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a blockchain data storage device 700 according to an embodiment of the application, which can implement the functions of a database server in the blockchain data storage method. The functions of the device can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes at least one module corresponding to the above functions.
Optionally, the apparatus includes a third receiving unit 901, a third storing unit 902, a first querying unit 903, and a third transmitting unit 904.
A third receiving unit 901, configured to receive the first block sent by the accounting node.
And a third storage unit 902, configured to record the first block into the blockchain ledger.
The third receiving unit 901 is further configured to receive a second query request sent by the first consensus node, where the second query request is used to query a second transaction.
A first querying unit 903, configured to query the second transaction.
And a third sending unit 904, configured to send a query result of the second query request to the first consensus node.
Or, the third receiving unit 901 is further configured to receive a fourth query request sent by the accounting node, where the fourth query request is used to query the third transaction.
A first querying unit 903, configured to query the third transaction.
A third sending unit 904, configured to send a query result of the fourth query request to the accounting node.
The steps of a method or algorithm described in connection with the present disclosure may be embodied in hardware, or may be embodied in software instructions executed by a processor. The software instructions may be comprised of corresponding software units that may be stored in random access memory (english: random access memory; RAM), flash memory, read Only Memory (ROM), erasable programmable read only memory (english: erasable programmable ROM; EPROM), electrically erasable programmable read only memory (english: electrically EPROM; EEPROM), registers, hard disk, removable disk, compact disc read only memory (CD-ROM), or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. In addition, the ASIC may reside in a network device. The processor and the storage medium may reside as discrete components in a network device.
Those skilled in the art will appreciate that in one or more of the examples described above, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, these functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The foregoing detailed description of the embodiments of the present application further illustrates the purposes, technical solutions and advantageous effects of the embodiments of the present application, and it should be understood that the foregoing description is only a specific implementation of the embodiments of the present application, and is not intended to limit the scope of the embodiments of the present application, and any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application should be included in the scope of the embodiments of the present application.

Claims (10)

1. A method of blockchain data storage, the method comprising:
the first consensus node receives a first transaction request;
the first consensus node verifies the validity of the first transaction request;
if the first transaction request meets the legitimacy, the first consensus node sends the first transaction request to an accounting node;
the first consensus node receives a first block sent by the accounting node, the first block is generated by the accounting node according to the first transaction request, the accounting node is used for packaging all transactions in a current accounting period into blocks, the blocks are written into a blockchain account book of a database server, and the blockchain account book is used for storing complete blockchain data of a blockchain data storage system;
the first consensus node stores a block header of the first block to a local database of the first consensus node.
2. The method according to claim 1, wherein the method further comprises:
the first consensus node receives a first query request, the first query request being for querying a second transaction;
the first consensus node queries the second transaction from a local database of the first consensus node;
If the first consensus node does not inquire the second transaction from the local database of the first consensus node, sending a second inquiry request to a database server, wherein the second inquiry request is used for inquiring the second transaction;
and the first consensus node receives a query result of the second query request sent by the database server.
3. The method according to any one of claims 1 or 2, wherein the first transaction request comprises:
the digital signature of the initiator of the first transaction request and the basic information of the first transaction request, wherein the basic information of the first transaction request comprises a transaction serial number corresponding to the first transaction request and a transaction type of the first transaction request.
4. A method according to claim 3, wherein the first consensus node verifies the validity of the first transaction request, in particular comprising:
the first consensus node verifies whether the digital signature of the first transaction request initiator is correct;
if so, inquiring a history record of the first transaction request;
and judging the validity of the basic information of the first transaction request according to the history record of the first transaction request.
5. A method of blockchain data storage, the method comprising:
the accounting node receives a first transaction request sent by a first consensus node;
the billing node verifies the validity of the first transaction request;
if the first transaction request meets the legitimacy, the billing node encapsulates the first transaction into a first block when a first billing period ends;
the accounting node storing a block header of the first block to a local database of the accounting node;
the accounting node sends the first block to the first consensus node and a database server, so that the first consensus node stores a block header of the first block into a local database of the first consensus node, so that the database server records the first block into a blockchain ledger, and the blockchain ledger is used for storing complete blockchain data of a blockchain data storage system.
6. The method of claim 5, wherein the method further comprises:
the billing node receiving a third query request for querying a third transaction;
the billing node querying the third transaction from a local database of the billing node;
If the accounting node does not inquire the third transaction from the local database of the accounting node, sending a fourth inquiry request to a database server, wherein the fourth inquiry request is used for inquiring the third transaction;
and the accounting node receives the query result of the fourth query request sent by the database server.
7. A method of blockchain data storage, the method comprising:
the method comprises the steps that a database server receives a first block sent by an accounting node, wherein the first block is generated by the accounting node according to a first transaction request, and the first transaction request is sent to the accounting node by a first consensus node;
the database server records the first block into a blockchain ledger, wherein the blockchain ledger is used for storing complete blockchain data of a blockchain data storage system, and block heads of the first block are respectively stored in local databases of the first consensus node and the accounting node;
the database server receives a second query request and a block header of a second block, wherein the second query request is sent by the first consensus node and is used for querying a second transaction, and the second query request comprises a timestamp and a transaction sequence number of the second transaction;
The database server queries the second transaction;
the database server sends the query result of the second query request to the first consensus node;
or the database server receives a fourth query request and a block header of a fourth block, wherein the fourth query request is sent by an accounting node and is used for querying a third transaction, and the fourth query request comprises a time stamp and a transaction sequence number of the third transaction;
the database server queries the third transaction;
the database server sends the query result of the fourth query request to the billing node.
8. A consensus node, comprising:
a processor, a memory, a transceiver, and a bus; the processor, the memory and the transceiver are connected through the bus and communicate with each other; the memory stores executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory for executing the blockchain data storage method of any of claims 1 to 4.
9. A billing node comprising:
a processor, a memory, a transceiver, and a bus; the processor, the memory and the transceiver are connected through the bus and communicate with each other; the memory stores executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory for executing the blockchain data storage method of any of claims 5 to 6.
10. A database server, comprising:
a processor, a memory, a transceiver, and a bus; the processor, the memory and the transceiver are connected through the bus and communicate with each other; the memory stores executable program code; the processor runs a program corresponding to executable program code stored in the memory by reading the executable program code for performing the blockchain data storage method of claim 7.
CN201811464549.0A 2018-11-30 2018-11-30 Block chain data storage method and device Active CN109726229B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811464549.0A CN109726229B (en) 2018-11-30 2018-11-30 Block chain data storage method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811464549.0A CN109726229B (en) 2018-11-30 2018-11-30 Block chain data storage method and device

Publications (2)

Publication Number Publication Date
CN109726229A CN109726229A (en) 2019-05-07
CN109726229B true CN109726229B (en) 2023-10-10

Family

ID=66295154

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811464549.0A Active CN109726229B (en) 2018-11-30 2018-11-30 Block chain data storage method and device

Country Status (1)

Country Link
CN (1) CN109726229B (en)

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096522B (en) * 2019-05-15 2023-07-28 西安电子科技大学 Block chain data processing method, device and equipment supporting relational retrieval
CN110309163A (en) * 2019-06-28 2019-10-08 杭州复杂美科技有限公司 Block chain relation type database maintenance method and data query method
US10789222B2 (en) 2019-06-28 2020-09-29 Alibaba Group Holding Limited Blockchain-based hierarchical data storage
US11036720B2 (en) 2019-06-28 2021-06-15 Advanced New Technologies Co., Ltd. Blockchain-based hierarchical data storage
CN110334154B (en) * 2019-06-28 2020-07-21 阿里巴巴集团控股有限公司 Block chain based hierarchical storage method and device and electronic equipment
WO2019179540A2 (en) 2019-07-11 2019-09-26 Alibaba Group Holding Limited Shared blockchain data storage
CN111108478B (en) 2019-07-11 2023-11-21 创新先进技术有限公司 Method, system and apparatus for communicating and sharing blockchain data
WO2019179538A2 (en) 2019-07-11 2019-09-26 Alibaba Group Holding Limited Shared blockchain data storage
CN110471987B (en) * 2019-08-09 2023-02-21 全链通有限公司 Data storage method, device and computer readable storage medium
CN110473106A (en) * 2019-08-21 2019-11-19 腾讯科技(深圳)有限公司 A kind of method and relevant apparatus of trading processing
CN110535969B (en) * 2019-09-16 2021-06-15 腾讯科技(深圳)有限公司 Data storage method, device, storage medium and equipment based on block chain network
CN110597835B (en) * 2019-09-17 2024-02-27 深圳前海微众银行股份有限公司 Transaction data deleting method and device based on blockchain
CN112527825B (en) * 2019-09-19 2022-12-06 上海哔哩哔哩科技有限公司 Data storage method and device and computer equipment
CN111046107B (en) * 2019-12-19 2023-05-26 北京中兵智航科技有限公司 Distributed storage system based on airport center data of block chain technology
CN113032478B (en) * 2019-12-24 2023-10-31 航天信息股份有限公司 Block chain system and data uplink method, device, equipment and medium
CN111818167B (en) * 2020-07-09 2021-09-07 广州知弘科技有限公司 High-security resource transfer method based on block chain
CN112118124B (en) * 2020-08-03 2022-05-03 西安电子科技大学 Block chain construction method, system, storage medium, computer equipment and application
CN112488833A (en) * 2020-11-24 2021-03-12 成都质数斯达克科技有限公司 Transaction processing method and device, electronic equipment and readable storage medium
CN112561532B (en) * 2021-01-31 2024-04-19 云南花伍科技有限公司 Block chain-based secure transaction system and method
CN113572620B (en) * 2021-09-27 2021-12-24 中邮消费金融有限公司 On-line voting method and system based on block chain

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107180350A (en) * 2017-03-31 2017-09-19 唐晓领 A kind of method of the multi-party shared transaction metadata based on block chain, apparatus and system
CN107317672A (en) * 2017-05-10 2017-11-03 广东网金控股股份有限公司 A kind of light weight terminating machine block catenary system
WO2018080207A1 (en) * 2016-10-26 2018-05-03 주식회사 코인플러그 Method for issuing currency and making payment by managing balance database for each block in blockchain and server using same
CN108512939A (en) * 2018-04-17 2018-09-07 深圳市元征科技股份有限公司 A kind of block chain common recognition method, apparatus and relevant device
CN108665359A (en) * 2017-03-29 2018-10-16 中国移动通信有限公司研究院 Block chain processing method, accounting nodes and verification node
CN108769173A (en) * 2018-05-21 2018-11-06 阿里体育有限公司 The block chain implementation method and equipment of the intelligent contract of operation
CN108776929A (en) * 2018-04-02 2018-11-09 成都云创智融科技有限公司 Bill processing method, system based on block chain database and readable storage medium storing program for executing
CN108805570A (en) * 2018-06-01 2018-11-13 腾讯科技(深圳)有限公司 Data processing method, device and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101849917B1 (en) * 2016-10-13 2018-05-31 주식회사 코인플러그 Method for providing certificate service based on smart contract and server using the same
CN107040585B (en) * 2017-02-22 2020-06-19 创新先进技术有限公司 Service checking method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018080207A1 (en) * 2016-10-26 2018-05-03 주식회사 코인플러그 Method for issuing currency and making payment by managing balance database for each block in blockchain and server using same
CN108665359A (en) * 2017-03-29 2018-10-16 中国移动通信有限公司研究院 Block chain processing method, accounting nodes and verification node
CN107180350A (en) * 2017-03-31 2017-09-19 唐晓领 A kind of method of the multi-party shared transaction metadata based on block chain, apparatus and system
CN107317672A (en) * 2017-05-10 2017-11-03 广东网金控股股份有限公司 A kind of light weight terminating machine block catenary system
CN108776929A (en) * 2018-04-02 2018-11-09 成都云创智融科技有限公司 Bill processing method, system based on block chain database and readable storage medium storing program for executing
CN108512939A (en) * 2018-04-17 2018-09-07 深圳市元征科技股份有限公司 A kind of block chain common recognition method, apparatus and relevant device
CN108769173A (en) * 2018-05-21 2018-11-06 阿里体育有限公司 The block chain implementation method and equipment of the intelligent contract of operation
CN108805570A (en) * 2018-06-01 2018-11-13 腾讯科技(深圳)有限公司 Data processing method, device and storage medium

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
区块链中的隐私保护技术;翟社平;杨媛媛;张海燕;赵江明;;西安邮电大学学报(第05期);全文 *
区块链全局账本数据的拆分技术研究;于雷;金岩;;高技术通讯(第Z2期);全文 *
区块链技术在数字资产安全交易中的应用;韩爽;蒲宝明;李顺喜;李相泽;张笑东;王帅;;计算机系统应用(第03期);全文 *
区块链技术在数字资产安全交易中的应用;韩爽等;《计算机系统应用》;20180315(第03期);全文 *
许可链多中心动态共识机制;闵新平;李庆忠;孔兰菊;张世栋;郑永清;肖宗水;;计算机学报(第05期);全文 *

Also Published As

Publication number Publication date
CN109726229A (en) 2019-05-07

Similar Documents

Publication Publication Date Title
CN109726229B (en) Block chain data storage method and device
CN112446785B (en) Cross-chain transaction method, system, device, equipment and storage medium
CN111144881B (en) Selective access to asset transfer data
EP3816923B1 (en) Blockchain-based private transactions and usage method and apparatus therefor
CN111797159A (en) Information management and access control in a database
CN110839029B (en) Micro-service registration method and device
WO2018213880A1 (en) System for blockchain based domain name and ip number register
CN111444273B (en) Data authorization method and device based on block chain
EP2478661A1 (en) Trusted message storage and transfer protocol and system
US11356258B2 (en) Methods and systems for distributed cryptographically secured data validation
CN111476573B (en) Account data processing method, device, equipment and storage medium
CN110336779B (en) Block chain construction method and device and electronic equipment
CN113255014B (en) Data processing method based on block chain and related equipment
CN111899019A (en) Method and system for cross validation and sharing of blacklist and multiple parties
JP2023530594A (en) Permitted Event Processing in Distributed Databases
CN113315630A (en) Block chain, quantum key distribution method and device
CN115001707B (en) Device authentication method based on block chain and related device
CN116781269A (en) Block chain-based data processing method, device, equipment, medium and product
CN111369332A (en) Data processing method and device based on block chain
CN111626735B (en) Data interaction system, method and module
CN117172913B (en) Intelligent contract-based contract change procedure execution method and system
US11870883B2 (en) Blockchain-based data management of distributed binary objects
CN109658100B (en) System and method for determining downlink digital assets
CN115880088A (en) Accounting processing method, access server, node server and accounting processing system
WO2024011863A9 (en) Communication method and apparatus, sim card, electronic device, and terminal device

Legal Events

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