CN116954522A - Block chain storage optimization method based on IPFS - Google Patents

Block chain storage optimization method based on IPFS Download PDF

Info

Publication number
CN116954522A
CN116954522A CN202311089522.9A CN202311089522A CN116954522A CN 116954522 A CN116954522 A CN 116954522A CN 202311089522 A CN202311089522 A CN 202311089522A CN 116954522 A CN116954522 A CN 116954522A
Authority
CN
China
Prior art keywords
block
security
ipfs
abstract
utxo set
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
CN202311089522.9A
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.)
Hainan Junma Data Research Institute Co ltd
Harbin Engineering University Sanya Nanhai Innovation And Development Base
Harbin Engineering University
Original Assignee
Hainan Junma Data Research Institute Co ltd
Harbin Engineering University Sanya Nanhai Innovation And Development Base
Harbin Engineering University
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 Hainan Junma Data Research Institute Co ltd, Harbin Engineering University Sanya Nanhai Innovation And Development Base, Harbin Engineering University filed Critical Hainan Junma Data Research Institute Co ltd
Priority to CN202311089522.9A priority Critical patent/CN116954522A/en
Publication of CN116954522A publication Critical patent/CN116954522A/en
Pending legal-status Critical Current

Links

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/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • 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/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • 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/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • 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/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • 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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses an IPFS-based blockchain storage optimization method, which comprises the following steps: constructing a block safety judging model to obtain a high safety block and a low safety block; uploading a UTXO set and combining the high-security block, generating a summary block by compressing the high-security block and updating the UTXO set, broadcasting the summary block to other nodes for storage, and storing the received summary block after security verification by the other nodes; the low security block directly stores a local node; and the abstract blocks are linked end to form an abstract chain, and the local node is used for storing the abstract chain to replace a complete high-safety block so as to finish the block chain storage optimization. The application can relieve the problem of block expansion to a certain extent, reduce the effect of node storage expense, effectively respond to transaction verification and improve the transaction processing speed.

Description

