CN109117097B - Data storage method and system based on block chain - Google Patents

Data storage method and system based on block chain Download PDF

Info

Publication number
CN109117097B
CN109117097B CN201811031816.5A CN201811031816A CN109117097B CN 109117097 B CN109117097 B CN 109117097B CN 201811031816 A CN201811031816 A CN 201811031816A CN 109117097 B CN109117097 B CN 109117097B
Authority
CN
China
Prior art keywords
block
node
blocks
side chain
main chain
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
CN201811031816.5A
Other languages
Chinese (zh)
Other versions
CN109117097A (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 Genuine Innovative Technology Co ltd
Original Assignee
Shenzhen Genuine Innovative 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 Genuine Innovative Technology Co ltd filed Critical Shenzhen Genuine Innovative Technology Co ltd
Priority to CN201811031816.5A priority Critical patent/CN109117097B/en
Publication of CN109117097A publication Critical patent/CN109117097A/en
Application granted granted Critical
Publication of CN109117097B publication Critical patent/CN109117097B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to the field of block chain technology, and in particular, to a data storage method and system based on a block chain. The method comprises the following steps: detecting whether the available storage capacity of the proxy node is smaller than a preset storage threshold value or not by the proxy node of the main chain; if the number of the blocks is smaller than the preset value, the proxy node of the main chain records the block numbers of all the blocks between the starting block and the ending block to be transferred; the agent node of the side chain sends all blocks to the common node of the side chain; after the agent node of the main chain detects that all blocks pass consensus verification on the side chains, the agent node of the main chain broadcasts block transfer information in the whole network; each node in the main chain deletes all blocks according to the block transfer information. Therefore, each node in the main chain can transfer and store part or all of the blocks in the side chain when the available storage capacity is insufficient, so that each node in the main chain has more available storage capacity, each node in the main chain can more reliably store the block data, and the working reliability of the main chain is improved.

Description

Data storage method and system based on block chain
Technical Field
The present invention relates to the field of block chain technology, and in particular, to a data storage method and system based on a block chain.
Background
The block chain technology integrates the technologies of algorithm, mathematics, cryptography, economic model and the like, establishes a trust mechanism based on the point-to-point network relationship, and becomes a distributed system which can operate without mutual trust foundation and single centralized mechanism.
Since the blockchain technique needs to store each block and the hash value of the previous block needs to be recorded in the next block, a data chain which cannot be tampered is formed in this way, when the number of blocks increases, the blockchain technique needs a larger available storage capacity to store a longer data chain, resulting in insufficient available storage capacity of the blockchain node, which affects reliability of the blockchain.
Disclosure of Invention
An object of the embodiments of the present invention is to provide a method and a system for storing data based on a block chain, which can improve the operational reliability of the block chain.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
in a first aspect, an embodiment of the present invention provides a data storage method based on a block chain, where the method includes:
detecting whether the available storage capacity of the proxy node is smaller than a preset storage threshold value or not by the proxy node of the main chain;
if the number of the blocks is smaller than the preset value, the proxy node of the main chain records the block numbers of all the blocks between the starting block and the ending block to be transferred;
the proxy node of the main chain sends the whole blocks to the proxy node of the side chain corresponding to the preset node address on the main chain;
the agent node of the side chain sends the all blocks to the consensus node of the side chain, so that the consensus node of the side chain agrees to verify the all blocks;
the common node identification of the side chain passes through all the blocks, and all the blocks are stored in a side chain content server corresponding to a preset node address on the side chain;
after the agent node of the main chain detects that all the blocks pass consensus verification on the side chain, the agent node of the main chain broadcasts block transfer information in the whole network;
and deleting all the blocks by each node in the main chain according to the block transfer information.
Optionally, the method further comprises:
and when a new block is added after the termination block, the proxy node of the main chain acquires the hash value of the termination block, and takes the hash value of the termination block as a characteristic value of a block head in the new block.
Optionally, the method further comprises:
when the agent node of the main chain receives the query request, sending a block acquisition request to the agent node of the side chain;
the proxy node of the side chain sends all the blocks to a main chain content server corresponding to a preset node address according to the block acquisition request;
the proxy node of the main chain accesses the main chain content server and acquires all the blocks;
and the proxy node of the main chain is used for assembling all the blocks on the stored block chain according to the block numbers of the starting block and the ending block in all the blocks and the numbering sequence.
Optionally, after the proxy node of the side chain sends all the blocks to the main chain content server corresponding to the preset node address according to the block obtaining request, the method further includes:
the proxy node of the side chain replicates and stores the entire block.
Optionally, the sending, by the proxy node of the side chain, the all blocks to the main chain content server corresponding to a preset node address according to the block obtaining request includes:
the proxy node of the side chain determines the block numbers of the starting block and the ending block in all the blocks on the side chain according to the block acquisition request;
the proxy node of the side chain intercepts all the blocks from the block chain on the side chain according to the block numbers of the starting block and the ending block in all the blocks on the side chain;
the agent node of the side chain executes the intelligent contract on the side chain, and the block numbers of all blocks on the side chain are converted into the block numbers on the main chain;
and the proxy node of the side chain sends all blocks corresponding to the block numbers converted on the main chain to a main chain content server corresponding to a preset node address.
Optionally, the method further comprises:
if so, each node in the main chain continues to store the block.
In a second aspect, embodiments of the present invention provide a block chain based data storage system, the system comprising a main chain and a side chain;
detecting whether the available storage capacity of the proxy node is smaller than a preset storage threshold value or not by the proxy node of the main chain;
if the number of the blocks is smaller than the preset value, the proxy node of the main chain records the block numbers of all the blocks between the starting block and the ending block to be transferred;
the proxy node of the main chain sends the whole blocks to the proxy node of the side chain corresponding to the preset node address on the main chain;
the agent node of the side chain sends the all blocks to the consensus node of the side chain, so that the consensus node of the side chain agrees to verify the all blocks;
the common node identification of the side chain passes through all the blocks, and all the blocks are stored in a side chain content server corresponding to a preset node address on the side chain;
after the agent node of the main chain detects that all the blocks pass consensus verification on the side chain, the agent node of the main chain broadcasts block transfer information in the whole network;
and deleting all the blocks by each node in the main chain according to the block transfer information.
Optionally, when a new block is added after the termination block, the proxy node of the main chain acquires the hash value of the termination block, and uses the hash value of the termination block as a feature value of a block header in the new block.
Optionally, when the proxy node of the main chain receives the query request, sending a block acquisition request to the proxy node of the side chain;
the proxy node of the side chain sends all the blocks to a main chain content server corresponding to a preset node address according to the block acquisition request;
the proxy node of the main chain accesses the main chain content server and acquires all the blocks;
and the proxy node of the main chain is used for assembling all the blocks on the stored block chain according to the block numbers of the starting block and the ending block in all the blocks and the numbering sequence.
Optionally, the proxy node of the side chain replicates and stores the whole tile.
In the data storage method and system based on the block chain provided by each embodiment of the invention, firstly, a proxy node of a main chain detects whether the available storage capacity of the proxy node is smaller than a preset storage threshold value; if the number of the blocks is smaller than the preset value, the proxy node of the main chain records the block numbers of all the blocks between the starting block and the ending block to be transferred; the agent node of the main chain sends the whole blocks to the common node of the side chain corresponding to the preset node address on the main chain; the consensus nodes of the side chains agree on the side chains to verify the whole blocks; the common node identification of the side chain passes through all the blocks, and all the blocks are stored in a side chain content server corresponding to a preset node address on the side chain; after the agent node of the main chain detects that all the blocks pass consensus verification on the side chain, the agent node of the main chain broadcasts block transfer information in the whole network; and deleting all the blocks by each node in the main chain according to the block transfer information. Therefore, each node in the main chain can transfer and store part or all of the blocks in the side chain when the available storage capacity is insufficient, so that each node in the main chain has more available storage capacity, each node in the main chain can more reliably store the block data, and the working reliability of the main chain is improved.
Drawings
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
FIG. 1 is a block chain network architecture model according to an embodiment of the present invention;
FIG. 2 is a block chain system according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating a data storage method based on a block chain according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The block chain technique is also called a distributed book technique, and is a distributed internet database technique. A network constructed based on the blockchain technology may be referred to as a blockchain network, where the blockchain network includes a plurality of blockchain nodes, each node corresponds to at least one blockchain, and each blockchain includes at least one block. The block chain technology has the characteristics of decentralization, openness and transparency, no tampering, trustiness and the like, so that the block chain technology is more and more widely applied.
Referring to fig. 1, fig. 1 is a block chain network architecture model according to an embodiment of the present invention. As shown in fig. 1, the blockchain network 100 includes a data layer 11, a network layer 12, a consensus layer 13, and an intelligent contract layer 14.
The data layer 11 encapsulates the underlying data blocks and associated basic data and basic algorithms such as data encryption and time stamping. The network layer 12 includes a distributed networking mechanism, a data propagation mechanism, a data validation mechanism, and the like. The consensus layer 13 encapsulates various kinds of consensus algorithms for the network nodes. Intelligent contract layer 14 encapsulates various types of scripts, algorithms, and intelligent contracts.
The blockchain-based data storage method according to the embodiment of the present invention may be implemented in any suitable type of blockchain node having computing capability, such as a server, a desktop computer, a smart phone, a tablet computer, and other electronic products. The server may be a physical server or a logical server formed by virtualizing a plurality of physical servers. The server may also be a server cluster formed by a plurality of servers capable of communicating with each other, and each functional module may be respectively distributed on each server in the server cluster.
The Block chain provided by the embodiment of the invention comprises a Public Block chain (Public Block Chains), a joint Block chain (Consortium Block Chains) and a Private Block chain (Private Block Chains).
Referring to fig. 2, fig. 2 is a schematic structural diagram of a block chain system according to an embodiment of the present invention. As shown in fig. 2, the block chain system 200 includes a main chain 300 and a side chain 400, and the main chain 300 and the side chain 400 communicate with each other through a side chain protocol.
Either the main chain 300 or the side chain 400 includes a common node 51, a proxy node 52, and a consensus node 53.
The regular node 51 is communicatively connected to the proxy node 52, and the proxy node 52 is further communicatively connected to the consensus node 53. The communication between each blockchain node supports a Point-to-Point communication (P2P).
Wherein the proxy nodes of the main chain 300 can communicate with the proxy nodes of the side chain 400.
The regular node 51 holds the current electronic money and has the right to vote in the blockchain system. The normal node 51 can perform related transaction operations, but has no block packaging accounting right, and can only synchronously record block data from the related node with the packaging accounting right.
The agent node 52 is written with an intelligent contract code, and the normal node 51 sends the original block data to the agent node 52, triggering the intelligent contract of the agent node 52, so that the intelligent contract of the agent node executes the original block data. Wherein the generic node 51 maintains an intelligent contract list that records a list of various proxy nodes that are capable of executing intelligent contracts. Whenever the ordinary node 51 receives the original data of the block, the ordinary node 51 calls up the intelligent contract list, finds out the addresses of the respective proxy nodes from the intelligent contract list, and sends the original data of the block to the respective proxy nodes.
In this embodiment, the agent node 52 may pre-store multiple types of intelligent contracts, and may parse the execution type of the intelligent contract according to the trigger request sent by the common node 51. The agent node 52 executes the corresponding intelligent contract according to the execution type of the analyzed intelligent contract.
When a certain proxy node goes into fault, the other proxy nodes broadcast the address of the certain proxy node to the whole network, the common node 51 monitors the broadcast information and updates the intelligent contract list, and when the original data of the block is sent subsequently, the common node 51 does not send data to the certain proxy node 52, so as to improve the working efficiency. The code of the intelligent contract is written according to the business scenario logic.
After executing the original block data according to the intelligent contract, the proxy node 52 outputs the block data to be verified. Then, the proxy node 52 also signs the block data to be verified, and packages and sends the signed block data to the consensus node 53. The consensus node 53 verifies the signed block data using the public key of the proxy node 52, and if the verification is successful, the signed block data is considered to be sent by the valid proxy node 52, and then performs consensus processing on the block data. If the verification is not successful, the signed block data is considered to be sent by the illegal proxy node 52. For example, the proxy node 52 uses its private key to perform a signature operation on the hash content of the current chunk, resulting in the signature.
The consensus node 53 is used for consensus on the block data uploaded by the authentication proxy node 52. The consensus node 53 may support any one of the following consensus algorithms: proof of Work (PoW), Proof of rights of interest (POS), Proof of equity authorization (Delegate Proof of stamp, DPoS), Practical Byzantine Fault Tolerance (PBFT), authorized Byzantine Fault Tolerance (DBFT), and so forth.
Each of the consensus nodes 53 needs to register with the agent node 52, and after successful registration, the consensus node is a valid consensus node. The registration process is as follows:
1. the consensus node 53 submits the registration information to the proxy node 52.
Wherein the registration information includes one or more of the following: the device serial number SN, user information and miner wallet address of the consensus node 53.
2. The proxy node 52 checks the registration information.
The checking process comprises the following steps: it is checked whether the SN numbering format is correct, whether the SN is present in a database, whether the SN has been bound to other users, etc.
3. The proxy node 52 records the registration information.
4. The proxy node 52 returns the registration result to the consensus node 53.
5. The proxy node 52 broadcasts the new registration data to the blockchain system 200.
In the block chain system 200, the blocks are carriers for storing transaction summary information, each block includes a block header and a block body, and the information recorded in the block header is used to identify the block itself, the information summary of the previous block, and the position of the block in the whole account. The block body is used for storing the transaction summary information and verifying the transaction information and keeping the transaction from being tampered.
The block chain is formed by connecting each block one by one according to the sequence of the generation time. In the whole block chain, the first block is called a created block, the block height of the created block is 0, the block height of each subsequent block is sequentially added with 1, and the hash value of the previous block header is written in the block header. And all blocks on the block chain are linked by the last block head hash value on each block.
Referring to fig. 3, fig. 3 is a block chain-based data storage method according to an embodiment of the present invention. As shown in fig. 3, the method S700 for storing data based on a block chain includes:
s71, the proxy node of the main chain detects whether the available storage capacity is smaller than a preset storage threshold value, and if so, the step is shifted to S72. If so, go to S78.
Each agent node has a storage space, the storage space includes a necessary storage space and a non-necessary storage space, the necessary storage space is used for storing logic codes required by the normal work of the agent node, and the non-necessary storage space is used for storing block data. As the block height of the block chain increases, the available storage capacity of the unnecessary storage space decreases, and when the block height of the block chain increases to make the work efficiency of the proxy node become abnormally slow, the storage load of the proxy node needs to be reduced in order to maintain the normal operation of the block chain system.
The preset storage threshold is user-defined. In some embodiments, the available storage capacity may also be defined according to design requirements, and not necessarily the available storage capacity currently remaining in the unnecessary storage space, and even an alarm storage capacity smaller than the currently remaining available storage capacity may be used as the available storage capacity compared with the preset storage threshold.
S72, if the number is smaller than the number, the proxy node of the main chain records the block numbers of all blocks between the start block and the end block to be transferred;
all blocks between the starting block and the ending block to be transferred have been identified and verified and stored at various nodes (including proxy nodes) on the backbone. For example, for a block chain with a current total block height of 10000, the block number (block height) of the starting block is #1, that is, the starting block is a created block. Alternatively, the block number (block height) of the starting block is # 1500.
The end block is the block with the last block number to be transferred by the proxy node of the main chain, and the block number of the start block to the block number of the end block are continuous.
When the available storage capacity of the main chain is smaller than a preset storage threshold value, the main chain triggers an intelligent contract of the main chain, so that the proxy node of the main chain records the block numbers of all blocks between the starting block and the ending block to be transferred.
S73, the proxy node of the main chain sends all blocks to the proxy node of the side chain corresponding to the node address preset on the main chain;
s74, the agent node of the side chain sends all blocks to the consensus node of the side chain, so that the consensus node of the side chain agrees to verify all blocks;
the contract content of the intelligent contract of the main chain presets the node address of the proxy node of the side chain, and after the execution of S72, the proxy node of the main chain sends all blocks to the proxy node of the side chain.
In some embodiments, when the proxy node of the main chain sends all blocks to the proxy node of the side chain, the proxy node of the main chain may compress all blocks and then send the compressed all blocks to the proxy node of the side chain. And decompressing all compressed blocks by the proxy node of the side chain, and sending all blocks to the consensus node of the side chain so that the consensus node of the side chain can realize consensus verification of all blocks.
S75, the common node identification of the side chain passes all the blocks, and all the blocks are stored in a side chain content server corresponding to the preset node address on the side chain;
in this embodiment, the side chain content server is communicatively connected to the common node of the side chain, and the side chain content server is used to store block data, and has a large available storage capacity.
S76, after the agent node of the main chain detects that all blocks pass the consensus verification on the side chains, the agent node of the main chain broadcasts the block transfer information in the whole network;
in this embodiment, after all the tiles pass the consensus verification at the side chain, the proxy node of the side chain sends the verification success message to the proxy node of the main chain, so that the proxy node of the main chain detects that all the tiles pass the consensus verification at the side chain.
When all blocks fail the consensus verification at the side chain, the proxy node of the main chain performs the block transfer operation again, i.e., the process goes to S72.
And S77, deleting all blocks by each node in the main chain according to the block transfer information.
In this embodiment, when each node (e.g., proxy node, normal node) of the main chain receives the block transfer information, all the stored blocks may be deleted, thereby making available storage capacity for unnecessary storage space.
And S78, if so, each node in the main chain continuously stores the block.
In summary, since each node in the main chain can transfer and store some or all blocks in the side chain when the available storage capacity is insufficient, each node in the main chain has more available storage capacity, so that each node in the main chain can more reliably store block data, and the operational reliability of the main chain is improved.
In some embodiments, when a new block is added after the termination block, the proxy node of the main chain obtains the hash value of the termination block, and uses the hash value of the termination block as a feature value of the block header in the new block. For example, the block number of the termination block is #10001, and the Hash value of the termination block is # Hash101
The block chain system requires adding a new block after terminating the block, i.e., adding a new block with a block number # 10002. Therefore, in order to ensure the non-tamper-ability of the block chain, the proxy node of the main chain uses the hash value of the terminating block as a feature value of the block header in the new block, so that when the block #10002 is verified by the POW consensus mechanism or other consensus mechanisms, it can perform a hash operation by combining the random number and the hash value of the terminating block, thereby ensuring the non-tamper-ability of the block chain.
In some embodiments, when the proxy node of the main chain receives the query request, the proxy node of the main chain sends a block acquisition request to the proxy node of the side chain. Wherein the query request is generated by a user through a common node trigger of the main chain.
And secondly, the proxy node of the side chain sends all blocks to a main chain content server corresponding to the preset node address according to the block acquisition request. This way, proxy node access and storage pressure of the main chain can be relieved.
And thirdly, the proxy node of the main chain accesses the main chain content server and acquires all blocks, and the proxy node of the main chain assembles all blocks on the stored block chain according to the block numbers of the starting block and the ending block in all blocks and the numbering sequence. Thus, the user can query the complete blockchain information.
In some embodiments, after the query, in order to avoid the main chain from making the transfer work of the repeated blocks to the side chain again, after the proxy node of the side chain sends all the blocks to the main chain content server corresponding to the preset node address according to the block acquisition request, the proxy node of the side chain copies and stores all the blocks. The subsequent backbone then does not have to send the entire block to the side chain again.
In some embodiments, after all the blocks of the main chain to be transferred are transferred to the side chain, the side chain also packages and verifies the blocks of the main chain to be transferred as new block data. Obviously, the block number of the new block formed by all the blocks to be transferred of the main chain at the side chain is different from the block number at the main chain, so when inquiring the block information, in order to ensure the consistency of the original block information of the main chain, in the process that the proxy node of the side chain sends all the blocks to the main chain content server corresponding to the preset node address according to the block acquisition request, firstly, the proxy node of the side chain determines the block numbers of the start block and the end block in all the blocks at the side chain according to the block acquisition request, for example, the block number of the start block on the main chain is #50, and the block number of the end block is # 11150. Accordingly, the block number of the start block on the main chain at the side chain is #80, and the block number of the end block on the main chain at the side chain is # 11180.
Next, the proxy node of the side chain cuts out all blocks from the block chain on the side chain according to the block numbers of the start block and the end block on the side chain, for example, the blocks with the block numbers #80 to #11180 of the side chain are assembled on the block chain on the side chain.
And thirdly, the proxy node of the side chain executes intelligent contract on the side chain, and the block numbers of all blocks on the side chain are converted into the block numbers on the main chain. For example, the block number #80 on the side chain is converted to the block number #50 on the main chain, the block number #11180 on the side chain is converted to the block number #11150 on the main chain, and all of the block numbers #80 to #11180 on the side chain are adaptively converted.
And finally, the proxy node of the side chain sends all the blocks corresponding to the block numbers converted on the main chain to a main chain content server corresponding to the preset node address.
In the above embodiments, when the main chain or side chain agent node sends the block data to the common node, the agent node performs signature operation on the block data by using its own private key to obtain a block signature, wherein the public key corresponding to the private key is broadcast to the block chain system. And secondly, the block signature and the block data are packaged by the agent node and are sent to the common identification node, when the common identification node verifies the signed block data, the common identification node verifies the block signature by using a legal public key of the agent node, and if the block signature is legal, the block data are considered to be sent by the legal agent node. If the block signature is illegal, the block data is considered to be sent by the illegal proxy node, so that the safety of the block data can be improved by adopting the mode.
When the consensus nodes verify that the block data is sent by the legal agent node, each consensus node verifies the block data by adopting a Proof of equity (POS) algorithm or a Delegated Proof of equity (DPOS) algorithm. And after the block data passes the verification, the common identification node completes other block information, wherein the other block information comprises a block signature, a time stamp and the like, the block data is packaged, and the whole network is broadcasted.
When the common identification node verifies that the block data is sent by the illegal proxy node, the block data is discarded.
In some embodiments, the blockchain-based data storage method is applied to a federation chain, and shares of the share authorization certification algorithm are distributed according to the unmanned store scale of each operator when the share authorization certification algorithm is adopted as a consensus mechanism. For example, each blockchain node of the federation chain is a server erected by each operator of an unmanned store, the size of the unmanned store including the total area of the unmanned store or the number of registered users, and the like. The unmanned stores of the operator A are the largest in scale, the percentage is 10%, the operator B is 6%, and the operator C is 3%. The.
Some common identification nodes are in failure or wrongness (do not sign and verify new blockchain data), and in order to ensure that the blockchain system can normally go out of blocks, other common identification nodes can do view updating to stop the common identification right of the failure or wrongness common identification nodes. Therefore, in some embodiments, in the process of consensus node consensus verification of block data, when the number of times of detecting consensus verification failure is greater than a preset threshold, a consensus server group composed of consensus nodes determines a malicious consensus node, where the malicious consensus node is a node that does not sign verification block data and causes the maximum number of times of consensus verification failure. The consensus server group consisting of the consensus nodes prohibits the malicious consensus nodes from participating in consensus verification, shares are redistributed to the rest consensus nodes, and data of the consensus verification block is consensus-verified, for example, the consensus node A with the percentage of 10% is bad, so that, firstly, the consensus server group stops voting right of the consensus node A, secondly, the consensus server distributes the percentage of 10% of the consensus node A to the rest consensus nodes according to a preset rule, for example, the consensus nodes are distributed to the rest consensus nodes evenly, or the rest nodes are distributed according to the working ages of the consensus nodes, the longer the working age is, the higher the distribution percentage is, the shorter the working age is, and the lower the distribution percentage is.
And thirdly, when the number of times of detecting that the consensus verification fails is smaller than the preset threshold value, the consensus server group continues to verify the block data.
In this way, it is ensured that the block chain system can smoothly go out of blocks.
It should be noted that, in the foregoing embodiments, a certain order does not necessarily exist between the foregoing steps, and it can be understood by those skilled in the art from the description of the embodiments of the present invention that, in different embodiments, the foregoing steps may have different execution orders, that is, may be executed in parallel, may also be executed in an exchange manner, and the like.
As another aspect of the embodiments of the present invention, an embodiment of the present invention provides a data storage system based on a block chain, where the system includes a main chain and a side chain;
detecting whether the available storage capacity of the proxy node is smaller than a preset storage threshold value or not by the proxy node of the main chain;
if the number of the blocks is smaller than the preset value, the proxy node of the main chain records the block numbers of all the blocks between the starting block and the ending block to be transferred;
the proxy node of the main chain sends the whole blocks to the proxy node of the side chain corresponding to the preset node address on the main chain;
the agent node of the side chain sends the all blocks to the consensus node of the side chain, so that the consensus node of the side chain agrees to verify the all blocks;
the common node identification of the side chain passes through all the blocks, and all the blocks are stored in a side chain content server corresponding to a preset node address on the side chain;
after the agent node of the main chain detects that all the blocks pass consensus verification on the side chain, the agent node of the main chain broadcasts block transfer information in the whole network;
and deleting all the blocks by each node in the main chain according to the block transfer information.
In summary, since each node in the main chain can transfer and store some or all blocks in the side chain when the available storage capacity is insufficient, each node in the main chain has more available storage capacity, so that each node in the main chain can more reliably store block data, and the operational reliability of the main chain is improved.
Optionally, when a new block is added after the termination block, the proxy node of the main chain acquires the hash value of the termination block, and uses the hash value of the termination block as a feature value of a block header in the new block.
Optionally, when the proxy node of the main chain receives the query request, sending a block acquisition request to the proxy node of the side chain;
the proxy node of the side chain sends all the blocks to a main chain content server corresponding to a preset node address according to the block acquisition request;
the proxy node of the main chain accesses the main chain content server and acquires all the blocks;
and the proxy node of the main chain is used for assembling all the blocks on the stored block chain according to the block numbers of the starting block and the ending block in all the blocks and the numbering sequence.
Optionally, the proxy node of the side chain replicates and stores the whole tile.
The above-described embodiments of the apparatus or device are merely illustrative, wherein the unit modules described as separate parts may or may not be physically separate, and the parts displayed as module units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network module units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. Based on such understanding, the above technical solutions substantially or contributing to the related art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (7)

1. A method for blockchain-based data storage, the method comprising:
detecting whether the available storage capacity of the proxy node is smaller than a preset storage threshold value or not by the proxy node of the main chain;
if the number of the blocks is smaller than the preset value, the proxy node of the main chain records the block numbers of all the blocks between the starting block and the ending block to be transferred;
the proxy node of the main chain sends the whole blocks to the proxy node of the side chain corresponding to the preset node address on the main chain;
the agent node of the side chain sends the all blocks to the consensus node of the side chain, so that the consensus node of the side chain agrees to verify the all blocks;
the consensus node consensus verification of the side chain passes through all the blocks, and all the blocks are stored in a side chain content server corresponding to a preset node address on the side chain;
after the agent node of the main chain detects that all the blocks pass consensus verification on the side chain, the agent node of the main chain broadcasts block transfer information in the whole network;
deleting all the blocks by each node in the main chain according to the block transfer information;
the method further comprises the following steps:
when the agent node of the main chain receives the query request, sending a block acquisition request to the agent node of the side chain;
the proxy node of the side chain determines the block numbers of the starting block and the ending block in all the blocks on the side chain according to the block acquisition request;
the proxy node of the side chain intercepts all the blocks from the block chain on the side chain according to the block numbers of the starting block and the ending block in all the blocks on the side chain;
the agent node of the side chain executes the intelligent contract on the side chain, and the block numbers of all blocks on the side chain are converted into the block numbers on the main chain;
the agent node of the side chain sends all blocks corresponding to the block numbers converted on the main chain to a main chain content server corresponding to a preset node address;
the proxy node of the main chain accesses the main chain content server and acquires all the blocks;
and the proxy node of the main chain is used for assembling all the blocks on the stored block chain according to the block numbers of the starting block and the ending block in all the blocks and the numbering sequence.
2. The method of claim 1, further comprising:
and when a new block is added after the termination block, the proxy node of the main chain acquires the hash value of the termination block, and takes the hash value of the termination block as a characteristic value of a block head in the new block.
3. The method according to claim 1, wherein after the proxy node of the side chain sends the whole blocks to the main chain content server corresponding to a preset node address according to the block acquisition request, the method further comprises:
the proxy node of the side chain replicates and stores the entire block.
4. The method according to any one of claims 1 to 3, further comprising:
if so, each node in the main chain continues to store the block.
5. A blockchain-based data storage system, the system comprising a main chain and a side chain;
detecting whether the available storage capacity of the proxy node is smaller than a preset storage threshold value or not by the proxy node of the main chain;
if the number of the blocks is smaller than the preset value, the proxy node of the main chain records the block numbers of all the blocks between the starting block and the ending block to be transferred;
the proxy node of the main chain sends the whole blocks to the proxy node of the side chain corresponding to the preset node address on the main chain;
the agent node of the side chain sends the all blocks to the consensus node of the side chain, so that the consensus node of the side chain agrees to verify the all blocks;
the consensus node consensus verification of the side chain passes through all the blocks, and all the blocks are stored in a side chain content server corresponding to a preset node address on the side chain;
after the agent node of the main chain detects that all the blocks pass consensus verification on the side chain, the agent node of the main chain broadcasts block transfer information in the whole network;
deleting all the blocks by each node in the main chain according to the block transfer information;
when the agent node of the main chain receives the query request, sending a block acquisition request to the agent node of the side chain;
the proxy node of the side chain determines the block numbers of the starting block and the ending block in all the blocks on the side chain according to the block acquisition request;
the proxy node of the side chain intercepts all the blocks from the block chain on the side chain according to the block numbers of the starting block and the ending block in all the blocks on the side chain;
the agent node of the side chain executes the intelligent contract on the side chain, and the block numbers of all blocks on the side chain are converted into the block numbers on the main chain;
the agent node of the side chain sends all blocks corresponding to the block numbers converted on the main chain to a main chain content server corresponding to a preset node address;
the proxy node of the main chain accesses the main chain content server and acquires all the blocks;
and the proxy node of the main chain is used for assembling all the blocks on the stored block chain according to the block numbers of the starting block and the ending block in all the blocks and the numbering sequence.
6. The system according to claim 5, wherein the proxy node of the main chain obtains the hash value of the terminating block when a new block is added after the terminating block, and uses the hash value of the terminating block as a feature value of a block header in the new block.
7. The system of claim 5, wherein the proxy node of the side chain replicates and stores the entire tile.
CN201811031816.5A 2018-09-05 2018-09-05 Data storage method and system based on block chain Active CN109117097B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811031816.5A CN109117097B (en) 2018-09-05 2018-09-05 Data storage method and system based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811031816.5A CN109117097B (en) 2018-09-05 2018-09-05 Data storage method and system based on block chain

Publications (2)

Publication Number Publication Date
CN109117097A CN109117097A (en) 2019-01-01
CN109117097B true CN109117097B (en) 2020-06-12

Family

ID=64858263

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811031816.5A Active CN109117097B (en) 2018-09-05 2018-09-05 Data storage method and system based on block chain

Country Status (1)

Country Link
CN (1) CN109117097B (en)

Families Citing this family (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109711817A (en) * 2019-01-16 2019-05-03 杭州基尔区块链科技有限公司 Data processing method, device and system based on block chain
CN109784857B (en) * 2019-01-16 2020-09-25 杭州基尔区块链科技有限公司 Data processing method, device and system based on block chain
CN109727135A (en) * 2019-01-23 2019-05-07 昧来网络科技(上海)有限公司 Promote method, the computer-readable medium of the operation of block chain information and processing capacity
CN110033243B (en) * 2019-03-06 2023-01-10 华南师范大学 Main chain evidence storing method, system and storage medium based on block chain intelligent contract
CN111695991B (en) * 2019-03-14 2024-02-06 北京沃东天骏信息技术有限公司 Block-based contract processing method and device, block chain node and storage medium
CN110096435B (en) * 2019-04-09 2023-08-08 平安科技(深圳)有限公司 Automatic code writing method, device, computer equipment and storage medium
CN110347679B (en) * 2019-06-20 2020-08-04 阿里巴巴集团控股有限公司 Data storage method, device and equipment based on receipt
US10944549B2 (en) 2019-06-20 2021-03-09 Advanced New Technologies Co., Ltd. Blockchain-type data storage
CN111448781B (en) 2019-07-11 2022-08-26 创新先进技术有限公司 Computer-implemented method for communicating shared blockchain data
WO2019179539A2 (en) 2019-07-11 2019-09-26 Alibaba Group Holding Limited Shared blockchain data storage
SG11202001975SA (en) 2019-07-11 2020-04-29 Alibaba Group Holding Ltd Shared blockchain data storage
CN110648140B (en) * 2019-09-12 2023-01-06 广州蚁比特区块链科技有限公司 Multi-chain matching method and device based on block chain
CN112506914B (en) * 2019-09-16 2024-02-27 西安华域网络文化发展有限公司 Block chain data management method, system, device and medium based on double-chain structure
CN110929229A (en) * 2019-11-26 2020-03-27 中国石油大学(华东) Block chain-based office document credibility verification method and system
CN111078790B (en) * 2019-12-04 2022-05-24 福州博泉网络科技有限公司 Method and system for synchronizing isolated block data in block chain and storage medium
CN111199504B (en) * 2019-12-29 2023-09-26 杭州拓深科技有限公司 Block chain-based decentralization fire control maintenance supervision method
CN111683117B (en) * 2020-05-11 2021-12-10 厦门潭宏信息科技有限公司 Method, equipment and storage medium
CN111625598B (en) * 2020-05-15 2023-08-25 南京东垚建筑科技研究院有限公司 Engineering collaboration block chain data structure and application method
CN111683059B (en) * 2020-05-18 2022-08-23 国网浙江省电力有限公司 Method, system, equipment and storage medium for supervising main chain-side chain
EP3958144A1 (en) * 2020-08-19 2022-02-23 Siemens Aktiengesellschaft Blockchain blocks storage management
CN112416263B (en) * 2020-12-10 2022-09-30 从法信息科技有限公司 Space-time certification blocking storage method and device based on random verification and electronic equipment
CN112948350B (en) * 2021-02-02 2023-08-01 中央财经大学 Distributed ledger model cold data archiving and migration storage method based on MPT verification
CN112988893B (en) * 2021-03-15 2023-05-12 中国联合网络通信集团有限公司 Information management method, system, block chain node and medium based on block chain
CN113034146B (en) * 2021-05-25 2021-08-17 杭州云链趣链数字科技有限公司 Block chain-based communication method, system, electronic device and storage medium
CN113420169B (en) * 2021-06-22 2023-03-21 重庆紫光华山智安科技有限公司 File storage and query method, system, electronic equipment and medium
CN113660092B (en) * 2021-07-30 2024-01-23 国网天津市电力公司 Power data uploading system and method based on zero knowledge proof
CN114791788B (en) * 2022-04-24 2023-07-18 成都信息工程大学 Data storage method and device based on block chain
CN116340335B (en) * 2023-05-30 2023-09-05 广东石油化工学院 Industrial equipment data storage system based on alliance chain and data processing method thereof

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107464106A (en) * 2017-07-25 2017-12-12 北京果仁宝科技有限公司 The method and system merchandised between block chain main chain and side chain
CN108074081A (en) * 2017-12-08 2018-05-25 上海策赢网络科技有限公司 The transfer method and device of a kind of virtual resource

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10305694B2 (en) * 2016-05-27 2019-05-28 Mastercard International Incorporated Method and system for efficient distribution of configuration data utilizing permissioned blockchain technology
US20170357966A1 (en) * 2016-06-09 2017-12-14 Mastercard International Incorporated Method and system for use of a proprietary private blockchain

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107464106A (en) * 2017-07-25 2017-12-12 北京果仁宝科技有限公司 The method and system merchandised between block chain main chain and side chain
CN108074081A (en) * 2017-12-08 2018-05-25 上海策赢网络科技有限公司 The transfer method and device of a kind of virtual resource

Also Published As

Publication number Publication date
CN109117097A (en) 2019-01-01

Similar Documents

Publication Publication Date Title
CN109117097B (en) Data storage method and system based on block chain
CN111416808B (en) Cross-block-chain data mutual storage method, device, equipment and storage medium
EP3629272B1 (en) Method and device for running chaincode
US20210209373A1 (en) Media authentication using distributed ledger
CN109002725B (en) Data processing system based on block chain
CN111681003A (en) Resource cross-chain transfer method and device, computer equipment and storage medium
CN110430288B (en) Node access method, node access device, computer equipment and storage medium
CN111698315B (en) Data processing method and device for block and computer equipment
CN113255014B (en) Data processing method based on block chain and related equipment
CN109936620B (en) Block chain-based storage method, device, system and storage medium
CN113765675B (en) Transaction data processing method, device, equipment and medium
WO2023020242A1 (en) Blockchain-based data processing method and apparatus, computer device, computer-readable storage medium, and computer program product
CN111367923A (en) Data processing method, data processing device, node equipment and storage medium
CN112883117A (en) Data synchronization method, equipment and computer readable storage medium
JP2024515022A (en) Blockchain-based data processing method, device, equipment, and computer program
CN114036495B (en) Method and device for updating privatized deployment verification code system
CN116827957B (en) Information processing method, device, equipment and medium based on multi-block chain
WO2023168993A1 (en) Blockchain-based data processing method, apparatus, and device, medium, and product
CN108882230B (en) Call record management method, device and system
JP2024506093A (en) Cross-chain transaction processing methods and devices, electronic equipment and computer programs
CN109120714B (en) Security data recovery method and system, and node server
CN117010889A (en) Data processing method, device, equipment, medium and product
CN111695902A (en) Block chain-based interconnection method and device and computer storage medium
CN117056084B (en) Data processing method, device, equipment and medium based on hierarchical blockchain network
CN114499869B (en) Resource cross-chain exchange method and device based on block chain and computer equipment

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