Server-free block chain consensus optimization system
By introducing serverless technology in the blockchain system, decoupling consensus algorithms and request management, and adopting efficient network protocols and dynamic resource adjustments, the problems of insufficient scalability of traditional architectures and excessive resource consumption are solved, and processing speed and throughput are improved enhances system performance and response speed.
Patent Information
- Application Number
- CN202411136516.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-08-19
AI Technical Summary
In traditional blockchain architecture, consensus algorithms and request management are highly coupled, which makes it difficult for the system to expand capacity when facing high concurrent requests, limiting the ability to handle large-scale requests, and unbalanced use of network bandwidth and rigid resource allocation hinder performance improvement.
Adopt a serverless blockchain consensus optimization system, and through API module, request pool module, shared request pool module and decoupled consensus module, the consensus algorithm and request management are decoupled, efficient network protocol and point-to-point transmission are adopted, and dynamic adjustment is made. Number of resources and instances, optimize network communication and resource usage.
It significantly improves the processing speed and throughput of blockchain systems, improves scalability and response speed, reduces the consumption of network bandwidth and computing resources, and adapts to different business scenarios and network conditions.
Smart Images

Figure CN119094521A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a blockchain consensus optimization system, and particularly to a serverless blockchain consensus optimization system. Background Art
[0002] In the evolution of blockchain technology, especially for the application scenarios of alliance chains, system performance, especially the processing efficiency and scalability of the consensus stage, have become key factors restricting the scale of applications. In traditional architectures, the consensus algorithm is highly coupled with request management, which makes it difficult for the system to effectively expand when facing high concurrent requests, limiting its ability to handle large-scale requests. In addition, the uneven use of network bandwidth and the rigidity of resource allocation are also important problems that hinder the performance improvement of alliance chains. Summary of the invention
[0003] In order to solve the problems existing in the background technology, the present invention provides a server-less blockchain consensus optimization system.
[0004] The technical solution adopted by the present invention is:
[0005] The server-free blockchain consensus optimization system of the present invention includes:
[0006] The application programming interface (API) module is used to receive requests sent by several users.
[0007] The local request pool module is used to receive requests from various users in the application programming interface API module and pack a preset first number of requests into a batch to obtain a plurality of batches.
[0008] The hierarchical shared request pool module is used to receive batches packaged by the local request pool module and share them with the shared request pool module in the blockchain consensus optimization system of another consensus node. The shared request pool module includes a master instance and several working instances. The master instance and each working instance share batches. Each working instance independently manages its own batch. The master instances in every two shared request pool modules share the metadata of the batches transmitted. Each working instance in every two shared request pool modules shares the content of the batches through a serverless platform in a peer-to-peer P2P manner. The shared request pool module supports dynamic expansion and contraction. The shared request pool module uses an efficient network protocol to distribute batches, optimizes network communication strategies, reduces network bandwidth consumption and node computing pressure, reduces the time and resource consumption of network message transmission, and allows dynamic adjustment of resources according to actual needs. Each working instance can independently manage request batches to adapt to different business scenarios and network conditions.
[0009] The decoupled consensus module is used to determine the serial ID of each batch in the shared request pool module and perform consensus optimization with the consensus modules in the blockchain consensus optimization system of other consensus nodes, and finally unify the serial ID of the batches in each consensus node. The consensus module processes the request batch ID instead of the complete batch content to reduce the amount of data processing and network communication, significantly reducing the processing load of the consensus algorithm and improving the processing speed and throughput of the blockchain consensus optimization system.
[0010] The system achieves a high degree of decoupling between consensus algorithms and request management, improving the scalability and processing efficiency of the system in alliance chain application scenarios.
[0011] When the local request pool module packages the batches, if a preset first number of requests in a batch is not reached within a preset first time period, the batch will be packaged.
[0012] The shard hash is introduced into each batch in the local request pool module, each request in each batch is sharded in order, each shard includes a preset second number of requests, the number of requests in the last shard is less than or equal to the preset second number, and each shard corresponds to a hash. The system has a security mechanism to prevent malicious nodes from transmitting erroneous shards. By introducing shard hash verification, batch integrity is ensured, and the security and stability of the system are improved.
[0013] The master instance in the shared request pool module receives the hashes of each batch and its fragments transmitted from the local request pool module, and allocates and submits the batches to the idle working instances. If there is no idle working instance, a new working instance is created through the serverless platform and one or several batches are allocated to the newly created working instance through the master instance. After the new working instance is created, a record is added to the working instance-status mapping table. The working instance-status mapping table records the status corresponding to each working instance, including busy, idle and to be recycled; after the batch is allocated to the working instance, a record needs to be added to the batch-working instance mapping table. The batch-working instance mapping table records the working instance corresponding to each batch; the master instances in each shared request pool module share the batch allocation results, that is, the corresponding relationship between the allocation of the shared batch and the working instance.
[0014] For each batch transmitted between two shared request pool modules, the hash of the batch is first transmitted to the corresponding master instance through the working instance of the shared request pool module where the batch is located. The master instance of the current shared request pool module transmits the hash of the batch to the master instance of another shared request pool module. The master instance of the other shared request pool module allocates the current batch to the corresponding idle working instance according to the hash. Finally, the batch is transmitted to the idle working instance allocated by another shared request pool module through the current working instance. At the same time, the master instance of the other shared request pool module shares the allocation result of the batch.
[0015] When the shared request pool module transmits a batch to other shared request pool modules, it only sends the current batch to a preset first number threshold number of random shared request pool modules each time, and receives batches sent by other shared request pool modules. Each shared request pool module with the current batch will continue to transmit the current batch to other preset first number threshold number of random shared request pool modules next time until all shared request pool modules have received the current batch, and a point-to-point P2P method is used to optimize bandwidth usage and achieve efficient transmission of large batches of data.
[0016] When the batches in the consensus node where the shared request pool module is located are transmitted, for each batch, the idle working instance first verifies the shards of the batch transmitted by the main instance or the working instance of other consensus nodes and their corresponding hashes. If one or more shards of the batch do not correspond to their respective hashes, the idle working instance refuses to receive the current batch; if the shards of the current batch and their hashes all correspond, for each shard, it is determined whether the current shard exists in the idle working instance of the shard to be received. If so, the current shard is not received and feedback that the current shard already exists is returned; if not, the current shard is received. If the batch corresponding to the current shard exists in the idle working instance of the shard to be received, the current shard is directly inserted into the corresponding position in the batch according to the hash; different shards of the same batch can be transmitted to the same consensus node by different consensus nodes.
[0017] For each batch in the master instance and each working instance in the current consensus node, determine whether the shards in the batch are complete. If the current batch is complete, obtain the complete proof and submit the batch with the complete proof to the master instance. At the same time, receive the complete proof of the batch in the working instances of other consensus nodes. If the complete proof is not obtained, determine whether the working instance has received the complete proof of the batch in the working instances of the preset second number threshold of other consensus nodes. If so, construct the complete proof of the batch. If not, broadcast the batch existence request to other consensus nodes, and until the complete proof of the batch in the working instances of the preset second number threshold of other consensus nodes is received, then construct the complete proof of the batch. If the current batch is incomplete, determine the sending mode. If the number of consensus nodes is greater than the preset node threshold, use a random sending mode to randomly send each shard in the batch to the working instances in the consensus nodes that have not sent the current shard. If the number of consensus nodes is less than the preset node threshold, use a complete sending mode to send each shard in the batch to the working instances in all consensus nodes until all shards in the batch have been sent and then end the transmission. When the batch is incomplete, the received shards can also be sent.
[0018] The idle working instances in the shared request pool module are working instances whose load is lower than a preset first load threshold. If the idle working instances change to a load higher than a preset second load threshold, the state of the working instances is modified to busy. The shared request pool module checks the idle working instances at intervals of a preset second time period. If there are N idle working instances in the shared request pool module, the main instance selects N-1 idle working instances therefrom, modifies the state to pending recycling, and no longer allocates batches, that is, selects some idle working instances and prohibits allocating batches, and waits for the selected N-1 pending recycling working instances to be recycled and the working instances in another shared request pool module. After the transmission process of the shared batch is completed, the batches in each work instance to be recycled are first allocated to the idle work instance, and then the N-1 work instances to be recycled are deleted and released through the serverless platform, and the status of the work instance is modified in the work instance-state mapping table. The load is calculated based on the bandwidth and memory, and the status is judged based on the load; the system's main instance can dynamically create or destroy work instances according to the current load situation to optimize resource usage and ensure efficient operation of the system in high-throughput scenarios, and can intelligently allocate and balance the load of the work instances, and maintain the system's high performance and response speed by dynamically adjusting the number of instances and batch allocation.
[0019] Before sorting the serial IDs of the batches, the consensus module first adds a block header to each batch, which includes a block hash, a block height, and a preceding block hash. Then, the serial IDs of the batches in the respective shared request pool modules are sorted according to the block headers, so that the serial ID sorting of the batches in each consensus node is finally kept consistent.
[0020] The beneficial effects of the present invention are:
[0021] 1. Performance improvement: By reducing the load of the consensus algorithm and optimizing the network communication strategy, the processing speed and throughput of the blockchain system are significantly improved.
[0022] 2. Flexible scalability: The hierarchical design of the request pool allows dynamic adjustment of resources according to actual needs to better adapt to different business scenarios and network conditions.
[0023] 3. Reduce resource consumption: The optimized data transmission mechanism reduces the consumption of network bandwidth and the computing pressure of nodes.
[0024] In summary, the present invention solves the technical problems of insufficient scalability and excessive resource consumption caused by the high coupling of consensus algorithm and request management in the traditional blockchain architecture. Based on the characteristics and advantages of serverless technology, by decoupling the consensus algorithm and the request pool, more flexible system expansion and more efficient consensus processing are achieved, the processing load of the consensus algorithm is reduced, the processing speed and throughput of the blockchain system are significantly improved, the system scalability is enhanced, and the consumption of network bandwidth and computing resources is reduced, thereby improving the overall performance and response speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is the overall framework diagram of the system of the present invention;
[0026] Figure 2 It is a schematic diagram of the block and batch data structure of the present invention;
[0027] Figure 3 is a process flow chart of a working example of the present invention;
[0028] Figure 4 It is a processing flow chart of the main example of the present invention. DETAILED DESCRIPTION
[0029] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0030] like Figure 1As shown, the serverless blockchain consensus optimization system of the present invention includes an application programming interface API module, a local request pool module, a hierarchical shared request pool module and a decoupled consensus module, wherein the application programming interface API module receives requests sent by several users; the local request pool module receives requests from each user in the application programming interface API module and packages a preset first number of requests into a batch to obtain several batches; the hierarchical shared request pool module receives each batch packaged by the local request pool module and shares it with a shared request pool module in the blockchain consensus optimization system of another consensus node, wherein the shared request pool module includes a main instance and several working instances, batches are shared between the main instance and each working instance, each working instance independently manages its own batch, the main instance in every two shared request pool modules shares the metadata of the transmitted batch, and each working instance in every two shared request pool modules shares the content of the batch in a peer-to-peer P2P manner through a serverless platform; the shared request pool module supports dynamic expansion and contraction. The shared request pool module uses an efficient network protocol to distribute batches, optimizes network communication strategies, reduces network bandwidth consumption and node computing pressure, reduces the time and resource consumption of network message transmission, and allows dynamic adjustment of resources according to actual needs. Each work instance can independently manage request batches to adapt to different business scenarios and network conditions. The decoupled consensus module determines the serial number ID of each batch in the shared request pool module and performs consensus optimization with the consensus module in the blockchain consensus optimization system of other consensus nodes, and finally unifies the serial number ID of the batch in each consensus node. The consensus module reduces the amount of data processing and network communication by processing the request batch ID instead of the complete batch content, significantly reduces the processing load of the consensus algorithm, and improves the processing speed and throughput of the blockchain consensus optimization system. The system achieves a high degree of decoupling between the consensus algorithm and request management, which improves the scalability and processing efficiency of the system in the alliance chain application scenario.
[0031] When the local request pool module packages a batch, if the number of requests in a batch does not reach the preset first number within the preset first time period, the batch will be packaged. Figure 2 As shown, shard hash is introduced into each batch in the local request pool module, and each request in each batch is sharded in sequence, each shard includes a preset second number of requests, and the number of requests in the last shard is less than or equal to the preset second number, and each shard corresponds to a hash. The system has a security mechanism to prevent malicious nodes from transmitting erroneous shards. By introducing shard hash verification, batch integrity is ensured, and the security and stability of the system are improved.
[0032] like Figure 4As shown, the master instance in the shared request pool module receives the hashes of each batch and its fragments transmitted from the local request pool module, and allocates and submits the batches to the idle working instances. If there is no idle working instance, a new working instance is created through the serverless platform and one or several batches are allocated to the newly created working instance through the master instance. After the new working instance is created, a record is added to the working instance-status mapping table. The working instance-status mapping table records the status corresponding to each working instance, including busy, idle and to be recycled; after the batch is allocated to the working instance, a record needs to be added to the batch-working instance mapping table. The batch-working instance mapping table records the working instance corresponding to each batch; the master instances in each shared request pool module share the batch allocation results, that is, the corresponding relationship between the allocation of shared batches and working instances.
[0033] For each batch transmitted between two shared request pool modules, the hash of the batch is first transmitted to the corresponding master instance through the working instance of the shared request pool module where the batch is located. The master instance of the current shared request pool module transmits the hash of the batch to the master instance of another shared request pool module. The master instance of the other shared request pool module allocates the current batch to the corresponding idle working instance according to the hash. Finally, the batch is transmitted to the idle working instance allocated by another shared request pool module through the current working instance. At the same time, the master instance of the other shared request pool module shares the allocation result of the batch.
[0034] When a shared request pool module transmits a batch to other shared request pool modules, it only sends the current batch to a preset first number threshold number of random shared request pool modules each time, and receives batches sent by other shared request pool modules. Each shared request pool module with the current batch will continue to transmit the current batch to other preset first number threshold number of random shared request pool modules next time until all shared request pool modules have received the current batch. The point-to-point P2P method is used to optimize bandwidth usage and achieve efficient transmission of large batches of data.
[0035] like Figure 3As shown, when the batches in the consensus node where the shared request pool module is located are transmitted, for each batch, the idle working instance first verifies the shards of the batch transmitted by the main instance or the working instance of other consensus nodes and their corresponding hashes. If one or more shards of the batch do not correspond to their respective hashes, the idle working instance refuses to receive the current batch; if the shards of the current batch and their hashes all correspond, for each shard, determine whether the current shard exists in the idle working instance of the shard to be received. If so, the current shard is not received and feedback that the current shard already exists is returned. If not, the current shard is received. If the batch corresponding to the current shard exists in the idle working instance of the shard to be received, the current shard is directly inserted into the corresponding position in the batch according to the hash; different shards of the same batch can be transmitted to the same consensus node by different consensus nodes.
[0036] For each batch in the master instance and each working instance in the current consensus node, determine whether the shards in the batch are complete. If the current batch is complete, obtain the complete proof and submit the batch with the complete proof to the master instance. At the same time, receive the complete proof of the batch in the working instances of other consensus nodes. If the complete proof is not obtained, determine whether the working instance has received the complete proof of the batch in the working instances of the preset second number threshold of other consensus nodes. If so, construct the complete proof of the batch. If not, broadcast the batch existence request to other consensus nodes, and until the complete proof of the batch in the working instances of the preset second number threshold of other consensus nodes is received, then construct the complete proof of the batch. If the current batch is incomplete, determine the sending mode. If the number of consensus nodes is greater than the preset node threshold, use a random sending mode to randomly send each shard in the batch to the working instances in the consensus nodes that have not sent the current shard. If the number of consensus nodes is less than the preset node threshold, use a complete sending mode to send each shard in the batch to the working instances in all consensus nodes until all shards in the batch have been sent and then end the transmission. When the batch is incomplete, the received shards can also be sent.
[0037] The idle working instances in the shared request pool module are working instances whose load is lower than the preset first load threshold. If the idle working instances change to be higher than the preset second load threshold, the state of the working instances is modified to busy. The shared request pool module checks the idle working instances every preset second time period. If there are N idle working instances in the shared request pool module, the main instance selects N-1 idle working instances and modifies the state to be recycled and no longer allocates batches, that is, selects some idle working instances and prohibits the allocation of batches. After the transmission process of the shared batches between the selected N-1 working instances to be recycled and the working instances in another shared request pool module is completed, the batches in each working instance to be recycled are first allocated to the idle working instance, and then the N-1 working instances to be recycled are deleted and released through the serverless platform, and the state of the working instance is modified in the working instance-state mapping table. The load is calculated based on the bandwidth and memory, and the state is judged based on the load. The main instance of the system can dynamically create or destroy working instances according to the current load situation to optimize resource usage and ensure the efficient operation of the system in high-throughput scenarios. It can also intelligently allocate and balance the load of working instances, and maintain the high performance and response speed of the system by dynamically adjusting the number of instances and batch allocation.
[0038] like Figure 2 As shown in the figure, before the consensus module sorts the serial number ID of the batch, it first adds a block header to each batch, and the block header includes the block hash, block height and the previous block hash. Then, the serial number ID of each batch in the respective shared request pool module is sorted according to the block header, and finally the serial number ID sorting of the batches in each consensus node is kept consistent.
[0039] In a specific embodiment, the request pool is responsible for distributing batches, while the consensus algorithm focuses on determining the order of these batch IDs. This decoupling not only simplifies the task of the consensus algorithm, but also allows the request pool to be elastically scaled according to actual needs, effectively resolving the contradiction between low capacity that may occur in long-term operation and high throughput that needs to be processed in the short term.
[0040] In the traditional blockchain architecture, the client usually sends requests to the blockchain node through the API module, and these requests are then stored in the local request pool. The local request pool aggregates the requests into batches according to the number of requests and timeouts, and hands them over to the consensus module. The consensus module will regularly elect leader nodes, and the elected leader nodes will be responsible for broadcasting and distributing the batches. Analysis shows that in this process, a lot of time and resources are consumed in the transmission of batch network messages and their serialization and deserialization operations, which not only leads to the blockage of the consensus process, but also puts higher requirements on the consensus performance. In order to solve these problems, the present invention introduces a shared request pool module between the consensus module and the local request pool, which is responsible for reading requests from the local request pool, packaging them into batches, and completing the forwarding of batches between nodes through efficient network transmission. Once a batch is received by a sufficient number of nodes, the ID of the batch will be submitted to the consensus module for processing, thereby avoiding the need to transmit the complete request body in each network request.
[0041] System administrators can adjust the quantity threshold according to actual conditions to adapt to different network environments and request loads. The threshold can be at most MF and at least M-2F, where M is the total number of nodes and F is the number of Byzantine fault-tolerant nodes. When the master node completes the distribution of the batch, it uses the threshold signature algorithm to calculate the proof of all received replies, and then broadcasts the proof. After other nodes receive the proof, they can submit the ID of this batch to the consensus module. When the preset second quantity threshold consensus nodes all prove that there is a complete batch, a complete proof is constructed.
[0042] In the traditional blockchain architecture, the broadcast mode is used to achieve forwarding, that is, the node that packages the batch continuously broadcasts data to other nodes. However, when the request load and network bandwidth between nodes are unevenly distributed, this method may cause some nodes to be under excessive network pressure, thereby affecting the performance of the entire blockchain system. Therefore, the present invention proposes a more efficient network transmission mode, that is, each node only sends batches to a fixed number of other nodes, and optimizes the use of bandwidth through a point-to-point P2P method. In addition, each node can receive batches from multiple other nodes at the same time. By sharding the number of requests, efficient transmission of large batches of data is achieved, which significantly improves the overall throughput of the blockchain.
[0043] Each node sends a batch to a fixed number of other nodes by opening a connection with the peer and informing the peer of the batch metadata. The batch metadata contains a batch hash and a list of shard hashes. The peer can receive multiple connections at the same time and perform shard downloads based on the request length, downloading only the requests that are missing from the batch.
[0044] In order to prevent malicious nodes from transmitting incorrect content, shard hashing can be introduced. After the node splices the shards into batches, if it finds that the hash of the batch does not match the batch hash in the metadata, it means that the shard hash list of this node is incorrect. At this time, this node will send a shard hash request to other nodes, and the specific content is the shard hash list of this node. After receiving the request, other nodes with complete batches will compare their own shard hash lists. If they find mismatched shards, they will send the correct shards and shard hash lists to the requesting node. After receiving the correct shards, the requesting node will recalculate the hash of the batch, and if they match, they will submit it to the consensus module.
[0045] Random transmission will introduce long tail delay, that is, some nodes need to wait for a long time before receiving shards from other nodes. When the number of nodes is small, in order to reduce tail delay, every two nodes can be connected. After any node completes batch reception, it will broadcast the information that this node can receive the batch to other nodes. After receiving it, other nodes will send a request to avoid some nodes being unable to receive batch requests for a long time.
[0046] In order to better cope with high-throughput request scenarios, the request pool is further subdivided into a master instance and multiple worker instances, which are run on each node. It is the worker instances that actually receive and forward requests, and each worker instance is responsible for managing a portion of the batches. When a worker instance needs to share its batch, it sends a request to the master instance of another node to confirm the corresponding batch, and then forwards the batch to the corresponding worker instance. Depending on the current load, the system can dynamically create or destroy request pool instances. When resource usage (such as bandwidth and memory) reaches the upper limit, the master instance uses the serverless platform to create a new request pool instance; when resource usage decreases, the no longer needed instances are destroyed. In addition, if the load of a worker instance is too high, the master instance creates a new worker instance and assigns a portion of the batches to the new worker instance for processing. When some worker instances are always idle for a long period of time, the master instance marks the worker instance as pending for recycling. Instances in the pending recycling state will not be assigned to new request batches. The master instance will destroy the working instance after ensuring that all batches under the working instance have been processed, or try to assign the remaining batches to other working instances before destroying the working instance.
[0047] The present invention also includes an electronic device, including a memory and a processor coupled to each other, wherein the memory stores program data, and the processor calls the program data to execute the above system.
[0048] The present invention also includes a computer-readable storage medium having program data stored thereon, and the program data implements the above system when executed by a processor.
[0049] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware.
[0050] Moreover, the present application may be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The solutions in the embodiments of the present application may be implemented in various computer languages.
[0051] Although the present invention has been disclosed as above by way of embodiments, it is not intended to limit the present invention. Appropriate modifications or equivalent substitutions of the technical solutions of the present invention made by ordinary technicians in the field should all be included in the protection scope of the present invention. The protection scope of the present invention shall be based on what is defined in the claims.
Claims
1. A serverless blockchain consensus optimization system, characterized in that: include: An application programming interface API module is used to receive requests sent by a number of users; A local request pool module, used for receiving requests from various users in the application programming interface API module and packaging a preset first number of requests into a batch to obtain a plurality of batches; A shared request pool module is used to receive batches packaged by a local request pool module and share them with a shared request pool module in a blockchain consensus optimization system of another consensus node. The shared request pool module includes a master instance and several working instances. Batch sharing is performed between the master instance and each working instance. Each working instance independently manages its own batch. The master instances in every two shared request pool modules share the metadata of the batches transmitted. Each working instance in every two shared request pool modules performs point-to-point batch content transmission sharing through a serverless platform. The consensus module is used to determine the serial number ID of each batch in the shared request pool module and perform consensus optimization with the consensus modules in the blockchain consensus optimization system of other consensus nodes, and finally unify the serial number ID of the batches in each consensus node.
2. The serverless blockchain consensus optimization system according to claim 1 is characterized in that: When the local request pool module packages the batches, if a preset first number of requests in a batch is not reached within a preset first time period, the batch will be packaged.
3. The serverless blockchain consensus optimization system according to claim 1 is characterized in that: Shard hashes are introduced into each batch in the local request pool module, and each request in each batch is sharded in sequence. Each shard includes a preset second number of requests, and the number of requests in the last shard is less than or equal to the preset second number. Each shard corresponds to a hash.
4. The serverless blockchain consensus optimization system according to claim 3 is characterized in that: The master instance in the shared request pool module receives the hashes of each batch and its fragments transmitted from the local request pool module, and allocates and submits the batches to the idle working instances. If there is no idle working instance, a new working instance is created through the serverless platform and one or more batches are allocated to the newly created working instance through the master instance; the master instances in each shared request pool module share the batch allocation results; For each batch transmitted between two shared request pool modules, the hash of the batch is first transmitted to the corresponding master instance through the working instance of the shared request pool module where the batch is located. The master instance of the current shared request pool module transmits the hash of the batch to the master instance of another shared request pool module. The master instance of the other shared request pool module allocates the current batch to the corresponding idle working instance according to the hash. Finally, the batch is transmitted to the idle working instance allocated by another shared request pool module through the current working instance. At the same time, the master instance of the other shared request pool module shares the allocation result of the batch.
5. The server-free blockchain consensus optimization system according to claim 4 is characterized in that: When the shared request pool module transmits a batch to other shared request pool modules, it only sends the current batch to a preset first number threshold number of random shared request pool modules each time, and receives batches sent by other shared request pool modules. Each shared request pool module with the current batch will continue to transmit the current batch to other preset first number threshold number of random shared request pool modules next time until all shared request pool modules have received the current batch.
6. The serverless blockchain consensus optimization system according to claim 4 is characterized in that: When the batches in the consensus node where the shared request pool module is located are transmitted, for each batch, the idle working instance first verifies the shards of the batch transmitted by the main instance or the working instance of other consensus nodes and their corresponding hashes. If one or more shards of the batch do not correspond to their respective hashes, the idle working instance refuses to receive the current batch; if the shards of the current batch and their hashes all correspond, for each shard, it is determined whether the current shard exists in the idle working instance of the shard to be received. If so, the current shard is not received and feedback that the current shard already exists is returned. If not, the current shard is received. If the batch corresponding to the current shard exists in the idle working instance of the shard to be received, the current shard is directly inserted into the corresponding position in the batch according to the hash; For each batch in the main instance and each working instance in the current consensus node, determine whether the shards in the batch are complete. If the current batch is complete, obtain a complete certificate and submit the batch with a complete certificate to the main instance. At the same time, receive the complete certificates of the batches in the working instances of other consensus nodes. If the complete certificate is not obtained, determine whether the working instance has received the complete certificates of the batches in the working instances of other consensus nodes with a preset second number threshold. If so, construct a complete certificate of the batch. Otherwise, broadcast a batch existence request to other consensus nodes, and until the complete certificates of the batches in the working instances of other consensus nodes with a preset second number threshold are received, reconstruct the complete certificate of the batch. If the current batch is incomplete, determine the sending mode. If the number of consensus nodes is greater than the preset node threshold, use a random sending mode to randomly send each shard in the batch to the working instances in the consensus nodes that have not sent the current shard. If the number of consensus nodes is less than the preset node threshold, use a complete sending mode to send each shard in the batch to the working instances in all consensus nodes until all shards in the batch have been sent and then end the transmission.
7. The serverless blockchain consensus optimization system according to claim 4 is characterized in that: The idle working instances in the shared request pool module are working instances whose loads are lower than a preset first load threshold. If the idle working instances change to a load higher than a preset second load threshold, the state of the working instances is modified to busy. The shared request pool module checks the idle working instances at intervals of a preset second time period. If there are N idle working instances in the shared request pool module, the main instance selects N-1 idle working instances therefrom, modifies the state to be recycled and no longer allocates batches. After the transmission process of the shared batches between the selected N-1 working instances to be recycled and the working instances in another shared request pool module is completed, the batches in each working instance to be recycled are first allocated to the idle working instances, and then the N-1 working instances to be recycled are deleted and released through the serverless platform.
8. The server-free blockchain consensus optimization system according to claim 3 is characterized in that: Before sorting the serial number IDs of the batches, the consensus module first adds a block header to each batch, and then sorts the serial number IDs of the batches in the respective shared request pool modules according to the block header, so as to finally keep the serial number ID sorting of the batches in each consensus node consistent.
Citation Information
Patent Citations
Alliance chain consensus method and system based on partition technology
CN117424692A
Improved consensus method based on raft and related device
WO2024113334A1
