CN111858751A - Data storage method and device based on block chain - Google Patents

Data storage method and device based on block chain Download PDF

Info

Publication number
CN111858751A
CN111858751A CN202010602292.1A CN202010602292A CN111858751A CN 111858751 A CN111858751 A CN 111858751A CN 202010602292 A CN202010602292 A CN 202010602292A CN 111858751 A CN111858751 A CN 111858751A
Authority
CN
China
Prior art keywords
nodes
block chain
node
hash value
accounting
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
CN202010602292.1A
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.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202010602292.1A priority Critical patent/CN111858751A/en
Publication of CN111858751A publication Critical patent/CN111858751A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The invention relates to the field of block chains, and provides a data storage method and device based on a block chain. In one aspect, the method comprises: monitoring account states of all nodes on a block chain, wherein the block chain comprises all nodes and light nodes; when the account state of the first full node changes, submitting an accounting task to the block chain; performing identity verification on the first full node; and after the identity authentication is passed, broadcasting the accounting task to the light nodes on the block chain, and synchronously storing the feedback data of the light nodes as the accounting data of the accounting task to all full nodes on the block chain. The invention solves the technical problem of large memory space occupied by the block chain system in the related technology, reduces the hardware use consumption of the block nodes and lowers the access threshold of the block client.

Description