Block chain storage optimization method based on IPFS
Technical Field
The application belongs to the technical field of storage optimization, and particularly relates to an IPFS-based block chain storage optimization method.
Background
Blockchains are a record keeping technology that stores transactions and valuable information in blocks. The blocks are connected in an encrypted mode. Blockchain has important features for distinguishing centralized systems, such as decentration, invariance, security and anonymity, so that blockchain technology plays a key role in various fields, and has extremely wide application range. As such, blockchain memory optimization methods have become an important research focus in the area of blockchain storage.
The interstellar file system (IPFS) is a decentralized distributed file system that uses multiple nodes for file storage and access in the interstellar network. IPFS is intended to establish a worldwide seamless network that allows users to store, share and access any type of digital content, including text, images, and audio-video. An important feature of IPFS is addressability. Each IPFS file has a unique CID (Content Identifier). The CID contains the hash value of the file, the file type, and other metadata information. Thus, in addition to functioning as a unique flag file, a CID may also retrieve a particular version of a file. Since CID is a form of public key encryption, data integrity and security of the file are ensured. IPFS is also a point-to-point protocol, unlike traditional server-based file storage and transfer. Each node may store and provide files. The file is stored as a set of encrypted hash values that uniquely identify the file contents. IPFS divides the stored and managed nodes into a group of independent node sets based on Kademlia algorithm abstracting the interstellar network, and the node sets form a logic whole. When the file is required to be stored, the file is stored on different nodes in the node set in a scattered mode, and meanwhile data redundancy, real-time monitoring, safety control and other operations are performed according to the condition of the nodes, so that the safety and the integrity of the data are guaranteed.
In the aspect of block chain storage optimization, an erasure coding technology is often used for carrying out storage optimization on a block, but the block chain storage optimization based on erasure coding consumes a great deal of computing resources and network I/O resources in the processes of block coding, data recovery and the like. In addition, the storage chain node based on the erasure codes only stores partial block data components so as to achieve the effect of reducing the node storage overhead. The node only relies on locally stored fragmented data to verify that the transaction has the disadvantage of high latency and slow response. Aiming at the problem, the application provides an IPFS-based blockchain storage optimization method, which can effectively respond to transaction verification and improve transaction processing speed while relieving the problem of blockexpansion.
Disclosure of Invention
In order to solve the technical problems, the application provides an IPFS-based blockchain storage optimization method which can relieve the problem of block expansion to a certain extent, lighten the effect of node storage overhead and effectively respond to transaction verification and improve the transaction processing speed.
In order to achieve the above object, the present application provides a blockchain storage optimization method based on IPFS, including the following steps:
constructing a block safety judging model to obtain a high safety block and a low safety block;
uploading a UTXO set and combining the high-security block, generating a summary block by compressing the high-security block and updating the UTXO set, broadcasting the summary block to other nodes for storage, and storing the received summary block after security verification by the other nodes; the low security block directly stores a local node;
and the abstract blocks are linked end to form an abstract chain, and the local node is used for storing the abstract chain to replace a complete high-safety block so as to finish the block chain storage optimization.
Optionally, the method for constructing the block security judgment model is as follows:
aiming at whether an attacker can overtake the condition of a chain which is not maliciously manipulated or tampered, combining the progress obtained by the attacker to conform to Poisson distribution, and obtaining the distribution expectation of the progress obtained by the attacker;
and calculating the probability of successful overtaking of the honest chain by the attacker, and obtaining the block security judgment model.
Optionally, the abstract block comprises an abstract header and an abstract body;
the digest header comprises public field information, a high security block start height, a high security block end height and a UTXO set hash value;
the digest includes storing a high security chunk hash value returned by the IPFS.
Optionally, the method for generating the digest block by compressing the high security block and updating the UTXO set includes:
traversing the continuous high-security blocks, acquiring all transaction data and temporarily storing the transaction data in a container;
and updating the UTXO set according to whether the digest block partition is generated or not.
Optionally, the method for updating the UTXO set according to whether the digest block partition is generated includes:
first case: searching transaction inputs which are not referred to in all transaction data without generating a summary block, regarding the transaction inputs which are not referred to as non-spent transaction outputs, and adding the non-spent transaction inputs into the UTXO set;
second case: and after the abstract block is generated, acquiring the UTXO set in the latest generated abstract block, recording the value transfer occurring in the high-security block, updating the UTXO set until all transaction data are searched, and returning to the latest UTXO set.
Optionally, the method for generating the summary block includes:
judging the safety of the high-safety block;
firstly, the mining node broadcasts the UTXO set and the high-security block as data objects to an IPFS node, and the data objects are uploaded to an IPFS system by the IPFS node;
the IPFS system returns the hash value of the UTXO set and the hash value of the high-security block to the IPFS node;
and the IPFS node informs the mining node of receiving the hash value of the UTXO set and the hash value of the high-security block to generate a summary block.
Optionally, the method for judging the security of the high security block includes:
acquiring the UTXO set by utilizing a UTXO set generation algorithm;
the mining node stores and forwards the UTXO set and the high-security block to an IPFS system through an IPFS node;
the IPFS system stores and forwards the hash value of the UTXO set and the hash value of the high-security block to the mining node through the IPFS node;
after the mining node receives the parameter information returned by the IPFS system, writing the hash value of the UTXO set, the starting height of the high-security block and the ending height of the high-security block into corresponding fields in the abstract header, and writing the hash value of the high-security block into the abstract body;
and the mining node searches for a random number meeting the target difficulty, generates the abstract block and adds the abstract block into the abstract chain.
Optionally, the method for security verification in the method for storing the abstract block broadcasted to other nodes after the other nodes receive the abstract block and perform security verification includes:
the nodes of the whole network receiving the abstract blocks check whether the received abstract blocks meet the workload certification, and if the received abstract blocks do not pass the verification, the algorithm is ended; if the verification is passed, checking whether the UTXO set and the high-security block in the digest block are maliciously tampered; the node downloads the UTXO set from the UTXO set hash value in the abstract header to the IPFS system, downloads the full version high-security block data from the high-security block hash value in the abstract body to the IPFS, and re-traverses the newly downloaded high-security block to obtain the UTXO set obtained by the secondary traversing block; comparing whether the UTXO set stored in the abstract block is the same as the UTXO set obtained by the secondary traversing block, and if the UTXO set and the UTXO set are the same, proving that the UTXO set is not changed; the node compares the newly downloaded high-security block with the local disk storage abstract block in sequence; if the high security blocks are all the same, then verification passes.
The application has the technical effects that: compared with the method for storing and optimizing the blockchain by using erasure codes, the method can effectively respond to transaction verification and improve transaction processing speed while relieving the problem of block expansion.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
FIG. 1 is a schematic flow chart of a block chain storage optimization method based on IPFS according to an embodiment of the present application;
FIG. 2 is a schematic diagram of probability of attack success in an embodiment of the present application;
FIG. 3 is a block security decision model according to an embodiment of the present application;
FIG. 4 is a diagram illustrating a single transaction inquiry time according to an embodiment of the present application; wherein (a) is the case where the number of nodes is 6, and (b) is the case where the number of nodes is 12;
FIG. 5 is a schematic diagram of memory consumption of a block and a summary block according to an embodiment of the present application; wherein (a) is a case where n=10 and (b) is a case where n=12;
FIG. 6 is a graph showing the comparison of system memory consumption according to the embodiment of the present application.
Detailed Description
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
As shown in fig. 1, the embodiment provides a block chain storage optimization method based on IPFS, which includes:
step 001, establishing a block security judgment model for judging the block chain security;
step 002, compressing the high security blocks to generate abstract blocks, broadcasting the generated abstract blocks to other nodes for storage, and linking the head and tail of a plurality of abstract blocks to form an abstract chain;
and 003, the local node stores a lightweight digest chain to replace a complete high-security block, so that the occupation of the storage space of the node is reduced.
Step 001 specifically comprises the following steps:
step 00101, researching whether the number of blocks generated by malicious nodes can successfully overtake the number of blocks generated by honest nodes to obtain a block security judgment algorithm, wherein a block chain security judgment model is shown in fig. 3, and specifically comprises the following steps: there are 51% attacks in the blockchain network, i.e., if an attacker has more than 50% of the computing power of the whole network, the entire blockchain network can be controlled. At this point, the attacker more quickly catches up with the dishonest chain by implementing a blockchain bifurcation attack. Whether an attacker can successfully overtake the honest chain or not is approximately abstracted into a gambling light transmission problem. Assuming that p is the probability that the honest node calculates the random number meeting the condition, q is the probability that the attack node calculates the random number meeting the condition, and p and q satisfy the formula (1):
p+q=1(1)
z is the number of blocks of the chain where the honest node is located leading the malicious node. The progress made by the attacker follows the Poisson distribution, and the distribution of the progress made by the attacker is expected to be represented by formula (2):
λ=z×(p/q)(2)
probability P of attacker successfully overtaking honest chain z Can be represented by formula (3):
from equation (3), the probability of a malicious node successfully overtaking an honest chain is mainly related to p, q and z. When p > q, as the number z of blocks of the chain where the honest node leads the malicious node increases, it is more and more difficult for an attacker to overtake the honest chain.
The probability q of the random number calculated by the attacker node is respectively 0.1,0.2,0.3 and 0.4, image fitting is carried out according to a formula (3), the code implementation is written by using python language, and the fitting result is shown in figure 2.
The attacker node makes the probability q of the random number calculated by the attacker node be 0.1,0.2,0.3 and 0.4 respectively, image fitting is carried out according to a probability formula of the attacker successfully overtaking the honest chain, and the code is written by using python language, and the fitting result is shown in figure 2. As can be derived from fig. 2, when the number of blocks that the honest node leads is greater, the probability of an attacker tampering with the blockchain decreases exponentially until it goes to 0. It follows that the more difficult it is to tamper with the block data that is closer to the created block, the higher the block security.
Boerl's law states that any event has a probability of occurrence below 10 -50 Will be defined as impossible events. As can be seen from FIG. 2, when the number z of blocks leading the honest chain increases to a certain number, P z Will always be below 10 -50 . By analyzing the Boerl's law and fitting the image, a blockchain of height n can be divided into two types, high security blocks and low security blocks as shown in FIG. 3.
As can be seen from fig. 3, since the probability of tampering with the block before the height n-z+1 approaches 0, the block is referred to as a high security block, and the block after the height n-z+1 is at risk of tampering, and the block is referred to as a low security block. The block security decision model confirms the conclusion in fig. 2 that the more difficult the block data is tampered with, the higher the block security.
Block security decision algorithm as shown in table 1, the inputs of the block security decision algorithm are the height H of the blockchain and the attacker node, which are used to calculate the probability of a random number meeting the conditions, and the output is the height of the last high security block. The logic steps of the algorithm are as follows: firstly, initializing parameters, and then acquiring the height of the last high-security block by traversing a block chain. In the traversing process, judging according to the probability of the random number meeting the conditions calculated by the honest node and the probability of the malicious node successfully overtaking the honest chain, and executing corresponding operation if the specific conditions are met.
TABLE 1
Step 002 specifically includes the following steps:
step 00201 determining the structure composition of the abstract block, specifically comprising an abstract head and an abstract body. The digest mainly stores the high-security block hash value returned by the IPFS. The digest header consists of multiple fields that can be accurately pointed to the high security block and UTXO set stored in the IPFS by additional several attribute parameters in the digest header. Besides the common field information of the common block header, the summary header also records and stores three additional important parameter fields, such as the high security block start height HSBS, the high security block end height HSBT, and the UTXO set hash value Uts.
Step 00202, providing a UTXO set generation algorithm, which specifically comprises the following steps:
the UTXO set generation algorithm, wherein the UTXO data model describes the value transfer condition by recording transaction data; to achieve the effect of faster verification of transactions in the case of storing a lightweight digest chain, BSO-IPFS nodes need to rely on Uts fields in the digest header; uts is the hash value of the UTXO set, so it is necessary to traverse each transaction data in the single-unit number security block, obtain all the non-spent transaction outputs to form the UTXO set; the UTXO set generation algorithm is shown in table 2.
TABLE 2
The UTXO set generation algorithm first traverses the continuous number of units L of high security blocks, obtaining all transaction data and temporarily storing the transaction data in the container T. The BSO-IPFS then updates the UTXO set based on whether a digest block partition condition has been generated. Case 1: the summary block is not generated, transaction inputs which are not "referenced" in the overall transaction data are retrieved and considered as non-spent transaction outputs, added to the UTXO set. Case 2: and after the abstract block is generated, acquiring a UTXO set in the latest generated abstract block, recording value transfer occurring in the unit quantity L high-security block, updating the UTXO set until all transaction data are searched, and returning to the latest UTXO set.
Step 00203, updating UTXO set according to the cases, wherein the update UTXO set is divided into two cases:
case 1: the summary block is not generated, transaction inputs which are not "referenced" in the overall transaction data are retrieved and considered as non-spent transaction outputs, added to the UTXO set.
Case 2: and after the abstract block is generated, acquiring a UTXO set in the latest generated abstract block, recording value transfer occurring in the unit quantity L high-security block, updating the UTXO set until all transaction data are searched, and returning to the latest UTXO set.
Step 00203, providing a UTXO set generation algorithm, wherein the algorithm firstly traverses L high-security blocks with continuous unit number, and obtains all transaction data to be temporarily stored in a container T. The BSO-IPFS then updates the UTXO set based on whether a digest block partition condition has been generated. Case 1: the summary block is not generated, transaction inputs which are not "referenced" in the overall transaction data are retrieved and considered as non-spent transaction outputs, added to the UTXO set. Case 2: and after the abstract block is generated, acquiring a UTXO set in the latest generated abstract block, recording value transfer occurring in the unit quantity L high-security block, updating the UTXO set until all transaction data are searched, and returning to the latest UTXO set.
Step 00204. Generating a summary block sum and verifying. The method for generating the summary block is as follows:
step one: first the security of the L blocks is determined,
step two: the mining node firstly broadcasts the UTXO set obtained in the previous section and L high-security blocks as data objects to an IPFS node, and the data objects are uploaded to an IPFS system by the IPFS node.
Step three: IPFS system returns hash values for IPFS node UTXO set and L high security blocks
Step four: the IPFS node shall inform the mining node of the hash value received by itself and the message delivery ends.
The specific judging process of the first step is as follows:
for the security of the L blocks, if the security is a low-security block, the security is directly and completely stored in a local node, and the problems of abstract blocks and the like are not involved. And if the block is a high-security block, acquiring the UTXO set by using a UTXO set generation algorithm. Then, the mining node combines the UTXO set with the unit quantity L of the high-security blocks B i+1 ,B i+2 ……B i+L And the data is stored and forwarded to the IPFS system through the IPFS node. Next, the IPFS system hashes the UTXO set and blocks B with high security i+1 ,B i+2 ……B i+L The hash value of (a) is forwarded to the mining node via IPFS node storage. After the mining node receives parameter information returned by the IPFS system, the hash value, the high-security block start height and the high-security block end height of the UTXO set are written into corresponding fields Uts, HSBS and HSBT in the abstract header, and the unit quantity L of high-security blocks B is written into the abstract header i+1 ,B i+2 ……B i+L The returned hash value is written into the digest. Finally, the mining node searches for a random number Nonce meeting the target difficulty T, the Nonce finds out to indicate that the summary block is successfully generated, and finally the generated summary block is added into the summary chain.
Step 00205 broadcasting abstract chain to store other nodes of the whole network, and storing after security verification by other nodes after receiving the abstract chainAnd storing, namely realizing the safety of data storage. The security verification algorithm flow is as follows: in the digest block verification algorithm, the node first checks whether the received digest block meets the workload proof, and if the verification is not passed, the algorithm ends. If the verification passes, the UTXO set and high security block B in the digest block are further checked i+1 ,B i+2 ……B i+L Whether or not there is malicious tampering. The node downloads the UTXO set from Uts field in the abstract header to IPFS, downloads the full version high security block data from the high security block hash value in the abstract header to IPFS, and re-traverses the newly downloaded high security block B i+1 ,B i+2 ……B i+L To obtain BlockUTXO. If the two are the same, the UTXO set is unchanged. The node then downloads the newly downloaded high security block B i+1 ,B i+2 ……B i+L And local disk storage B i+1 ,B i+2 ……B i+L The blocks are aligned one after the other. If the L number of high security blocks are all the same, then the verification passes. The digest block verification algorithm can ensure the correctness of the digest block data and the consistency of the digest block data.
In order to verify the effect of the BSO-IPFS provided by the application, the BSO-IPFS is analyzed from the aspects of performance indexes such as safety, storage space occupation, time complexity and the like in experimental verification, so that the BSO-IPFS is demonstrated to play a role in maintaining data safety and relieving block expansion.
BSO-IPFS is implemented on the basis of an open source blockchain platform Hyperledger Fabric v 1.0.0. There are a total of two experiments: 1) The transaction inquiry time required by each transaction in the different block chain systems is tested. 2) The storage consumption of Fabric and BSO-IPFS were tested and compared.
(1) Transaction inquiry time experiment
Transaction query time in a blockchain refers to the time from the issuance of a query request to the return of the query result. The influence of the number of nodes of the experimental test system and the number of transactions contained in the block on the inquiry time of a single transaction. The experiment tests that the number of system nodes is 6 and 12 respectively, and the time required for inquiring one transaction is required under the condition that the block comprises 100, 300 and 500 transactions. In order to intuitively reflect the influence of the number of system nodes and the number of block-containing transaction on the inquiry time of a single transaction, let the abscissa be the number of transactions contained in the block, and the ordinate be the time consumed for inquiry in ms, as shown in fig. 4 (a) and 4 (b).
As can be seen from fig. 4 (a) and fig. 4 (b), as the number of nodes increases, the time required for a single transaction query increases for all three systems. This is because as the number of blockchain system nodes increases, more frequent communications between nodes are required to synchronize data, which can result in slower transaction inquiry times. In addition, the increase of the number of system nodes may change the network topology, and more forwarding paths and delays may be introduced between the nodes, which may also increase the transaction inquiry time.
(2) Storage consumption comparison experiment
The BSO-IPFS miner node compresses a unit number of lhigh-security blocks to generate summary blocks. In order to alleviate the storage pressure of the node, the node adopts a mode of locally storing the digest block instead of a complete high-security block.
First, blocks containing different transaction numbers are tested for storage consumption of the blocks and the digest blocks when the digest blocks are generated. The transaction numbers contained in the experiment setting blocks are n=10, n=20, the bso-IPFS compresses the blocks according to the sequence of L being 2,5, 10,20,30,40 and 50 to generate the summary blocks, the storage consumption of the common blocks before compression and the storage consumption of the summary blocks after compression are counted, the table 3 is the comparison of the storage consumption of the blocks when the blocks contain 10 transactions and the summary blocks, the table 4 is the comparison of the storage consumption of the blocks when the blocks contain 20 transactions and the summary blocks, and the experimental data are shown in the tables 3 and 4.
TABLE 3 Table 3
TABLE 4 Table 4
In order to intuitively reflect the influence of the number of transactions and the number of consecutive high security blocks L contained in a block on the memory space occupation, table 3 is plotted as shown in fig. 5 (a), and table 4 is plotted as shown in fig. 5 (b). In fig. 5, the abscissa indicates the number L of consecutive high security blocks, and the ordinate indicates the memory space occupation in KB.
As can be seen from fig. 5, the memory consumption of a block is closely related to the number of transactions contained in the block. The greater the number of transactions contained within a block, the greater the memory space consumed by the block. With the gradual increase of the number of the blocks, the storage consumption of the summary blocks after compression is far smaller than that of the blocks, and the difference between the storage consumption of the summary blocks and the storage consumption of the blocks is larger as L increases.
The curves in fig. 5 (a) and (b) and corresponding figures find that the greater the number of transactions contained in a block, the greater the reduction in data storage consumption of the digest block. One of the effective ways to reduce the consumption of block data storage is to have the block contain a greater number of transactions as appropriate.
Finally, the memory consumption of BSO-IPFS and Fabric were tested and compared. The transaction number contained in the block is set in the experiment, the conditions that the number of the system blocks is 200, 300, 500 and L is 20 are tested, and the storage consumption difference of the two system single nodes is compared and analyzed. The experimental results are shown in FIG. 6.
As can be seen from fig. 6, the single-node storage consumption of BSO-IPFS is much lower than that of Fabric when the number of system generated blocks is the same. As the number of blocks generated by the system increases, the difference in memory consumption between the two becomes more significant. This is because nodes in Fabric adopt full copy storage policy, and because the sizes of the outgoing blocks set by the system are the same, the total amount of data stored at a single node is completely proportional to the number of blocks generated.
The present application is not limited to the above-mentioned embodiments, and any changes or substitutions that can be easily understood by those skilled in the art within the technical scope of the present application are intended to be included in the scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (8)

