Block chain processing method and device, equipment storage medium and program product
By storing the block header and body separately in the blockchain system and storing the block volume data on the second node, the problems of storage, communication and computing redundant processing of the blockchain system are solved, and the processing performance is improved and the processing is reduced. Storage overhead.
Patent Information
- Application Number
- CN202411399657.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-10-09
AI Technical Summary
Blockchain systems require a lot of redundant processing and cross-verification in storage, communication, and computing, resulting in increased resource overhead and reduced processing performance.
By sending a request to the second node to apply for storage medium allocation upon receiving the block write notification, and storing the block object in the allocated storage medium, only the block header and simplified block volume metadata are stored locally, The second node stores block data to reduce storage overhead and node storage load.
It effectively reduces the overall storage overhead and node storage overhead of the blockchain system, breaks through the bottleneck of ledger and transaction scale, and improves the processing performance of the blockchain system.
Smart Images

Figure CN119232350A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a blockchain processing method, apparatus, device storage medium, and program product. Background Art
[0002] Blockchain is a new type of information processing and storage technology that adopts a decentralized networking structure for distributed ledger management and maintenance. It uses a consensus mechanism to ensure that ledger data is fair and cannot be tampered with, supports the neutral execution of contracts (codes recognized by multiple parties), and solves problems such as information opacity, lack of trust, and poor collaboration among partners.
[0003] However, in the blockchain system, each node stores its own data in a distributed accounting method, and the chain structure of the ledger data is combined with cryptographic algorithms to ensure the time sequence relationship and information self-consistency of the data; and the code (smart contract) signed and approved by the relevant nodes is run in a secure environment to ensure the neutrality and credibility of the information processing process. Therefore, the blockchain requires a lot of redundant processing and cross-verification processes in storage, communication, and computing, which leads to an increase in the resource overhead of the blockchain and a decrease in processing performance. Summary of the invention
[0004] The purpose of this application is to provide a blockchain processing method, apparatus, device storage medium and program product to avoid the problem of increased resource overhead and reduced processing performance of blockchain due to the need for a large amount of redundant processing and cross-validation processes in storage, communication and calculation of blockchain.
[0005] To achieve the above-mentioned purpose, an embodiment of the present application provides a blockchain processing method, which is executed by a first node and includes:
[0006] When receiving a write notification of the first block, sending a first request to a second node; wherein the second node includes one or more storage media, and the first request is used to apply for storage medium allocation;
[0007] receiving an access token sent by the second node in response to the first request;
[0008] Sending a second request to the second node, the second request carrying the access token and the block object to be stored in the first block, the second request being used to apply to store the block object in the allocated storage medium;
[0009] receiving a response message returned by the second node in response to the second request;
[0010] Obtain block body metadata of the first block according to the response message, and store the block body metadata locally.
[0011] Furthermore, the block body metadata includes:
[0012] A hash value of the block object;
[0013] A list of access addresses of the block objects;
[0014] Furthermore, the block body metadata also includes:
[0015] The encryption and decryption key identifier of the block object;
[0016] The encryption and decryption algorithm identifier of the block object.
[0017] Furthermore, the method further comprises:
[0018] Upon receiving the read notification of the first block, obtaining the locally stored block body metadata of the first block;
[0019] Sending a third request to the second node according to the block body metadata, where the third request is used to apply for reading the block object of the first block;
[0020] Receive the block object sent by the second node in response to the third request.
[0021] Further, after receiving the block object sent by the second node in response to the third request, the method further includes:
[0022] The integrity of the block object is verified according to the block body metadata.
[0023] Further, obtaining the block body metadata of the first block according to the response message includes:
[0024] If the first block is located on the migration target blockchain, the block body metadata of the first block is updated based on the access address list of the block object in the response message.
[0025] Furthermore, before sending the first request to the second node, the method further includes:
[0026] receiving first configuration information sent by a third node, where the first configuration information includes information for indicating the second node and relevant information for applying for use of a storage medium;
[0027] The second node and the first request are determined according to the first configuration information.
[0028] Furthermore, the read notification is triggered by blockchain migration.
[0029] Further, the write notification is triggered by blockchain migration;
[0030] After receiving the block object sent by the second node, the method further includes:
[0031] Determine the updated second node based on the blockchain migration goal;
[0032] The first request is sent to the updated second node.
[0033] Furthermore, the first request carries:
[0034] The chain identifier of the block;
[0035] The channel identifier of the block;
[0036] Block height;
[0037] Block body hash value.
[0038] Furthermore, the third request carries:
[0039] The chain identifier of the block;
[0040] The channel identifier of the block;
[0041] Block height;
[0042] Block body hash value;
[0043] A list of access addresses for blocks.
[0044] To achieve the above-mentioned purpose, an embodiment of the present application provides a blockchain processing method, which is executed by a second node, and the second node includes one or more storage media. The method includes:
[0045] receiving a first request sent by a first node;
[0046] allocating a storage medium for the first block according to the first request, and sending an access token corresponding to the allocated storage medium to the first node;
[0047] receiving a second request sent by the first node, where the second request carries the access token and a block object to be stored in the first block;
[0048] According to the second request, the block object is stored in the allocated storage medium, and a response message is returned.
[0049] Further, allocating a storage medium to the first block according to the first request includes:
[0050] Based on the information carried in the first request, query whether a storage medium has stored the block object of the first block;
[0051] When the query result indicates that the storage medium does not store the block object of the first block, the allocated storage medium and access token are determined.
[0052] Furthermore, storing the block object in a matching storage medium according to the second request and returning a response message includes:
[0053] Based on the properties of the storage medium, the block object is fragmented;
[0054] Based on the access token, upload each shard to the corresponding storage medium for storage;
[0055] Generating a response message including an access address list of the block object based on the storage location of each shard;
[0056] The response message is sent to the first node.
[0057] Furthermore, after uploading each shard to a corresponding storage medium for storage based on the access token, the method further includes:
[0058] The block object is cached.
[0059] Furthermore, the method further comprises:
[0060] receiving a third request sent by the first node, where the third request is used to apply for reading a block object of the first block;
[0061] The block object is sent according to the third request.
[0062] Further, sending the block object according to the third request includes:
[0063] querying whether to cache the block object based on the third request;
[0064] If the block object is cached, directly sending the block object;
[0065] If the block object is not cached, then based on the access address list of the block object, each fragment is read from the storage medium, and the fragments are spliced to obtain and send the block object.
[0066] Furthermore, before receiving the first request sent by the first node, the method further includes:
[0067] receiving second configuration information sent by a third node;
[0068] The one or more storage media are set according to the second configuration information.
[0069] To achieve the above-mentioned purpose, an embodiment of the present application provides a blockchain processing method, which is executed by a third node and includes:
[0070] When a first condition is met, a write notification is sent to the first node; wherein the first condition includes at least one of the following:
[0071] The blockchain or blockchain channel is created successfully;
[0072] The first node joins the blockchain or blockchain channel.
[0073] Furthermore, the method further comprises:
[0074] When the first condition is met,
[0075] Sending first configuration information to the first node, the first configuration information including information for indicating the second node and relevant information for applying for use of a storage medium; and,
[0076] Second configuration information is sent to the second node, where the second configuration information is used to set one or more storage media included in the second node.
[0077] Furthermore, the method further comprises:
[0078] A read notification is sent to the second node.
[0079] Furthermore, the method further comprises:
[0080] In the event of blockchain migration, the write notification and the read notification are generated.
[0081] To achieve the above-mentioned purpose, an embodiment of the present application provides a blockchain processing device, which is applied to a first node and includes:
[0082] A first sending module is used to send a first request to a second node when receiving a write notification of the first block; wherein the second node includes one or more storage media, and the first request is used to apply for storage medium allocation;
[0083] A first receiving module, configured to receive an access token sent by the second node in response to the first request;
[0084] A second sending module, configured to send a second request to the second node, wherein the second request carries the access token and the block object to be stored in the first block, and the second request is used to apply to store the block object in the allocated storage medium;
[0085] A second receiving module, configured to receive a response message returned by the second node in response to the second request;
[0086] The first processing module is configured to obtain block body metadata of the first block according to the response message, and store the block body metadata locally.
[0087] To achieve the above-mentioned purpose, an embodiment of the present application provides a blockchain processing device, which is applied to a second node, and the second node includes one or more storage media, including:
[0088] A third receiving module, configured to receive a first request sent by the first node;
[0089] A second processing module, configured to allocate a storage medium to the first block according to the first request, and send an access token corresponding to the allocated storage medium to the first node;
[0090] A fourth receiving module, configured to receive a second request sent by the first node, where the second request carries the access token and a block object to be stored in the first block;
[0091] The third sending module is used to store the block object in the allocated storage medium according to the second request and return a response message.
[0092] To achieve the above-mentioned purpose, an embodiment of the present application provides a blockchain processing device, which is applied to a third node, including:
[0093] A fourth sending module is configured to send a write notification to the first node when a first condition is met; wherein the first condition includes at least one of the following:
[0094] The blockchain or blockchain channel is created successfully;
[0095] The first node joins the blockchain or blockchain channel.
[0096] To achieve the above-mentioned objectives, an embodiment of the present application provides a blockchain processing device, comprising: a transceiver, a processor, a memory, and a program or instruction stored in the memory and executable on the processor; when the processor executes the program or instruction, the blockchain processing method as described above is implemented.
[0097] To achieve the above-mentioned purpose, an embodiment of the present application provides a readable storage medium on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps in the blockchain processing method as described above are implemented.
[0098] To achieve the above-mentioned purpose, an embodiment of the present application provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the blockchain processing method as described above.
[0099] The beneficial effects of the above technical solution of the present application are as follows:
[0100] The blockchain processing method of the embodiment of the present application, upon receiving the write notification of the first block, sends a first request to the second node, so that the second node allocates the storage medium to the first block, and feeds back the access token corresponding to the allocated storage medium to the first node; sends the access token and the block object to be stored of the first block to the second node through the first node, so that the second node stores the block object to be stored; the first node obtains and stores the block body metadata of the first block according to the response message returned by the second node. The blockchain processing method of the embodiment of the present application, by storing the block header and the block body separately, and saving the block body data of multiple blocks of at least one node in the same storage node, reduces the overall storage overhead and node storage overhead of the blockchain system, and breaks through the bottleneck that limits the entire system ledger, transaction scale and blockchain node storage capacity. BRIEF DESCRIPTION OF THE DRAWINGS
[0101] Figure 1 This is a schematic diagram of the accounting principle of blockchain in the prior art;
[0102] Figure 2 This is a schematic diagram of the ledger data structure of a service node in the prior art;
[0103] Figure 3 A schematic diagram of a ledger storage method of a blockchain system according to an embodiment of the present application;
[0104] Figure 4 A schematic diagram of functional components of a storage management submodule of a second node in an embodiment of the present application;
[0105] Figure 5 This is one of the flowcharts of the blockchain processing method according to an embodiment of the present application;
[0106] Figure 6 A schematic diagram of the ledger data structure of a service node in an embodiment of the present application;
[0107] Figure 7 A schematic diagram of a process of storing the first block into the second node according to an embodiment of the present application;
[0108] Figure 8 A schematic diagram of a process of reading a block object from the second node by the first block in an embodiment of the present application;
[0109] Fig. 9 This is the second flowchart of the blockchain processing method according to the embodiment of the present application;
[0110] Fig.10 This is the third flowchart of the blockchain processing method of the embodiment of the present application;
[0111] Fig.11 This is one of the module structure diagrams of the blockchain processing device according to an embodiment of the present application;
[0112] Fig.12 This is the second schematic diagram of the module structure of the blockchain processing device according to the embodiment of the present application;
[0113] Fig.13 This is the third schematic diagram of the module structure of the blockchain processing device according to the embodiment of the present application;
[0114] Fig.14 This is a schematic diagram of the structure of the blockchain processing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0115] In order to make the technical problems, technical solutions and advantages to be solved by the present application clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0116] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0117] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0118] Additionally, the terms "system" and "network" are often used interchangeably herein.
[0119] In the embodiments provided in the present application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0120] For ease of understanding, some contents involved in the embodiments of the present application are described below:
[0121] In the prior art, such as Figure 1As shown: In traditional centralized accounting systems (including databases, file systems, etc.), one node / one program is usually responsible for accessing specific data to ensure data consistency and transaction atomicity; even in distributed processing systems (such as distributed databases, distributed file systems, etc.), multiple nodes may work in a master-slave and load-sharing mode to jointly process a set of data, but for the processing of a specific data, a clear data operation node will be established through an algorithm; therefore, the traditional data processing method works in a centralized accounting method. For the distributed accounting method represented by blockchain, blockchain nodes representing different organizations and different role interests maintain their own ledgers, read and write their own ledger data independently, and rely on specified accounting rules (consensus mechanism) and algorithms to maintain the final consistency of distributed ledger data on each node. Obviously, due to the inherent distrust of ledger data of nodes that do not belong to them, each node needs to use its own rules and methods to verify each transaction contained in each block, and then record the account data that it believes to be legal and reasonable in its own ledger based on its own verification results;
[0122] The ledger of each node (that is, the locally stored blocks are connected to form a chain according to the generation time and block sequence number, where: the block is real and the chain is logical), the typical data structure is as follows Figure 2 As shown:
[0123] As the basic structural unit of blockchain, blocks consist of two parts: a block header containing basic information and a block body containing transaction data. Taking Bitcoin as an example, the following parts are used:
[0124] (1) Block header, which is used to: connect to the previous block, index the data from the parent block hash value; describe the timestamp and Nonce (random number, recording the answer to the mathematical puzzle related to decrypting the block, used to prove the legitimacy of the block); can summarize and quickly summarize the Merkle root data of all transaction data in the block, and other data, such as version number; the size of the block header is fixed, for example, the size of the public chain Bitcoin block body is 80 bytes, and the size of the consortium chain Fabric block header is 72 bytes when it is not serialized;
[0125] (2) Block body: used to store overhead. The transaction information recorded in the block body is the task data carried by the block, including the private keys of the two parties to the transaction, the amount of the transaction, the digital signature of the electronic currency, etc. The block body size is usually fixed. For example, at the beginning of its creation, the size of the classic Bitcoin block body was 1M bytes, and the default block body size of the alliance chain Fabric is 2MB. This size can be changed by system forks or forced upgrades.
[0126] The blockchain processing method of the embodiment of the present application needs to be implemented by combining software and hardware, specifically:
[0127] If the service provider nodes (physical computers or virtual machines or containers) of the entire blockchain system are located in multiple cloud data centers, but there are internal direct links between these data centers; all service provider nodes, whether they are physically located in the same data center or not, can be connected through networking technologies (such as virtual private networks (VPN), virtual local area networks (VLAN / VxLAN), dedicated lines, the Internet, etc.), and the communication latency can meet the basic requirements of business access;
[0128] The storage medium of the second node can be composed of various heterogeneous methods such as bare disks, disk arrays, storage area networks (SAN), network attached storage (NAS), block storage, file storage, object storage, etc., and can provide a unified access interface to the outside world after adaptation, can be linearly expanded, can be deployed in multiple centers and remote locations, and can be stored in multiple copies; the content stored in the storage medium can be backed up and restored through the storage management submodule to improve the high availability of the entire storage module.
[0129] For alliance chain scenarios, all modules, nodes, and software services can obtain identification and a pair of public and private keys for node identity verification, access authorization, session key negotiation, content encryption and other functions.
[0130] This application proposes to optimize the ledger storage method of the blockchain system. The specific modules and connection methods are as follows: Figure 3 As shown,
[0131] This application adds a storage module to the blockchain, which includes two new components: a storage management submodule SM and a storage medium MS. For the storage module S, according to the requirements of the security rules, it can be set up separately for a specific chain / channel, or the same set of storage modules S can be set up for multiple chains and multiple channels; at the same time, a chain management module M is added (for the alliance chain, the function can be extended in the Blockchain as a Service (BaaS) platform; for the public chain, it can be an extension of the management console function of a mining pool); and the block reading module of the blockchain node P is interfaced and the corresponding storage access function is added.
[0132] In the embodiment of the present application, in the scenario of alliance chain:
[0133] (1) The storage module S includes two types of components: storage medium and storage management submodule;
[0134] A. Storage media: a group of raw disks, disk arrays, SAN / NAS, block storage, file storage, object storage and other forms, a linearly scalable storage media cluster composed of homogeneous or heterogeneous technologies; after functional adaptation, a unified data access interface is provided to the outside world; based on the characteristics of block storage, under the control of the storage management submodule, the storage media can work in a "Write Once then Read Only" mode.
[0135] B. Storage management submodule: responsible for the management of storage medium MS and adapting the block access interface between storage medium and blockchain node;
[0136] (2) Chain management module (optional): only for alliance chain scenarios, used to configure and manage chain, channel, user and other data, centrally schedule computing, network, storage and other resources, and uniformly monitor and operate the entire chain service.
[0137] Specifically, in the scenario of the alliance chain, the functional components of the storage management submodule SM of the second node are arranged as follows: Figure 4 As shown, including:
[0138] Block access interface: responsible for interacting with blockchain nodes, providing blockchain nodes with specific media addresses, access entries, and access credentials for reading and writing content in a stateless interface manner;
[0139] Access Control File (ACF): Based on the set security policy, it performs access control, access log recording, access abnormal behavior analysis and blocking on requests to access the block access interface;
[0140] Block storage metadata database: responsible for maintaining the mapping relationship between "chain identification, channel identification, block information (including key contents such as block depth, block body hash value), the location of the block body ID (logical address) on the storage medium and the block read address (physical address)";
[0141] Cache function: used to cache block objects saved on the storage medium to avoid the need to access the storage medium to read each block, thereby improving access efficiency and reducing latency. It should be noted that this function module is an optional function.
[0142] Sharding function: according to the characteristics of the storage medium, the block to be stored is divided into several shards according to the specified rules, so as to write and read in parallel, improve storage efficiency, and more effectively exert the utilization and efficiency of the storage module S; it should be noted that this function module is an optional function;
[0143] Duplicate check function: responsible for checking whether the block body of the specified "chain ID, channel ID, block depth (ID)" has been saved on the storage medium MS. The duplicate check method can be based on a whole block or each storage shard of the block as the minimum granularity of duplicate check; the duplicate check method includes but is not limited to: the hash value and checksum of the corresponding content; through the duplicate check function, only an application-layer accessible storage object for a specific block will be saved in the storage medium (the storage medium's own multi-copy high-availability mechanism is still applicable at the storage bottom layer, but these copies cannot be read and written as different copies at the application layer);
[0144] Backup / restore function: Based on the block storage metadata information, read the block body data located on the storage medium, combine it with the block header data obtained from the block storage metadata, and output it as block backup data in a specified format; or import data from block backup data in a specified format into the block storage metadata and storage medium. In addition to disaster recovery, this function can also be used for blockchain cross-deployment location and cross-cloud migration; it should be noted that this function module is an optional function;
[0145] Media management and adaptation function: used to manage various media that provide storage services, including media addressing information, media online and service status, media capacity management, media access interface adaptation, etc.
[0146] like Figure 5 As shown, a blockchain processing method according to an embodiment of the present application is executed by a first node and includes the following steps:
[0147] Step 501, upon receiving a write notification of a first block, sending a first request to a second node; wherein the second node includes one or more storage media, and the first request is used to apply for storage medium allocation;
[0148] Step 502, receiving an access token sent by the second node in response to the first request;
[0149] Step 503: Send a second request to the second node, where the second request carries the access token and the block object to be stored in the first block, and the second request is used to apply to store the block object in the allocated storage medium;
[0150] Step 504: receiving a response message returned by the second node in response to the second request;
[0151] Step 505: Obtain block body metadata of the first block according to the response message, and store the block body metadata locally.
[0152] In this way, the method of the embodiment of the present application, by storing the block header and the block body separately, only saving the block header and the simplified block object in the node, and saving the block body data of multiple blocks of at least one node in the same additional, public storage node (second node), reduces the overall storage overhead and node storage overhead of the blockchain system, and breaks through the bottleneck that limits the entire system ledger, transaction scale and blockchain node storage capacity.
[0153] It should be noted that the first node is a service node P in the blockchain; the second node is a storage node provided with a storage module S, or the second node is the storage module S; the third node is a chain management node M, or the third node is the chain management module.
[0154] Optionally, the first block includes one or more blocks.
[0155] Optionally, the method further comprises:
[0156] After receiving the write notification of the first block, verifying the first block;
[0157] Packing the block body of the first block to obtain the block object in a preset format;
[0158] The block object is encrypted.
[0159] Optionally, the first request carries:
[0160] The chain identifier of the block;
[0161] The channel identifier of the block;
[0162] Block height;
[0163] Block body hash value.
[0164] As an optional implementation, in an embodiment of the present application, the first request carries:
[0165] The block's chain ID, block's channel ID, block height, block body hash value, and block body size.
[0166] As a feasible embodiment of the present application, the first request carries the block size.
[0167] It should be noted that the block body metadata includes a simplified block object.
[0168] Optionally, the block body metadata includes:
[0169] A hash value of the block object;
[0170] A list of access addresses of the block object.
[0171] Optionally, the block body metadata further includes:
[0172] The encryption and decryption key identifier of the block object;
[0173] The encryption and decryption algorithm identifier of the block object.
[0174] As a feasible embodiment of the present application, the block body metadata further includes the block body size.
[0175] Optionally, after receiving the first request, the second node queries through a block storage metadata database whether the block object of the first block has been stored in the storage medium;
[0176] If the block object has been stored in the storage medium and the storage status is valid, returning an access address list including the storage location of the block object to the first node;
[0177] If the block object is not stored in the storage medium, a storage medium list is allocated and an access token is returned.
[0178] Optionally, querying whether the storage medium has stored the block object of the first block through the block storage metadata database may be understood as:
[0179] By comparing the block body metadata with the data queried in the storage medium, if they match, it is determined that the block object has been stored in the storage medium.
[0180] Specifically, receiving a response message returned by the second node in response to the second request can be understood as:
[0181] After completing the storage of the block object, the second node feeds back a response message to the first node, where the response message carries the access address list of the block object.
[0182] Obtaining the block body metadata of the first block according to the response message, and storing the block body metadata locally, can be understood as:
[0183] The first node generates the block volume metadata according to the access address list, and stores the block volume metadata of the first block in a disk for local storage.
[0184] In the embodiment of the present application, the block body metadata includes:
[0185] The hash value of the block object and the access address list of the block object.
[0186] Optionally, the simplified block body-block body metadata includes at least the fields shown in Table 1:
[0187] Table 1
[0188]
[0189]
[0190] In the blockchain processing method of the embodiment of the present application, the block organization structure and storage method are adjusted:
[0191] like Figure 6 As shown, the block body is simplified to obtain the block body metadata, and only the necessary block body metadata (such as: block body size, block body hash value, block body storage access bit address list, (optional) encryption and decryption password, etc.) are stored on the local blockchain node, and the block body content (block object) will be stored in the storage medium MS of the independent storage module S;
[0192] At the same time, the access function of the blockchain data storage module blocks has been adjusted:
[0193] The specific enhancement is achieved by reloading the block data writing and reading interface of the original system: when the new block is verified and needs to be written, the block body metadata construction function and the function of packaging the block body based on the specified format as a storage object (including the optional encryption process) are added according to the specified requirements, and the storage access interface is called to write the block body to the storage medium MS of the specified storage module S to the storage module, and the block body metadata is improved according to the returned result (access address list) and then stored in the simplified block body block body metadata. When it is necessary to access the specified block, the blockchain node P first obtains the corresponding block N from the local storage, and then obtains the block body metadata from the simplified block body, obtains the block object storage access address list, the hash value of the block body file, (decryption password, optional), and then calls the storage medium MS of the storage module S through the interface to obtain the block object (decryption password, optional), and verifies it through the locally stored block body metadata (size, hash value, etc.) to determine that the block body data stored in the storage module has not been tampered with.
[0194] As a feasible embodiment of the present application, the block body metadata includes:
[0195] The size of the block object, the hash value of the block object, and the access address list of the block object.
[0196] As a feasible embodiment of the present application, the block body metadata includes:
[0197] The hash value of the block object, the access address list of the block object, the encryption and decryption key identifier of the block object, and the encryption and decryption algorithm identifier of the block object.
[0198] As a feasible embodiment of the present application, the block body metadata includes:
[0199] The size of the block object, the hash value of the block object, the access address list of the block object, the encryption and decryption key identifier of the block object, and the encryption and decryption algorithm identifier of the block object.
[0200] It should be noted that, in the case where the block object of the first block needs to be encrypted, the block body metadata also needs to include: an encryption and decryption key identifier of the block object and an encryption and decryption algorithm identifier of the block object.
[0201] Optionally, the method further comprises:
[0202] Upon receiving the read notification of the first block, obtaining the locally stored block body metadata of the first block;
[0203] Sending a third request to the second node according to the block body metadata, where the third request is used to apply for reading the block object of the first block;
[0204] Receive the block object sent by the second node in response to the third request.
[0205] It should be noted that the first node accesses the storage module of the second node in two ways: proxy and redirection.
[0206] Optionally, the third request carries:
[0207] The chain identifier of the block;
[0208] The channel identifier of the block;
[0209] Block height;
[0210] Block hash value
[0211] A list of access addresses for blocks.
[0212] As a feasible embodiment of the present application, the third request also carries the block size.
[0213] Optionally, after receiving the third request, the second node queries whether the corresponding block object has been cached through a query cache function;
[0214] If the block object has been cached, sending the block object to the first node;
[0215] If the block object is not cached, the block object is read from a storage medium and sent to the first node.
[0216] Optionally, obtaining block body metadata of the first block stored locally can determine an access address list corresponding to the first block;
[0217] According to the access address list, the second node obtains the block object.
[0218] The blockchain processing method of the embodiment of the present application determines the access address list of the first block in the second node according to the block body metadata of the first block stored in the first node, thereby reading the block object of the first block in the second node.
[0219] Optionally, after receiving the block object sent by the second node in response to the third request, the method further includes:
[0220] The integrity of the block object is verified according to the block body metadata.
[0221] Optionally, verifying the integrity of the block object according to the block body metadata includes:
[0222] Verifying the integrity of the block object according to the block body metadata;
[0223] If the integrity verification is passed, the block object is adopted.
[0224] The blockchain processing method of the embodiment of the present application can ensure the integrity of the block object read by the first node by verifying the block object sent by the second node, thereby ensuring the availability and credibility of the entire blockchain system.
[0225] Optionally, obtaining block body metadata of the first block according to the response message includes:
[0226] If the first block is located on the migration target blockchain, the block body metadata of the first block is updated based on the access address list of the block object in the response message.
[0227] Optionally, updating the block body metadata of the first block based on the access address list of the block object in the response message includes:
[0228] After the block object of the first block is migrated, the access address list stored thereafter is updated to the block body metadata of the first block.
[0229] In the blockchain processing method of the embodiment of the present application, each service node in the blockchain only stores the block header and the simplified block body, and does not store block objects that occupy a large storage space. This reduces the amount of data migration during the node migration process, thereby reducing the workload and implementation cycle of the migration.
[0230] Optionally, before sending the first request to the second node, the method further includes:
[0231] receiving first configuration information sent by a third node, where the first configuration information includes information for indicating the second node and relevant information for applying for use of a storage medium;
[0232] The second node and the first request are determined according to the first configuration information.
[0233] Optionally, the first configuration information includes:
[0234] The ID of the second node and at least one of the following:
[0235] The chain identifier of the block;
[0236] The channel identifier of the block;
[0237] Block height;
[0238] Block body hash value.
[0239] As a feasible embodiment of the present application, the first configuration information also includes: block size.
[0240] In the present application embodiment, Figure 7 As shown, the process of storing the first block into the second node is:
[0241] After receiving the new block notification, the first node verifies the validity of the block structure, transaction items in the block body, etc. based on the blockchain consensus mechanism and rules;
[0242] The first node organizes the block structure and packages the block body into a specified storage object format, including necessary block body source encryption;
[0243] The first node sends the first request for applying for medium storage allocation to the second node;
[0244] After receiving the first request, the second node queries the block storage metadata database to determine whether the corresponding block object has been stored in the storage medium; specifically, if the block object has been stored in the storage medium and the storage status is valid, the response message is sent to the first node, and the access address list Body_AccessAddr of the block body storage location is carried in the response message; if the block object has not been stored in the storage medium, a storage medium list {MSx, x=1, 2, ...} and an access token are allocated, and the access token is sent to the first node;
[0245] The first node sends a second request carrying the access token and the block object to be stored of the first block to the second node;
[0246] The second node stores the block object to be stored in the storage medium of the second node according to the second request; specifically, after receiving the second request, the second node fragments the received block object into {BBi, i=1, 2, ...} according to the technical specifications of the storage medium (such as the size of the storage block); and then uploads the fragments BBj to the corresponding storage medium MSx fragment by fragment;
[0247] The storage medium stores the corresponding shards and performs corresponding backup according to the replica control policy of the storage medium itself; after the shard storage is completed, the read-write access control logic of the medium marks the corresponding storage area as "read-only access" mode (unless the system operator reinitializes the storage medium next time), so that the storage area corresponding to the block body cannot be modified, thereby achieving the effect of "write once, read only forever";
[0248] After the storage medium completes the storage, the storage medium feeds back the storage completion information to the storage management submodule;
[0249] The storage management submodule records and caches the block body information, and feeds back a response message to the first node, wherein the response message carries an access address list Body_AccessAddr of the block body storage location;
[0250] After receiving the response message, the first node fills the access address list Body_AccessAddr into the block body metadata to form complete block body metadata content, and stores the block header and block body metadata of the first block in the disk for local storage.
[0251] In the present application embodiment, Figure 8 As shown, the process of reading the block object from the second node is:
[0252] The first node receives a block verification request, i.e., needs to read a block object of a specific block from the second node through the first node;
[0253] The first node parses the block body metadata to obtain an access address Body_AccessAddr;
[0254] The first node accesses the storage management submodule stored in the second node with its own identity by sending the third request to the second node;
[0255] The storage management submodule queries whether the corresponding block object has been cached through a query function according to the third request; specifically, if the block object has been cached in the storage management submodule, the cached block object is returned to the first node; if the block object is not cached in the storage management submodule, a storage medium list {MSx, x=1, 2, ...} of the block body shards {BBi, i=1, 2, ...} is obtained, and shards BBj are read from the corresponding storage medium MSx shard by shard through the block storage metadata library;
[0256] The storage management submodule performs splicing verification on the read fragment BBj and caches the block object according to the cache rule;
[0257] The second node sends the block object to the first node;
[0258] After receiving the block object, the first node verifies the integrity of the block object according to the stored block body metadata, and adopts the block object if it passes the integrity verification.
[0259] Optionally, the read notification is triggered by blockchain migration.
[0260] Optionally, after the first node receives the read notification triggered by blockchain migration, the first node obtains the block body metadata of the first block stored locally;
[0261] Sending a third request to the second node according to the block body metadata, where the third request is used to apply for reading the block object of the first block;
[0262] Receive the block object sent by the second node in response to the third request.
[0263] Optionally, the write notification is triggered by blockchain migration;
[0264] After receiving the block object sent by the second node, the method further includes:
[0265] Determine the updated second node based on the blockchain migration goal;
[0266] The first request is sent to the updated second node.
[0267] Optionally, after receiving the write notification triggered by blockchain migration, the first node determines an updated second node according to a blockchain migration target;
[0268] Sending the first request to the updated second node, and receiving a target access token fed back by the updated second node;
[0269] sending the second request to the updated second node;
[0270] Receive a target response message returned by the updated second node;
[0271] Obtain block body metadata of the first block according to the target response message, and store the block body metadata locally.
[0272] In the embodiment of the present application, the blockchain data migration includes block migration and blockchain node migration, wherein:
[0273] (1) Block Migration:
[0274] Use the following command on the blockchain system to be migrated (e.g., system 1): Figure 8 The block data reading process shown, the backup / restore function traverses the block storage metadata library to locate the block storage information of a specific chain and channel;
[0275] Read each valid block object in order of block depth and save it as the corresponding backup file;
[0276] Then export the block storage metadata database;
[0277] Deploy the storage module on the blockchain system to be migrated (e.g., system 2), obtain the corresponding block objects from the backup file item by item according to the block storage metadata database backed up in system 1, write them into the storage medium MS using the aforementioned block body data storage process, and update the access address Body_AccessAddr of the block body in the specific chain and channel in the block storage metadata database based on the latest access path;
[0278] (2) Blockchain node migration:
[0279] The data backup and migration of the first node of the blockchain of each chain, channel, and organization. After the migration is completed, each node initiates a request to the storage management submodule SM to change the field of the access address list Body_AccessAddr of the corresponding block body metadata.
[0280] like Fig. 9 As shown, a blockchain processing method of an embodiment of the present application is executed by a second node, the second node includes one or more storage media, and the method includes the following steps:
[0281] Step 901, receiving a first request sent by a first node;
[0282] Step 902, allocating a storage medium for the first block according to the first request, and sending an access token corresponding to the allocated storage medium to the first node;
[0283] Step 903: Receive a second request sent by the first node, where the second request carries the access token and the block object to be stored in the first block;
[0284] Step 904: store the block object in the allocated storage medium according to the second request, and return a response message.
[0285] In the blockchain processing method of the embodiment of the present application, the first node only stores the block header and the simplified block body (block body metadata), and stores the block object corresponding to at least one block of the first node through an additional, public second node, which can reduce the overall storage overhead and node storage overhead of the blockchain system, and break through the bottleneck that limits the entire system ledger, transaction scale and blockchain node storage capacity.
[0286] Optionally, allocating a storage medium to the first block according to the first request includes:
[0287] Based on the information carried in the first request, query whether a storage medium has stored the block object of the first block;
[0288] When the query result indicates that the storage medium does not store the block object of the first block, the allocated storage medium and access token are determined.
[0289] Optionally, if the block object of the first block has been stored in the storage medium and the storage status is valid, the access address list of the block object is sent to the first node.
[0290] Optionally, storing the block object in a corresponding storage medium according to the second request and returning a response message includes:
[0291] Based on the properties of the storage medium, the block object is fragmented;
[0292] Based on the access token, upload each shard to the corresponding storage medium for storage;
[0293] Generating a response message including an access address list of the block object based on the storage location of each shard;
[0294] The response message is sent to the first node.
[0295] Optionally, after uploading each shard to a corresponding storage medium for storage based on the access token, the method further includes:
[0296] The block object is cached.
[0297] Optionally, the method further comprises:
[0298] receiving a third request sent by the first node, where the third request is used to apply for reading a block object of the first block;
[0299] The block object is sent according to the third request.
[0300] Optionally, sending the block object according to the third request includes:
[0301] querying whether to cache the block object based on the third request;
[0302] If the block object is cached, directly sending the block object;
[0303] If the block object is not cached, then based on the access address list of the block object, each fragment is read from the storage medium, and the fragments are spliced to obtain and send the block object.
[0304] Optionally, before receiving the first request sent by the first node, the method further includes:
[0305] receiving second configuration information sent by a third node;
[0306] The one or more storage media are set according to the second configuration information.
[0307] like Fig.10 As shown, a blockchain processing method in an embodiment of the present application is executed by a third node, comprising the following steps:
[0308] Step 1001: Send a write notification to a first node when a first condition is met; wherein the first condition includes at least one of the following:
[0309] The blockchain or blockchain channel is created successfully;
[0310] The first node joins the blockchain or blockchain channel.
[0311] It should be noted that after the blockchain or blockchain channel is successfully created, the third node sends a write notification to the first node when joining the blockchain or blockchain channel, so that the first node sends a first request for applying for storage medium allocation to the second node according to the write notification, so that the second node allocates storage medium to the block object of the first node according to the first request.
[0312] Optionally, the method further comprises:
[0313] When the first condition is met,
[0314] Sending first configuration information to the first node, the first configuration information including information for indicating the second node and relevant information for applying for use of a storage medium; and,
[0315] Second configuration information is sent to the second node, where the second configuration information is used to set one or more storage media included in the second node.
[0316] Optionally, the method further comprises:
[0317] A read notification is sent to the second node.
[0318] Optionally, the method further comprises:
[0319] In the event of blockchain migration, the write notification and the read notification are generated.
[0320] like Fig.11 As shown, a blockchain processing device 1100 according to an embodiment of the present application is applied to a first node, including:
[0321] A first sending module 1101 is configured to send a first request to a second node upon receiving a write notification of a first block; wherein the second node includes one or more storage media, and the first request is used to apply for storage medium allocation;
[0322] A first receiving module 1102, configured to receive an access token sent by the second node in response to the first request;
[0323] A second sending module 1103 is used to send a second request to the second node, where the second request carries the access token and the block object to be stored in the first block, and the second request is used to apply to store the block object in the allocated storage medium;
[0324] A second receiving module 1104 is configured to receive a response message returned by the second node in response to the second request;
[0325] The first processing module 1105 is configured to obtain block body metadata of the first block according to the response message, and store the block body metadata locally.
[0326] The blockchain processing device of the embodiment of the present application stores the block header and the block body separately, only saves the block header and the simplified block object in the node, and saves the block body data of multiple blocks of at least one node in the same additional, public storage node, thereby reducing the overall storage overhead and node storage overhead of the blockchain system, and breaking through the bottleneck that limits the entire system ledger, transaction scale and blockchain node storage capacity.
[0327] Optionally, the blockchain processing device further includes:
[0328] A first acquisition module, configured to acquire locally stored block body metadata of the first block upon receiving a read notification of the first block;
[0329] a fifth sending module, configured to send a third request to the second node according to the block body metadata, wherein the third request is used to apply for reading the block object of the first block;
[0330] A fifth receiving module is used to receive the block object sent by the second node in response to the third request.
[0331] Optionally, the blockchain processing device further includes:
[0332] A verification module is used to verify the integrity of the block object according to the block body metadata.
[0333] Optionally, the first processing module is further used to:
[0334] If the first block is located on the migration target blockchain, the block body metadata of the first block is updated based on the access address list of the block object in the response message.
[0335] Optionally, the read notification is triggered by blockchain migration; the write notification is triggered by blockchain migration; the blockchain processing device further includes:
[0336] An update module, used to determine the updated second node according to the blockchain migration target;
[0337] A sixth sending module is used to send the first request to the updated second node.
[0338] like Fig.12 As shown, a blockchain processing device 1200 of an embodiment of the present application is applied to a second node, and the second node includes one or more storage media, including:
[0339] The third receiving module 1201 is used to receive a first request sent by the first node;
[0340] A second processing module 1202 is configured to allocate a storage medium to the first block according to the first request, and send an access token corresponding to the allocated storage medium to the first node;
[0341] A fourth receiving module 1203 is configured to receive a second request sent by the first node, where the second request carries the access token and a block object to be stored in the first block;
[0342] The third sending module 1204 is used to store the block object in the allocated storage medium according to the second request and return a response message.
[0343] In the blockchain processing device of the embodiment of the present application, the first node only stores the block header and the simplified block body (block body metadata), and stores the block object corresponding to at least one block of the first node through an additional, public second node, which can reduce the overall storage overhead and node storage overhead of the blockchain system, and break through the bottleneck that limits the entire system ledger, transaction scale and blockchain node storage capacity.
[0344] Optionally, the second processing module is further used to:
[0345] Based on the information carried in the first request, query whether a storage medium has stored the block object of the first block;
[0346] When the query result indicates that the storage medium does not store the block object of the first block, the allocated storage medium and access token are determined.
[0347] Optionally, the third sending module is further used for:
[0348] Based on the properties of the storage medium, the block object is fragmented;
[0349] Based on the access token, upload each shard to the corresponding storage medium for storage;
[0350] Generating a response message including an access address list of the block object based on the storage location of each shard;
[0351] Sending the response message to the first node;
[0352] The block object is cached.
[0353] Optionally, the blockchain processing device further includes:
[0354] a sixth receiving module, configured to receive a third request sent by the first node, wherein the third request is used to apply for reading a block object of the first block;
[0355] A seventh sending module is used to send the block object according to the third request.
[0356] Optionally, the seventh sending module is further used for:
[0357] querying whether to cache the block object based on the third request;
[0358] If the block object is cached, directly sending the block object;
[0359] If the block object is not cached, then based on the access address list of the block object, each fragment is read from the storage medium, and the fragments are spliced to obtain and send the block object.
[0360] Optionally, the blockchain processing device further includes:
[0361] A seventh receiving module, configured to receive second configuration information sent by a third node;
[0362] A third processing module is used to set the one or more storage media according to the second configuration information.
[0363] like Fig.13 As shown, a blockchain processing device 1300 according to an embodiment of the present application is applied to a third node, including:
[0364] The fourth sending module 1301 is configured to send a write notification to the first node when a first condition is met; wherein the first condition includes at least one of the following:
[0365] The blockchain or blockchain channel is created successfully;
[0366] The first node joins the blockchain or blockchain channel.
[0367] Optionally, the blockchain processing device further includes an eighth sending module, configured to:
[0368] When the first condition is met,
[0369] Sending first configuration information to the first node, the first configuration information including information for indicating the second node and relevant information for applying for use of a storage medium; and,
[0370] Second configuration information is sent to the second node, where the second configuration information is used to set one or more storage media included in the second node.
[0371] Optionally, the blockchain processing device further includes:
[0372] A ninth sending module is used to send a read notification to the second node.
[0373] Optionally, the blockchain processing device further includes: a generation module;
[0374] Used to generate the write notification and the read notification when blockchain migration occurs.
[0375] The first node of the embodiment of the present application includes a processor and a transceiver, wherein:
[0376] The transceiver is used to send a first request to a second node when receiving a write notification of the first block; wherein the second node includes one or more storage media, and the first request is used to apply for storage medium allocation;
[0377] receiving an access token sent by the second node in response to the first request;
[0378] Sending a second request to the second node, the second request carrying the access token and the block object to be stored in the first block, the second request being used to apply to store the block object in the allocated storage medium;
[0379] receiving a response message returned by the second node in response to the second request;
[0380] The processor is configured to obtain block body metadata of the first block according to the response message, and store the block body metadata locally.
[0381] Optionally, the processor is further configured to, upon receiving a read notification of the first block, obtain locally stored block body metadata of the first block;
[0382] The transceiver is further used to send a third request to the second node according to the block body metadata, wherein the third request is used to apply for reading the block object of the first block;
[0383] Receive the block object sent by the second node in response to the third request.
[0384] Optionally, the processor is further configured to verify the integrity of the block object according to the block body metadata.
[0385] Optionally, the processor is further used to update the block body metadata of the first block based on the access address list of the block object in the response message if the first block is located on the migration target blockchain.
[0386] Optionally, the transceiver is further used to receive first configuration information sent by a third node, where the first configuration information includes information used to indicate the second node and relevant information for applying for use of a storage medium;
[0387] The processor is further configured to determine the second node and the first request according to the first configuration information.
[0388] Optionally, the read notification is triggered by blockchain migration; the write notification is triggered by blockchain migration;
[0389] The processor is further configured to determine an updated second node according to a blockchain migration target;
[0390] The transceiver is further configured to send the first request to the updated second node. The second node of the embodiment of the present application includes a processor and a transceiver, wherein:
[0391] The transceiver is used to receive a first request sent by a first node;
[0392] allocating a storage medium for the first block according to the first request, and sending an access token corresponding to the allocated storage medium to the first node;
[0393] receiving a second request sent by the first node, where the second request carries the access token and a block object to be stored in the first block;
[0394] The transceiver is used to store the block object in the allocated storage medium according to the second request and return a response message.
[0395] Optionally, the processor is further configured to query, based on the information carried in the first request, whether a storage medium has stored the block object of the first block;
[0396] If the query result indicates that the storage medium does not store the block object of the first block, determine the allocated storage medium and access token. Optionally, the processor is further configured to shard the block object based on the properties of the storage medium;
[0397] Based on the access token, upload each shard to the corresponding storage medium for storage;
[0398] Generating a response message including an access address list of the block object based on the storage location of each shard;
[0399] The transceiver is further configured to send the response message to the first node.
[0400] Optionally, the transceiver is further used to receive a third request sent by the first node, where the third request is used to apply to read a block object of the first block;
[0401] The block object is sent according to the third request.
[0402] Optionally, the processor is further configured to query whether to cache the block object based on the third request;
[0403] If the block object is cached, directly sending the block object;
[0404] If the block object is not cached, then based on the access address list of the block object, each fragment is read from the storage medium, and the fragments are spliced to obtain and send the block object.
[0405] Optionally, the transceiver is further used to receive second configuration information sent by a third node;
[0406] The processor is further configured to set the one or more storage media according to the second configuration information.
[0407] The third node in the embodiment of the present application includes a transceiver, wherein:
[0408] The transceiver is configured to send a write notification to the first node when a first condition is met; wherein the first condition includes at least one of the following:
[0409] The blockchain or blockchain channel is created successfully;
[0410] The first node joins the blockchain or blockchain channel.
[0411] Optionally, the transceiver is further configured to, when the first condition is met,
[0412] Sending first configuration information to the first node, the first configuration information including information for indicating the second node and relevant information for applying for use of a storage medium; and,
[0413] Second configuration information is sent to the second node, where the second configuration information is used to set one or more storage media included in the second node.
[0414] Optionally, the transceiver is further configured to send a read notification to the second node.
[0415] Optionally, the third node also includes a processor, which is further used to generate the write notification and the read notification when blockchain migration occurs.
[0416] A blockchain processing device according to an embodiment of the present application, such as Fig.14As shown, it includes a transceiver 1410, a processor 1400, a memory 1420, and a program or instruction stored in the memory 1420 and executable on the processor 1400; when the processor 1400 executes the program or instruction, the above-mentioned method for blockchain processing is implemented.
[0417] The transceiver 1410 is used to receive and send data under the control of the processor 1400 .
[0418] Among them, Fig.14 14, the bus architecture may include any number of interconnected buses and bridges, specifically linking together various circuits of one or more processors represented by processor 1400 and memory represented by memory 1420. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 1410 may be a plurality of components, namely, a transmitter and a receiver, providing a unit for communicating with various other devices over a transmission medium.
[0419] The processor 1400 is responsible for managing the bus architecture and general processing, and the memory 1420 can store data used by the processor 1400 when performing operations.
[0420] A readable storage medium in an embodiment of the present application stores a program or instruction thereon. When the program or instruction is executed by a processor, the steps in the blockchain processing method as described above are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0421] The processor is the processor in the blockchain processing device described in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0422] The embodiment of the present application also provides a computer program product, including computer instructions. When the computer instructions are executed by a processor, the various processes of the above-mentioned blockchain processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.
[0423] It should be further explained that the terminals described in this specification include but are not limited to smart phones, tablet computers, etc., and many of the functional components described are called modules in order to more particularly emphasize the independence of their implementation methods.
[0424] The above exemplary embodiments are described with reference to the accompanying drawings, and many different forms and embodiments are feasible without departing from the spirit and teachings of the present application. Therefore, the present application should not be constructed as a limitation of the exemplary embodiments proposed herein. More specifically, these exemplary embodiments are provided so that the present application will be perfect and complete, and the scope of the present application will be conveyed to those who are familiar with the technology. In these figures, the component sizes and relative sizes may be exaggerated for clarity. The terms used here are only based on the purpose of describing specific exemplary embodiments and are not intended to be limiting. As used herein, unless the text clearly indicates otherwise, the singular forms "one", "an" and "the" are intended to include these multiple forms. It will be further understood that the terms "comprising" and / or "including" when used in this specification indicate the presence of the features, integers, steps, operations, components and / or components, but do not exclude the presence or increase of one or more other features, integers, steps, operations, components, components and / or their groups. Unless otherwise indicated, when stated, a range of values includes the upper and lower limits of that range and any subranges therebetween.
[0425] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A blockchain processing method, characterized in that: Executed by the first node, including: When receiving a write notification of the first block, sending a first request to a second node; wherein the second node includes one or more storage media, and the first request is used to apply for storage medium allocation; receiving an access token sent by the second node in response to the first request; Sending a second request to the second node, the second request carrying the access token and the block object to be stored in the first block, the second request being used to apply to store the block object in the allocated storage medium; receiving a response message returned by the second node in response to the second request; Obtain block body metadata of the first block according to the response message, and store the block body metadata locally.
2. The method according to claim 1, characterized in that The block body metadata includes: A hash value of the block object; A list of access addresses of the block object.
3. The method according to claim 1, characterized in that The block metadata also includes: The encryption and decryption key identifier of the block object; The encryption and decryption algorithm identifier of the block object.
4. The method according to claim 1, characterized in that: Also includes: Upon receiving the read notification of the first block, obtaining the locally stored block body metadata of the first block; Sending a third request to the second node according to the block body metadata, where the third request is used to apply for reading the block object of the first block; Receive the block object sent by the second node in response to the third request.
5. The method according to claim 4, characterized in that After receiving the block object sent by the second node in response to the third request, the method further includes: The integrity of the block object is verified according to the block body metadata.
6. The method according to claim 1, characterized in that The obtaining the block body metadata of the first block according to the response message includes: If the first block is located on the migration target blockchain, the block body metadata of the first block is updated based on the access address list of the block object in the response message.
7. The method according to claim 1, characterized in that Before sending the first request to the second node, the method further includes: receiving first configuration information sent by a third node, where the first configuration information includes information for indicating the second node and relevant information for applying for use of a storage medium; The second node and the first request are determined according to the first configuration information.
8. The method according to claim 4, characterized in that The read notification is triggered by a blockchain migration.
9. The method according to claim 4 or 8, characterized in that: The write notification is triggered by blockchain migration; After receiving the block object sent by the second node, the method further includes: Determine the updated second node based on the blockchain migration goal; The first request is sent to the updated second node.
10. The method according to claim 1, characterized in that The first request carries: The chain identifier of the block; The channel identifier of the block; Block height; Block body hash value.
11. The method according to claim 4, characterized in that The third request carries: The chain identifier of the block; The channel identifier of the block; Block height; Block hash value A list of access addresses for blocks.
12. A blockchain processing method, characterized in that: Executed by a second node, the second node comprising one or more storage media, the method comprising: receiving a first request sent by a first node; allocating a storage medium for the first block according to the first request, and sending an access token corresponding to the allocated storage medium to the first node; receiving a second request sent by the first node, where the second request carries the access token and a block object to be stored in the first block; According to the second request, the block object is stored in the allocated storage medium, and a response message is returned.
13. The method according to claim 12, characterized in that The allocating a storage medium to the first block according to the first request includes: Based on the information carried in the first request, query whether a storage medium has stored the block object of the first block; When the query result indicates that the storage medium does not store the block object of the first block, the allocated storage medium and access token are determined.
14. The method according to claim 12, characterized in that The step of storing the block object in a corresponding storage medium according to the second request and returning a response message includes: Based on the properties of the storage medium, the block object is fragmented; Based on the access token, upload each shard to the corresponding storage medium for storage; Generating a response message including an access address list of the block object based on the storage location of each shard; The response message is sent to the first node.
15. The method according to claim 14, characterized in that After uploading each shard to a corresponding storage medium for storage based on the access token, the method further includes: The block object is cached.
16. The method according to claim 12, characterized in that Also includes: receiving a third request sent by the first node, where the third request is used to apply for reading a block object of the first block; The block object is sent according to the third request.
17. The method according to claim 16, characterized in that The sending the block object according to the third request includes: querying whether to cache the block object based on the third request; If the block object is cached, directly sending the block object; If the block object is not cached, then based on the access address list of the block object, each fragment is read from the storage medium, and the fragments are spliced to obtain and send the block object.
18. The method according to claim 12, characterized in that Before receiving the first request sent by the first node, the method further includes: receiving second configuration information sent by a third node; The one or more storage media are set according to the second configuration information.
19. A blockchain processing method, characterized in that: Executed by the third node, including: When a first condition is met, a write notification is sent to the first node; wherein the first condition includes at least one of the following: The blockchain or blockchain channel is created successfully; The first node joins the blockchain or blockchain channel.
20. The method according to claim 19, characterized in that Also includes: When the first condition is met, Sending first configuration information to the first node, where the first configuration information includes information for indicating the second node and relevant information for applying for use of a storage medium; as well as, Second configuration information is sent to the second node, where the second configuration information is used to set one or more storage media included in the second node.
21. The method according to claim 19, characterized in that Also includes: A read notification is sent to the second node.
22. The method according to claim 21, characterized in that Also includes: In the event of blockchain migration, the write notification and the read notification are generated.
23. A blockchain processing device, characterized in that: Applied to the first node, including: A first sending module, configured to send a first request to a second node when receiving a write notification of a first block; wherein the second node includes one or more storage media, and the first request is used to apply for storage medium allocation; A first receiving module, configured to receive an access token sent by the second node in response to the first request; A second sending module, configured to send a second request to the second node, wherein the second request carries the access token and the block object to be stored in the first block, and the second request is used to apply to store the block object in the allocated storage medium; A second receiving module, configured to receive a response message returned by the second node in response to the second request; The first processing module is configured to obtain block body metadata of the first block according to the response message, and store the block body metadata locally.
24. A blockchain processing device, characterized in that: Applied to a second node, the second node includes one or more storage media, including: A third receiving module, configured to receive a first request sent by the first node; A second processing module, configured to allocate a storage medium to the first block according to the first request, and send an access token corresponding to the allocated storage medium to the first node; A fourth receiving module, configured to receive a second request sent by the first node, where the second request carries the access token and a block object to be stored in the first block; The third sending module is used to store the block object in the allocated storage medium according to the second request and return a response message.
25. A blockchain processing device, characterized in that: Applied to the third node, including: A fourth sending module is configured to send a write notification to the first node when a first condition is met; wherein the first condition includes at least one of the following: The blockchain or blockchain channel is created successfully; The first node joins the blockchain or blockchain channel.
26. A blockchain processing device, comprising: A transceiver, a processor, a memory, and a program or instruction stored in the memory and executable on the processor; characterized in that when the processor executes the program or instruction, the blockchain processing method as described in any one of claims 1 to 11 is implemented, or the blockchain processing method as described in any one of claims 12 to 18, or the blockchain processing method as described in any one of claims 19 to 22 is implemented.
27. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by the processor, it implements the blockchain processing method as described in any one of claims 1 to 14, or the blockchain processing method as described in any one of claims 12 to 18, or the steps in the blockchain processing method as described in any one of claims 19 to 22.
28. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the blockchain processing method according to any one of claims 1 to 11, or the blockchain processing method according to any one of claims 12 to 18, or the steps of the blockchain processing method according to any one of claims 19 to 22.
Citation Information
Patent Citations
Block chain processing method and device and block chain node
CN108810119A
Block data storage method and device
CN110457398A
Information processing method and device based on block chain, storage medium and equipment
CN110598477A
Identity authentication method and system
CN111327568A
Block storage method and device based on blockchain, node equipment and storage medium
CN112035475A