Data storage method and device based on block chain
[ technical field ] A method for producing a semiconductor device
The present invention relates to the field of blockchains, and in particular, to a method and an apparatus for storing data based on blockchains.
[ background of the invention ]
In the related art, a lot of research and development and investment are started for the infrastructure of the block chain in various industries, including the current intelligent contracts, the block chain is extended to more and more fields, such as public chain notarization systems, second-hand commodity transaction APP applications, private chains and the like, a very huge block chain combination is formed, but the disadvantages of a decentralized system are gradually expanded.
In the related art, taking the best application bitcoin on the blockchain as an example, the requirement on the client itself is really too high, for a node machine, when you start to use bitcoin, the data needs to be synchronized, and the synchronization process starts from the starting block, when you first open the application program, the core client starts data synchronization, the downloading is slow due to the massive data, the bitcoin is only an application of the current blockchain, when a new blockchain application is gradually increased, since the current client is the light application client of the tamper-able centralized system, but the center is removed based on the blockchain technology, rather, the total amount of the center is given to each node, which makes the node application become very large in the future, and the data stored locally at each node is also very large, very large consumption of hardware is generated for the nodes.
In view of the above problems in the related art, no effective solution has been found at present.
[ summary of the invention ]
In view of this, embodiments of the present invention provide a data storage method and apparatus based on a block chain.
In one aspect, an embodiment of the present invention provides a data storage method based on a block chain, where the method includes: monitoring account states of all nodes on a block chain, wherein the block chain comprises all nodes and light nodes; when the account state of the first full node changes, submitting an accounting task to the block chain; performing identity verification on the first full node; and after the identity authentication is passed, broadcasting the accounting task to the light nodes on the block chain, and synchronously storing the feedback data of the light nodes as the accounting data of the accounting task to all full nodes on the block chain.
Optionally, the performing identity verification on the first full node includes: locally reading a first hash value of the first full node, and acquiring a second hash value of the first full node according to the first hash value, wherein the second hash value is stored on a client of the first full node; comparing whether the first hash value and the second hash value are consistent; if the first hash value is consistent with the second hash value, determining that the identity authentication is passed; and if the first hash value is inconsistent with the second hash value, determining that the identity authentication is not passed.
Optionally, the obtaining a second hash value of the first full node according to the first hash value includes: determining the block identifier of the block to which the first hash value belongs; reading a second hash value of the block stored on the client in the memory of the first full node by taking the block identifier as an index; and if the reading fails, continuously reading a third hash value of a second full node, and obtaining a second hash value of the first full node through the third hash calculation, wherein the second full node is an adjacent block node of the first full node.
Optionally, the broadcasting the accounting task to the light node on the block chain includes: splitting the accounting task into a plurality of subtasks; broadcasting the plurality of subtasks to all light nodes on the blockchain to enable all light nodes to compete for accounting rights for the plurality of subtasks based on a workload justification POW algorithm.
Optionally, the step of synchronously storing the feedback data of the light node as the accounting data of the accounting task to all full nodes on the block chain includes: receiving M sub-hashes respectively fed back by M light nodes based on a plurality of subtasks, wherein the accounting task comprises the subtasks, and M is a positive integer greater than 1; and splicing the M sub-hashes to obtain accounting data of the accounting task, and synchronously storing the accounting data to all full nodes on the block chain.
Optionally, the concatenating the M sub-hashes includes at least one of: splicing the M sub-hashes in sequence based on the feedback time of the M sub-hashes; and splicing the M sub-hashes based on the task identifiers of the plurality of sub-tasks.
Optionally, before monitoring the account status of all nodes on the blockchain, the method further includes: setting a node machine on the block chain through an intelligent contract, and establishing a communication link between the node machine and each full node; and synchronously storing the key information of each full node locally in the node machine, wherein the key information carries the hash value of the full node.
In another aspect, an embodiment of the present invention provides a data storage device based on a block chain, where the data storage device includes: the system comprises a monitoring module, a judging module and a judging module, wherein the monitoring module is used for monitoring the account state of all nodes on a block chain, and the block chain comprises all nodes and light nodes; the submitting module is used for submitting an accounting task to the block chain when the account state of the first full node changes; the verification module is used for carrying out identity verification on the first full node; and the storage module is used for broadcasting the accounting task to the light nodes on the block chain after the identity authentication is passed, and synchronously storing the feedback data of the light nodes serving as the accounting data of the accounting task to all the full nodes on the block chain.
Optionally, the verification module includes: a reading unit, configured to locally read a first hash value of the first full node, and obtain a second hash value of the first full node according to the first hash value, where the second hash value is stored on a client of the first full node; a comparison unit configured to compare whether the first hash value and the second hash value are consistent; the determining unit is used for determining that the identity authentication is passed if the first hash value is consistent with the second hash value; and if the first hash value is inconsistent with the second hash value, determining that the identity authentication is not passed.
Optionally, the reading unit includes: a determining subunit, configured to determine a block identifier of a block to which the first hash value belongs; a reading subunit, configured to read, in the memory of the first full node, a second hash value stored in the chunk on the client using the chunk identifier as an index; and if the reading fails, continuously reading a third hash value of a second full node, and obtaining a second hash value of the first full node through the third hash calculation, wherein the second full node is an adjacent block node of the first full node.
Optionally, the storage module includes: the splitting unit is used for splitting the accounting task into a plurality of subtasks; a broadcasting unit, configured to broadcast the plurality of subtasks to all light nodes on the block chain, so that all light nodes compete for accounting rights of the plurality of subtasks based on a workload certification POW algorithm.
Optionally, the storage module includes: the receiving unit is used for receiving M sub-hashes which are respectively fed back by M light nodes based on a plurality of subtasks, wherein the accounting task comprises the plurality of subtasks, and M is a positive integer greater than 1; and the splicing unit is used for splicing the M sub-hashes to obtain the accounting data of the accounting task, and synchronously storing the accounting data to all full nodes on the block chain.
Optionally, the splicing unit includes at least one of: a first splicing subunit, configured to splice the M sub-hashes in order based on feedback times of the M sub-hashes; and the second splicing subunit is used for splicing the M sub-hashes based on the task identifiers of the plurality of sub-tasks.
Optionally, the apparatus further comprises: the system comprises a setting module, a monitoring module and a sending module, wherein the setting module is used for setting a node machine on a block chain through an intelligent contract and establishing a communication link between the node machine and each full node before the monitoring module monitors the account state of the full node on the block chain; and the synchronization module is used for synchronously storing the key information of each full node locally in the node machine, wherein the key information carries the hash value of the full node.
According to a further embodiment of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the invention, the account states of all nodes on the block chain are monitored, when the account state of the first all node changes, the accounting task is submitted to the block chain, after the identity verification of the first all node passes, the accounting task is broadcasted to the light node on the block chain, the feedback data of the light node is synchronously stored to all the all nodes on the block chain as the accounting data of the accounting task, the accounting data is broadcasted to all the nodes on the block chain, the accounting task is executed by calling the light node, the storage times of the same accounting data on the block chain can be reduced while decentralization is carried out, the technical problem that a block chain system in the related technology occupies a large storage capacity is solved, the hardware use consumption of the block nodes is reduced, and the access threshold of a block client is reduced.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
FIG. 1 is a block diagram of a hardware architecture of a blockchain-based data storage computer according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of blockchain-based data storage according to an embodiment of the present invention;
FIG. 3 is a block chain system architecture diagram of an embodiment of the present invention;
fig. 4 is a block diagram of a data storage device based on a block chain according to an embodiment of the present invention.
[ detailed description ] embodiments
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Example 1
The method provided by the first embodiment of the present application may be executed in a server, a computer, or a similar computing device. Taking a computer as an example, fig. 1 is a block diagram of a hardware structure of a data storage computer based on a blockchain according to an embodiment of the present invention. As shown in fig. 1, computer 10 may include one or more (only one shown in fig. 1) processors 102 (processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and optionally may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those of ordinary skill in the art that the configuration shown in FIG. 1 is illustrative only and is not intended to limit the configuration of the computer described above. For example, computer 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used for storing computer programs, for example, software programs and modules of application software, such as a computer program corresponding to the data storage method based on the blockchain in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, implementing the above-mentioned methods. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory located remotely from processor 102, which may be connected to computer 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of such networks may include wireless networks provided by the communications provider of computer 10. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In this embodiment, a data storage method based on a block chain is provided, and fig. 2 is a flowchart of the data storage method based on a block chain according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, monitoring account states of all nodes on a block chain, wherein the block chain comprises all nodes and light nodes;
in the blockchain, two types of nodes are included, namely a full node and a light node, the full node is a node for synchronously storing all blockchain data, the light node is a node for only storing a block header (for tracking a prefix node by using a distributed hash table or searching accounting data on the full node), and the light node and the full node can be converted into each other.
Step S204, when the account state of the first full node changes, an accounting task is submitted to the block chain;
the first full node in this embodiment is any node in all full nodes in the block chain, and when it is monitored that accounting operation occurs on the full node, such as transfer-in and transfer-out of a virtual asset, an account state changes, and in order to implement non-centralized data synchronization of the block chain, other full nodes in the block chain need to be notified;
step S206, carrying out identity authentication on the first full node;
the authenticity of the user is verified, and the decentralized centralized system can ensure that the data of the client cannot be tampered;
and step S208, after the identity authentication is passed, broadcasting the accounting task to the light nodes on the block chain, and synchronously storing the feedback data of the light nodes as the accounting data of the accounting task to all the full nodes on the block chain.
In the embodiment, the block packaging of the link data is performed by acquiring the information log of the test link in the interaction process as the test data, and the single-node consensus mechanism of the consensus algorithm is used to write the test data into the block chain.
According to the scheme of the embodiment, the account states of all nodes on the block chain are monitored, when the account state of a first all node changes, the accounting task is submitted to the block chain, after the identity verification of the first all node passes, the accounting task is broadcasted to the light node on the block chain, the feedback data of the light node is taken as the accounting data of the accounting task and is synchronously stored in all the all nodes on the block chain, the accounting data is broadcasted to all the nodes on the block chain, the accounting task is executed by calling the light node, the storage times of the same accounting data on the block chain can be reduced while decentralization is carried out, the technical problem that a block chain system in the related technology occupies a large storage capacity is solved, the hardware use consumption of the block nodes is reduced, and the access threshold of a block client is reduced.
The execution main body of the embodiment is a blockchain client, a mobile phone, a tablet, a computer, a server, and the like, and can also be applied to a data processing system or a business system such as a service background, a service middle desk, and the like.
In this embodiment, before monitoring the account status of all nodes on the blockchain, the method further includes: setting a node machine on the block chain through an intelligent contract, and establishing a communication link between the node machine and each full node; and synchronously storing the key information of each full node locally in the node machine, wherein the key information carries the hash value of the full node.
Selecting all nodes in a block chain, assigning node machines to all nodes through intelligent combination, and synchronizing keys of all nodes (the keys store hash values and are used for identifying the blocks and tracing the blocks through the whole chain); and establishing a communication link between the node machine and the whole node for realizing information interaction between the node machine and the whole node.
The block chain can generate keys without limitation, each block chain is generated to represent one user node, so that the node machine can be used as a non-centralized system, and a writing netty service (providing an asynchronous and event-driven network application program framework and tools for rapidly developing a high-performance and high-reliability network server and a client program) is built on the node machine, so that the whole nodes on the block chain are controlled on the basis of the node machine through the client. The node machine of the embodiment is a server of one block in a block chain, different from a traditional block node, the block has one more web server service, tasks are mainly sent to other nodes and are also called special capacity blocks, the traditional block is a single recording block written into the block, the node machine of the embodiment records the block and then distributes the tasks to a certain client to generate data, and then the data are combined to start accounting processing and are restored.
In this embodiment, the performing authentication on the first full node includes:
s11, locally reading a first hash value of the first full node, and obtaining a second hash value of the first full node according to the first hash value, wherein the second hash value is stored on the client of the first full node;
in this embodiment, the first hash value is identification information of the first full node, and is a unique identity of the first full node on the blockchain, and the blockchain is obtained by performing hash algorithm conversion on the historical accounting task when the first full node is generated. The hash value of the block chain can uniquely and accurately identify one block, any node in the block chain obtains the hash value of the block through specific hash calculation, and the fact that the calculated hash value is not changed means that information in the block chain is not tampered, and identity authentication is passed.
In an implementation manner of this embodiment, obtaining the second hash value of the first full node according to the first hash value includes: determining the block identifier of the block to which the first hash value belongs; reading a second hash value stored on the client side by the block in the memory of the first full node by taking the block identifier as an index; and if the reading fails, continuously reading the third hash value of the second full node, and obtaining the second hash value of the first full node through third hash calculation, wherein the second full node is an adjacent block node of the first full node.
S12, comparing whether the first hash value is consistent with the second hash value;
s13, if the first hash value is consistent with the second hash value, the identity authentication is determined to pass; and if the first hash value is inconsistent with the second hash value, determining that the identity authentication is not passed.
The node machine can verify the authenticity of the user as a centralized service, a non-centralized system can ensure that data of the client cannot be tampered, and the block head information of the client is directly checked for the Hash value of the block head of the block to identify whether the node is abnormal or not in an index mode. The process comprises the following steps: extracting a first hash value in the secret key, determining a block identifier of a block to which the first hash value belongs, searching a second hash value stored on a full node of the block in a first full node by taking the block identifier as an index, reading the second hash value stored on the full node of the first full node, comparing whether the first hash value is consistent with the second hash value, if so, passing the identity authentication, and if not, failing the identity authentication.
In some scenarios, if the reading may fail (due to authority, malicious interception, and the like), the third hash value of the neighboring block (the last block or the next block on the blockchain) of the first full node on the blockchain is read, and the hash value of the first full node is obtained through hash calculation.
The blocks on the block chain are divided into block heads and blocks, each block head is related to a plurality of transaction transactions in the block by storing the hash value of the previous block head, each block is a so-called account book as long as the block head hash values (which are equivalent to the identity card number of one block) are connected in series, and all the nodes need to do is to keep the consistency of the own account book and other nodes.
The netty service is built on the node machine, the node machine obtains a secret key carrying a hash value based on the netty service, namely the web service, and the secret key is used as a token on the node machine and verifies the identity of all nodes by using the hash value in the secret key.
In one example of this embodiment, broadcasting accounting tasks to light nodes on the blockchain includes: splitting the accounting task into a plurality of subtasks; broadcasting the plurality of subtasks to all light nodes on the blockchain such that all light nodes compete for accounting rights of the plurality of subtasks based on a POW (Proof of Work) algorithm.
Optionally, the step of synchronously storing the feedback data of the light node as the accounting data of the accounting task to all the full nodes on the block chain includes: receiving M sub-hashes respectively fed back by M light nodes based on a plurality of sub-tasks, wherein the accounting task comprises a plurality of sub-tasks, and M is a positive integer greater than 1; and splicing the M sub-hashes to obtain accounting data of the accounting task, and synchronously storing the accounting data to all full nodes on the block chain.
In the splicing process, multiple modes can be adopted for splicing, each subtask is unique, so that the M sub hashes are also unique, a unique total hash can be obtained regardless of the splicing mode, and the splicing of the M sub hashes can be but is not limited to: splicing the M sub-hashes in sequence based on the feedback time of the M sub-hashes; and splicing M sub-hashes based on the task identifications of the multiple sub-tasks.
Fig. 3 is a block chain system architecture diagram according to an embodiment of the present invention, including: a plurality of full nodes (node 1, node 2, node 3), a node machine, a control client of the node machine, and a plurality of light nodes (node a, node b, node c). Broadcasting the accounting task to the light nodes, and receiving the accounting data fed back by the light nodes, wherein the light nodes can compete through a pow algorithm, and the node machine splices the accounting data (Hash + Hash) of each light node to obtain complete accounting data, and then synchronizes to other full nodes, including:
the light nodes compete through a POW algorithm, if the first light node is solved, a first subtask of the accounting task is extracted, and the first light node executes the first subtask to obtain a first sub hash; and until the Nth light node is solved, extracting the Nth subtask of the accounting task, executing the Nth subtask by the Nth light node to obtain the Nth sub-hash until the accounting task is distributed completely, splicing the sub-hashes (the first sub-hash + … + the Nth sub-hash) of the light nodes to obtain a complete hash value, and performing full-chain synchronization by using the complete hash value as accounting data.
In this embodiment, the accounting task may be divided into a plurality of subtasks, and each subtask corresponds to one light node. Or the dividing may be non-uniform, the dividing is performed according to a preset gradient, for example, the dividing is performed by one half, one third, one sixth, and the like, and the earlier the solution completion time is, the larger the distributed subtasks are.
The POW algorithm of this embodiment determines who to come out a block by calculating a difficulty value. The workload of the POW means that the equation is solved, and who solves the equation first and who has the right block. The equation calculates the hash value of the next block through the hash value of the previous block and the random value nonce, and who finds nonce first can calculate the hash value of the next block first, and this way is called as the calculation difficulty value because the equation has no fixed solution and can be tried continuously, and this way of solving the equation is called as hash collision, which is a probability event, and the more the number of collisions, the greater the difficulty of equation solution.
The tasks are broadcast directly to other nodes 123 after being received by the node machines, and once synchronized to the node machines, the entire data is written to the node center block chain backbone and a new block is generated.
Node 123 adds a web server application to the blockchain application as a light node, and only records and manipulates the block of the latest block to submit data.
Because the resource consumption of the blockchain application client is caused by completely removing the central application in the current blockchain mode application, and the solution of the problem of the bitcoin is to delete the data before N years and store the data for encryption, the solution of the problem is obviously very complicated when tracing back a transaction before N years, and the non-central node provided by the embodiment can also solve the problem of the problem and solve the problem of the client storage with large data volume.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
In this embodiment, a data storage device based on a block chain is further provided, and the device is used to implement the foregoing embodiments and preferred embodiments, and the description of the device is omitted for brevity. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 4 is a block diagram of a block chain based data storage apparatus according to an embodiment of the present invention, as shown in fig. 4, the apparatus including: a monitoring module 40, a submission module 42, an authentication module 44, a storage module 46, wherein,
the monitoring module 40 is configured to monitor account statuses of all nodes in a blockchain, where the blockchain includes all nodes and light nodes;
a submitting module 42, configured to submit an accounting task to the blockchain when the account status of the first full node changes;
a verification module 44, configured to perform identity verification on the first full node;
and the storage module 46 is configured to broadcast the accounting task to the light node in the blockchain after the identity authentication passes, and store the feedback data of the light node as accounting data of the accounting task to all full nodes in the blockchain synchronously.
Optionally, the verification module includes: a reading unit, configured to locally read a first hash value of the first full node, and obtain a second hash value of the first full node according to the first hash value, where the second hash value is stored on a client of the first full node; a comparison unit configured to compare whether the first hash value and the second hash value are consistent; the determining unit is used for determining that the identity authentication is passed if the first hash value is consistent with the second hash value; and if the first hash value is inconsistent with the second hash value, determining that the identity authentication is not passed.
Optionally, the reading unit includes: a determining subunit, configured to determine a block identifier of a block to which the first hash value belongs; a reading subunit, configured to read, in the memory of the first full node, a second hash value stored in the chunk on the client using the chunk identifier as an index; and if the reading fails, continuously reading a third hash value of a second full node, and obtaining a second hash value of the first full node through the third hash calculation, wherein the second full node is an adjacent block node of the first full node.
Optionally, the storage module includes: the splitting unit is used for splitting the accounting task into a plurality of subtasks; a broadcasting unit, configured to broadcast the plurality of subtasks to all light nodes on the block chain, so that all light nodes compete for accounting rights of the plurality of subtasks based on a workload certification POW algorithm.
Optionally, the storage module includes: the receiving unit is used for receiving M sub-hashes which are respectively fed back by M light nodes based on a plurality of subtasks, wherein the accounting task comprises the plurality of subtasks, and M is a positive integer greater than 1; and the splicing unit is used for splicing the M sub-hashes to obtain the accounting data of the accounting task, and synchronously storing the accounting data to all full nodes on the block chain.
Optionally, the splicing unit includes at least one of: a first splicing subunit, configured to splice the M sub-hashes in order based on feedback times of the M sub-hashes; and the second splicing subunit is used for splicing the M sub-hashes based on the task identifiers of the plurality of sub-tasks.
Optionally, the apparatus further comprises: the system comprises a setting module, a monitoring module and a sending module, wherein the setting module is used for setting a node machine on a block chain through an intelligent contract and establishing a communication link between the node machine and each full node before the monitoring module monitors the account state of the full node on the block chain; and the synchronization module is used for synchronously storing the key information of each full node locally in the node machine, wherein the key information carries the hash value of the full node.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Example 3
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, monitoring account states of all nodes on a block chain, wherein the block chain comprises all nodes and light nodes;
s2, when the account state of the first full node changes, submitting an accounting task to the block chain;
s3, carrying out identity verification on the first full node;
and S4, after the identity authentication is passed, broadcasting the accounting task to the light node on the block chain, and synchronously storing the feedback data of the light node as the accounting data of the accounting task to all full nodes on the block chain.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, monitoring account states of all nodes on a block chain, wherein the block chain comprises all nodes and light nodes;
s2, when the account state of the first full node changes, submitting an accounting task to the block chain;
s3, carrying out identity verification on the first full node;
and S4, after the identity authentication is passed, broadcasting the accounting task to the light node on the block chain, and synchronously storing the feedback data of the light node as the accounting data of the accounting task to all full nodes on the block chain.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
The block chain underlying platform can comprise processing modules such as user management, basic service, intelligent contract and operation monitoring. The user management module is responsible for identity information management of all blockchain participants, and comprises public and private key generation maintenance (account management), key management, user real identity and blockchain address corresponding relation maintenance (authority management) and the like, and under the authorization condition, the user management module supervises and audits the transaction condition of certain real identities and provides rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node equipment and used for verifying the validity of the service request, recording the service request to storage after consensus on the valid request is completed, for a new service request, the basic service firstly performs interface adaptation analysis and authentication processing (interface adaptation), then encrypts service information (consensus management) through a consensus algorithm, transmits the service information to a shared account (network communication) completely and consistently after encryption, and performs recording and storage; the intelligent contract module is responsible for registering and issuing contracts, triggering the contracts and executing the contracts, developers can define contract logics through a certain programming language, issue the contract logics to a block chain (contract registration), call keys or other event triggering and executing according to the logics of contract clauses, complete the contract logics and simultaneously provide the function of upgrading and canceling the contracts; the operation monitoring module is mainly responsible for deployment, configuration modification, contract setting, cloud adaptation in the product release process and visual output of real-time states in product operation, such as: alarm, monitoring network conditions, monitoring node equipment health status, and the like.

Claims (10)

1. A data storage method based on a block chain is characterized by comprising the following steps:
monitoring account states of all nodes on a block chain, wherein the block chain comprises all nodes and light nodes;
when the account state of the first full node changes, submitting an accounting task to the block chain;
performing identity verification on the first full node;
and after the identity authentication is passed, broadcasting the accounting task to the light nodes on the block chain, and synchronously storing the feedback data of the light nodes as the accounting data of the accounting task to all full nodes on the block chain.
2. The method of claim 1, wherein authenticating the first full node comprises:
locally reading a first hash value of the first full node, and acquiring a second hash value of the first full node according to the first hash value, wherein the second hash value is stored on a client of the first full node;
comparing whether the first hash value and the second hash value are consistent;
if the first hash value is consistent with the second hash value, determining that the identity authentication is passed; and if the first hash value is inconsistent with the second hash value, determining that the identity authentication is not passed.
3. The method of claim 2, wherein obtaining the second hash value for the first full node from the first hash value comprises:
determining the block identifier of the block to which the first hash value belongs;
reading a second hash value of the block stored on the client in the memory of the first full node by taking the block identifier as an index; and if the reading fails, continuously reading a third hash value of a second full node, and obtaining a second hash value of the first full node through the third hash calculation, wherein the second full node is an adjacent block node of the first full node.
4. The method of claim 1, wherein broadcasting the accounting tasks to light nodes on the blockchain comprises:
splitting the accounting task into a plurality of subtasks;
broadcasting the plurality of subtasks to all light nodes on the blockchain to enable all light nodes to compete for accounting rights for the plurality of subtasks based on a workload justification POW algorithm.
5. The method of claim 1, wherein the step of synchronously storing the feedback data of the light node as accounting data for the accounting task to all full nodes on the blockchain comprises:
Receiving M sub-hashes respectively fed back by M light nodes based on a plurality of subtasks, wherein the accounting task comprises the subtasks, and M is a positive integer greater than 1;
and splicing the M sub-hashes to obtain accounting data of the accounting task, and synchronously storing the accounting data to all full nodes on the block chain.
6. The method of claim 5, wherein concatenating the M sub-hashes comprises at least one of:
splicing the M sub-hashes in sequence based on the feedback time of the M sub-hashes;
and splicing the M sub-hashes based on the task identifiers of the plurality of sub-tasks.
7. The method of claim 1, wherein prior to monitoring the account status of all nodes on a blockchain, the method further comprises:
setting a node machine on the block chain through an intelligent contract, and establishing a communication link between the node machine and each full node;
and synchronously storing the key information of each full node locally in the node machine, wherein the key information carries the hash value of the full node.
8. A blockchain-based data storage device, comprising:
the system comprises a monitoring module, a judging module and a judging module, wherein the monitoring module is used for monitoring the account state of all nodes on a block chain, and the block chain comprises all nodes and light nodes;
The submitting module is used for submitting an accounting task to the block chain when the account state of the first full node changes;
the verification module is used for carrying out identity verification on the first full node;
and the storage module is used for broadcasting the accounting task to the light nodes on the block chain after the identity authentication is passed, and synchronously storing the feedback data of the light nodes serving as the accounting data of the accounting task to all the full nodes on the block chain.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer storage medium on which a computer program is stored, characterized in that the computer program, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202010602292.1A 2020-06-29 2020-06-29 Data storage method and device based on block chain Pending CN111858751A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010602292.1A CN111858751A (en) 2020-06-29 2020-06-29 Data storage method and device based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010602292.1A CN111858751A (en) 2020-06-29 2020-06-29 Data storage method and device based on block chain

Publications (1)

Publication Number Publication Date
CN111858751A true CN111858751A (en) 2020-10-30

Family

ID=72988719

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010602292.1A Pending CN111858751A (en) 2020-06-29 2020-06-29 Data storage method and device based on block chain

Country Status (1)

Country Link
CN (1) CN111858751A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113111392A (en) * 2021-04-12 2021-07-13 浙江永旗区块链科技有限公司 Block chain data synchronization system and control method thereof
CN113489743A (en) * 2021-07-26 2021-10-08 广东辰宜信息科技有限公司 Consensus realization method and device applied to block chain system
CN113570194A (en) * 2021-06-28 2021-10-29 北京电链科技有限公司 Block chain-based power construction business data processing method and system
CN114362960A (en) * 2021-12-31 2022-04-15 杭州趣链科技有限公司 Resource account data supervision method and device, computer equipment and medium
CN117132279A (en) * 2023-10-26 2023-11-28 山东大学 Block chain double-chain accounting method, system, equipment and medium
WO2024066012A1 (en) * 2022-09-30 2024-04-04 蚂蚁区块链科技(上海)有限公司 Method and apparatus for converting peer type in blockchain system, and blockchain system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282539A (en) * 2018-02-06 2018-07-13 北京奇虎科技有限公司 Decentralization storage system based on double-layer network
CN108446969A (en) * 2018-03-29 2018-08-24 张文昌 A kind of unified public transport book keeping operation and transaction system based on block chain
CN109102287A (en) * 2018-08-13 2018-12-28 中国联合网络通信集团有限公司 Block chain bookkeeping methods, device, equipment and storage medium
CN109194708A (en) * 2018-07-24 2019-01-11 哈尔滨工程大学 A kind of distributed memory system and its identity identifying method based on block chain technology
US20190207767A1 (en) * 2016-05-03 2019-07-04 Kyu Tae AHN Block chain supporting multiple one-way functions used for verification of blocks
CN110322352A (en) * 2019-07-09 2019-10-11 深圳市炳德区块链技术有限公司 A kind of account book foundation and querying method, electronic equipment based on block chain
CN110738472A (en) * 2018-07-20 2020-01-31 北京航空航天大学 Block chain storage method and block chain node
CN111191292A (en) * 2019-12-16 2020-05-22 平安壹钱包电子商务有限公司 Accounting method, accounting device, accounting system and computer-readable storage medium
CN111242776A (en) * 2018-11-29 2020-06-05 北京京东尚科信息技术有限公司 Accounting method and device based on block chain, storage medium and electronic equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190207767A1 (en) * 2016-05-03 2019-07-04 Kyu Tae AHN Block chain supporting multiple one-way functions used for verification of blocks
CN108282539A (en) * 2018-02-06 2018-07-13 北京奇虎科技有限公司 Decentralization storage system based on double-layer network
CN108446969A (en) * 2018-03-29 2018-08-24 张文昌 A kind of unified public transport book keeping operation and transaction system based on block chain
CN110738472A (en) * 2018-07-20 2020-01-31 北京航空航天大学 Block chain storage method and block chain node
CN109194708A (en) * 2018-07-24 2019-01-11 哈尔滨工程大学 A kind of distributed memory system and its identity identifying method based on block chain technology
CN109102287A (en) * 2018-08-13 2018-12-28 中国联合网络通信集团有限公司 Block chain bookkeeping methods, device, equipment and storage medium
CN111242776A (en) * 2018-11-29 2020-06-05 北京京东尚科信息技术有限公司 Accounting method and device based on block chain, storage medium and electronic equipment
CN110322352A (en) * 2019-07-09 2019-10-11 深圳市炳德区块链技术有限公司 A kind of account book foundation and querying method, electronic equipment based on block chain
CN111191292A (en) * 2019-12-16 2020-05-22 平安壹钱包电子商务有限公司 Accounting method, accounting device, accounting system and computer-readable storage medium

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113111392A (en) * 2021-04-12 2021-07-13 浙江永旗区块链科技有限公司 Block chain data synchronization system and control method thereof
CN113111392B (en) * 2021-04-12 2022-08-30 浙江永旗区块链科技有限公司 Block chain data synchronization system and control method thereof
CN113570194A (en) * 2021-06-28 2021-10-29 北京电链科技有限公司 Block chain-based power construction business data processing method and system
CN113489743A (en) * 2021-07-26 2021-10-08 广东辰宜信息科技有限公司 Consensus realization method and device applied to block chain system
CN113489743B (en) * 2021-07-26 2022-12-23 广东辰宜信息科技有限公司 Consensus realization method and device applied to block chain system
CN114362960A (en) * 2021-12-31 2022-04-15 杭州趣链科技有限公司 Resource account data supervision method and device, computer equipment and medium
WO2024066012A1 (en) * 2022-09-30 2024-04-04 蚂蚁区块链科技(上海)有限公司 Method and apparatus for converting peer type in blockchain system, and blockchain system
CN117132279A (en) * 2023-10-26 2023-11-28 山东大学 Block chain double-chain accounting method, system, equipment and medium
CN117132279B (en) * 2023-10-26 2024-01-23 山东大学 Block chain double-chain accounting method, system, equipment and medium

Similar Documents

Publication Publication Date Title
CN111858751A (en) Data storage method and device based on block chain
CN111291060B (en) Method, device and computer readable medium for managing blockchain nodes
CN107396360B (en) Block verification method and device
CN108512652B (en) Decentralized consensus method and system based on time certification and block chain system
CN111382456B (en) Proposal message processing method, device, equipment and storage medium
CN108932348B (en) Block chain merging processing method and device, block chain node and storage medium
CN110569251B (en) Data processing method, related equipment and computer readable storage medium
US20230316273A1 (en) Data processing method and apparatus, computer device, and storage medium
CN108734028B (en) Data management method based on block chain, block chain link point and storage medium
CN110633323A (en) Business data storage method, device, storage medium and computer equipment
CN111080295A (en) Block chain-based electronic contract processing method and equipment
TW201826772A (en) Blockchain technology-based robust atm network system and information processing method therefor
CN111427957A (en) Block chain voting information verification method, device, equipment and storage medium
CN111698315B (en) Data processing method and device for block and computer equipment
CN111314067A (en) Block storage method and device, computer equipment and storage medium
CN111385103B (en) Authority processing method, system and device and electronic equipment
CN110730081B (en) Block chain network-based certificate revocation method, related equipment and medium
CN110601896A (en) Data processing method and equipment based on block chain nodes
CN112231755B (en) Data authorization method, device and system based on blockchain
CN110908812A (en) Business data processing method and device, readable storage medium and computer equipment
CN110599175A (en) Block processing method and related equipment
CN108833133A (en) Network configuration management method, apparatus and storage medium based on system for cloud computing
CN112417052B (en) Data synchronization method, device, equipment and storage medium in block chain network
Liu et al. Using blockchain technology in IoT manufacture environment for intelligence prediction
CN112883425A (en) Data processing method based on block chain and block chain link point

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