1. The block chain storage optimization method based on the IPFS is characterized by comprising the following steps of:
constructing a block safety judging model to obtain a high safety block and a low safety block;
uploading a UTXO set and combining the high-security block, generating a summary block by compressing the high-security block and updating the UTXO set, broadcasting the summary block to other nodes for storage, and storing the received summary block after security verification by the other nodes; the low security block directly stores a local node;
and the abstract blocks are linked end to form an abstract chain, and the local node is used for storing the abstract chain to replace a complete high-safety block so as to finish the block chain storage optimization.
2. The method for optimization of IPFS-based blockchain storage of claim 1,
the method for constructing the block security judgment model comprises the following steps:
aiming at whether an attacker can overtake the condition of a chain which is not maliciously manipulated or tampered, combining the progress obtained by the attacker to conform to Poisson distribution, and obtaining the distribution expectation of the progress obtained by the attacker;
calculating the probability of successful overtaking of the honest chain by the attacker, and obtaining a block security judgment model
3. The method for optimization of IPFS-based blockchain storage of claim 1,
the abstract block comprises an abstract head and an abstract body;
the digest header comprises public field information, a high security block start height, a high security block end height and a UTXO set hash value;
the digest includes storing a high security chunk hash value returned by the IPFS.
4. The method for optimizing blockchain storage based on IPFS of claim 3,
the method for generating the digest block and updating the UTXO set by compressing the high security block includes:
traversing the continuous high-security blocks, acquiring all transaction data and temporarily storing the transaction data in a container;
and updating the UTXO set according to whether the digest block partition is generated or not.
5. The method for IPFS-based blockchain storage optimization of claim 4,
the method for updating the UTXO set according to whether the digest block partition is generated comprises the following steps:
first case: searching transaction inputs which are not referred to in all transaction data without generating a summary block, regarding the transaction inputs which are not referred to as non-spent transaction outputs, and adding the non-spent transaction inputs into the UTXO set;
second case: and after the abstract block is generated, acquiring the UTXO set in the latest generated abstract block, recording the value transfer occurring in the high-security block, updating the UTXO set until all transaction data are searched, and returning to the latest UTXO set.
6. The method for IPFS-based blockchain storage optimization of claim 4,
the method for generating the abstract block comprises the following steps:
judging the safety of the high-safety block;
firstly, the mining node broadcasts the UTXO set and the high-security block as data objects to an IPFS node, and the data objects are uploaded to an IPFS system by the IPFS node;
the IPFS system returns the hash value of the UTXO set and the hash value of the high-security block to the IPFS node;
the IPFS node informs the mining node of receiving the hash value of the UTXO set and the hash value of the high-security block to generate a summary block
7. The method for IPFS-based blockchain storage optimization of claim 6,
the method for judging the safety of the high-safety block comprises the following steps:
acquiring the UTXO set by utilizing a UTXO set generation algorithm;
the mining node stores and forwards the UTXO set and the high-security block to an IPFS system through an IPFS node;
the IPFS system stores and forwards the hash value of the UTXO set and the hash value of the high-security block to the mining node through the IPFS node;
after the mining node receives the parameter information returned by the IPFS system, writing the hash value of the UTXO set, the starting height of the high-security block and the ending height of the high-security block into corresponding fields in the abstract header, and writing the hash value of the high-security block into the abstract body;
and the mining node searches for a random number meeting the target difficulty, generates the abstract block and adds the abstract block into the abstract chain.
8. The method for optimizing blockchain storage based on IPFS of claim 3,
broadcasting the abstract block to other nodes for storage, and carrying out security verification after the other nodes receive the abstract block, wherein the method for carrying out security verification in the method for storing comprises the following steps:
the nodes of the whole network receiving the abstract blocks check whether the received abstract blocks meet the workload certification, and if the received abstract blocks do not pass the verification, the algorithm is ended; if the verification is passed, checking whether the UTXO set and the high-security block in the digest block are maliciously tampered; the node downloads the UTXO set from the UTXO set hash value in the abstract header to the IPFS system, downloads the full version high-security block data from the high-security block hash value in the abstract body to the IPFS, and re-traverses the newly downloaded high-security block to obtain the UTXO set obtained by the secondary traversing block; comparing whether the UTXO set stored in the abstract block is the same as the UTXO set obtained by the secondary traversing block, and if the UTXO set and the UTXO set are the same, proving that the UTXO set is not changed; the node compares the newly downloaded high-security block with the local disk storage abstract block in sequence; if the high security blocks are all the same, then verification passes.
CN202311089522.9A 2023-08-28 2023-08-28 Block chain storage optimization method based on IPFS Pending CN116954522A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311089522.9A CN116954522A (en) 2023-08-28 2023-08-28 Block chain storage optimization method based on IPFS

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311089522.9A CN116954522A (en) 2023-08-28 2023-08-28 Block chain storage optimization method based on IPFS

Publications (1)

Publication Number Publication Date
CN116954522A true CN116954522A (en) 2023-10-27

Family

ID=88458485

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311089522.9A Pending CN116954522A (en) 2023-08-28 2023-08-28 Block chain storage optimization method based on IPFS

Country Status (1)

Country Link
CN (1) CN116954522A (en)

Similar Documents

Publication Publication Date Title
US20220414090A1 (en) Blockchain data index method, blockchain data storage method and device
US11483622B2 (en) Hybrid blockchains and streamchains using non-crypto hashes for securing audio-, video-, image-, and speech-based transactions and contracts
CN111597015B (en) Transaction processing method and device, computer equipment and storage medium
KR20210003234A (en) Maintaining blocks of a blockchain in a segmented blockchain network
US7447839B2 (en) System for a distributed column chunk data store
CN111338766A (en) Transaction processing method and device, computer equipment and storage medium
CN109948003B (en) Block chain system of isomorphic dual-mode main and auxiliary chains and block production method thereof
WO2021227319A1 (en) Engineering collaborative blockchain data structure and application method
Zhao et al. A novel enhanced lightweight node for blockchain
CN111444204B (en) Synchronous processing method, device, equipment and medium
Wang et al. Ess: An efficient storage scheme for improving the scalability of bitcoin network
CN109918451B (en) Database management method and system based on block chain
WO2022087837A1 (en) Blockchain system having efficient world state data structures
WO2022087834A1 (en) Blockchain system having efficient world state data structures
CN109067849A (en) Method of data synchronization based on block
CN108876378A (en) Publicly-owned chain data enciphering back-up method
CN117349880A (en) Distributed data storage and recording method based on block chain
CN110928923A (en) Data storage method and system based on block chain
Khacef et al. Trade-off between security and scalability in blockchain design: A dynamic sharding approach
CN114791788B (en) Data storage method and device based on block chain
CN116954522A (en) Block chain storage optimization method based on IPFS
CN116361292A (en) Cross-chain resource mapping and management method and system
CN111414417A (en) Video copyright management method based on block chain
CN116977067A (en) Block chain-based data processing method, device, equipment and readable storage medium
WO2023004807A1 (en) Knowledge management system, method and apparatus, electronic device, and storage medium

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