Blockchain on-chain data processing methods, devices, equipment, and computer storage media
By optimizing the routing table and data transformation method of blockchain ledger nodes, the problem of low data uploading efficiency in blockchain networks is solved, realizing an efficient and reliable data uploading process and ensuring that data is uploaded to the chain within the network's carrying capacity and time requirements.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE GROUP DESIGN INST
- Filing Date
- 2022-08-12
- Publication Date
- 2026-05-26
Smart Images

Figure CN116962275B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, and in particular to a method, apparatus, device, and computer storage medium for on-chain data processing. Background Technology
[0002] Blockchain, as a data structure that stores data in chronological order, supports the uploading of various types of data. The choice of data for uploading can be either the raw data or its corresponding hash value. Uploading the raw data is a good solution when the data volume is small. However, as the data volume increases, processing efficiency becomes low in the internet environment. Using the hash value of the data can solve this problem, but it requires corresponding calculations. Therefore, there is an urgent need for a method to determine the appropriate data format for blockchain uploading under different circumstances, thereby improving the overall efficiency of the blockchain network. Summary of the Invention
[0003] The main objective of this invention is to provide a method, apparatus, device, and computer storage medium for on-chain data processing in the blockchain, aiming to solve the technical problem of how to improve the overall efficiency of the blockchain network.
[0004] To achieve the above objectives, the present invention provides a blockchain on-chain data processing method, comprising the following steps:
[0005] Obtain the routing table corresponding to the accounting node on the blockchain, and determine the priority of each target node based on the consumption time and routing hop count from the accounting node to all target nodes in the routing table;
[0006] Obtain the data upload time corresponding to the data file, and check whether the data upload time is greater than the preset data upload interval;
[0007] If the data upload time is greater than the preset data upload interval, the target queuing time for the target data file to be uploaded to the blockchain is calculated based on the routing table.
[0008] If the target queuing time does not meet the preset time requirement, the routing table is updated based on the priority, and the target data file is uploaded to the blockchain based on the updated routing table.
[0009] Optionally, the step of updating the routing table based on the priority includes:
[0010] Based on the priority, the target node with the lowest priority in the routing table is removed to obtain the updated routing table;
[0011] Based on the updated routing table, continue with the step of calculating the target queuing time for the target data file to be uploaded to the blockchain.
[0012] Optionally, after continuing with the step of calculating the target queuing time for the target data file to be uploaded to the blockchain based on the updated routing table, the process includes:
[0013] If the number of target nodes in the updated routing table reaches the preset minimum number of nodes, and the data upload time of the target data file is greater than the preset data upload interval, then the non-compliant data in the target data file is determined.
[0014] Determine the number of non-compliances corresponding to the non-compliance data, calculate the product between the number of non-compliances and a preset ratio, and use the product as the conversion ratio;
[0015] The substandard data is hashed according to the conversion ratio to obtain a hash value, and the data is then uploaded to the blockchain based on the hash value.
[0016] Optionally, after calculating the product between the number of non-compliances and the preset ratio, and using the product as the conversion ratio, the process includes:
[0017] Continue calculating the latest data upload time of the target data file. If the latest data upload time is greater than the preset data upload interval, increase the number of non-compliance counts. Then, based on the increased number of non-compliance counts, perform the step of calculating the product between the number of non-compliance counts and the preset ratio until the new data upload time of the target data file is less than or equal to the preset data upload interval.
[0018] Optionally, the step of determining the priority of each target node based on the consumption time and routing hop count from the accounting node to all target nodes in the routing table includes:
[0019] Determine the time consumed from the accounting node to all target nodes in the routing table, and determine the priority of each target node in order of the consumption time.
[0020] If there are multiple identical target nodes with the same consumption time among the target nodes, the routing hop count of each identical target node is counted, and the priority of each identical target node is determined sequentially according to the size of the routing hop count.
[0021] Optionally, the target queuing time includes the total queuing time and the duration, and the step of calculating the target queuing time of the target data file to be uploaded to the blockchain based on the routing table includes:
[0022] The total amount of data in queue at the accounting node is determined based on the target data file to be uploaded to the blockchain, and the total queuing time is determined based on the total amount of data in queue.
[0023] Determine the consumption time in the routing table, and determine the duration based on the consumption time.
[0024] Optionally, the step of determining the total queuing time based on the total amount of queued data includes:
[0025] Obtain the data file capacity of the historical data file that has been uploaded to the blockchain, and determine the total uploading time corresponding to the historical data file;
[0026] The ratio between the data file size and the total on-chain time is used as the on-chain efficiency.
[0027] The ratio between the total amount of data in the queue and the on-chain efficiency is used as the total queuing time.
[0028] Furthermore, to achieve the above objectives, the present invention also provides a blockchain on-chain data processing device, comprising:
[0029] The acquisition module is used to acquire the routing table corresponding to the accounting node on the blockchain, and determine the priority of each target node based on the consumption time and routing hop count from the accounting node to all target nodes in the routing table;
[0030] The detection module is used to obtain the data upload time corresponding to the data file and detect whether the data upload time is greater than the preset data upload interval.
[0031] The calculation module is used to calculate the target queuing time of the target data file to be uploaded to the blockchain based on the routing table if the data upload time is greater than the preset data upload interval.
[0032] The data upload module is used to update the routing table based on the priority if the target queuing time does not meet the preset time requirement, and upload the target data file to the blockchain based on the updated routing table.
[0033] In addition, to achieve the above objectives, the present invention also provides a blockchain on-chain data processing device, which includes a memory, a processor, and a blockchain on-chain data processing program stored in the memory and executable on the processor. When the blockchain on-chain data processing program is executed by the processor, it implements the steps of the blockchain on-chain data processing method described above.
[0034] In addition, to achieve the above objectives, the present invention also provides a computer storage medium storing a blockchain on-chain data processing program, which, when executed by a processor, implements the steps of the blockchain on-chain data processing method described above.
[0035] This invention determines the priority of each target node based on the routing table corresponding to the accounting node on the blockchain. When the data upload time corresponding to the data file is greater than the preset data upload interval, the target queuing time is calculated based on the routing table. When the target queuing time does not meet the preset time requirement, the routing table is updated based on the priority of the target node before data upload is performed. This avoids the low processing efficiency of data upload in existing technologies. It can ensure that data can be fully uploaded to the blockchain while ensuring network capacity and data upload time. It can also ensure that the network will not be congested and data will not be lost when a large amount of data is uploaded to the blockchain, thus maximizing the data upload operation and improving the overall efficiency of the blockchain network. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of the terminal / device structure of the hardware operating environment involved in the embodiments of the present invention;
[0037] Figure 2 This is a flowchart illustrating the first embodiment of the blockchain on-chain data processing method of the present invention;
[0038] Figure 3 This is a schematic diagram of the device modules of the blockchain on-chain data processing device of the present invention;
[0039] Figure 4 This is a schematic diagram of the routing table in the blockchain on-chain data processing method of the present invention.
[0040] The objectives, features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0041] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0042] like Figure 1 As shown, Figure 1 This is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiments of the present invention.
[0043] In this embodiment of the invention, the terminal is a blockchain on-chain data processing device.
[0044] like Figure 1As shown, the terminal may include: a processor 1001, such as a CPU; a network interface 1004; a user interface 1003; a memory 1005; and a communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen and an input unit such as a keyboard. Optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0045] Optionally, the terminal may also include a camera, RF (Radio Frequency) circuitry, sensors, audio circuitry, a WiFi module, and so on. These sensors may include light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display screen according to the ambient light level, while the proximity sensor can turn off the display screen and / or backlight when the terminal device is moved to the ear. Of course, the terminal device may also be equipped with other sensors such as a gyroscope, barometer, hygrometer, thermometer, and infrared sensor, which will not be elaborated upon here.
[0046] Those skilled in the art will understand that Figure 1 The terminal structure shown does not constitute a limitation on the terminal and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0047] like Figure 1 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a blockchain data processing program.
[0048] exist Figure 1 In the terminal shown, network interface 1004 is mainly used to connect to the backend server and communicate with it; user interface 1003 is mainly used to connect to the client (user end) and communicate with it; while processor 1001 can be used to call the blockchain on-chain data processing program stored in memory 1005 and perform the following operations:
[0049] Reference Figure 2 This invention provides a method for processing on-chain data in a blockchain. In a first embodiment of the method, the method includes the following steps:
[0050] Step S10: Obtain the routing table corresponding to the accounting node on the blockchain, and determine the priority of each target node based on the consumption time and routing hop count from the accounting node to all target nodes in the routing table;
[0051] Blockchain technology (also known as distributed ledger technology) boasts advantages such as centralization, transparency, immutability, and trustworthiness, and is expected to find widespread application in numerous fields including smart contracts, securities trading, e-commerce, the Internet of Things, social communication, file storage, proof of existence, identity verification, and equity crowdfunding. In a blockchain, nodes generate transactions. A node first packages multiple transactions into a structure called a block. Blocks formed at different times are linked together chronologically to form a chain, known as the blockchain. Different nodes use a distributed decision-making mechanism to determine how to generate and add a block to the blockchain. All different nodes in the network must maintain their own copies of the blockchain and ensure consistency between their copies. Blockchain nodes select data to upload based on business needs. However, due to the increasing scale of blockchain nodes, network transmission speed limitations, and system latency requirements, excessively large amounts of uploaded data can lead to system performance degradation and excessively long synchronization times, thus failing to meet business requirements.
[0052] As a data structure that stores data in chronological order, blockchain supports the uploading of various types of data. The choice of data to be uploaded can be either the original data or the hash value corresponding to the data.
[0053] Furthermore, since current blockchain on-chain methods rely on direct data uploads, which have certain drawbacks, this embodiment determines the on-chain method by assessing the relationship between data throughput and the blockchain network's carrying capacity. It balances the efficiency and quality of on-chain data upload by selecting the number of nodes and the data to be uploaded. Node priority, queuing methods, and data transformation methods ensure that the uploaded data achieves an optimal balance between quality and efficiency. A multicast routing table is used to obtain the data upload routing table. The priority of each node is comprehensively determined by combining the return time and hop count in the routing table, providing a basis for subsequent node selection for data upload. By monitoring the node upload time and the interval between uploaded data, a queuing algorithm is used to determine whether the current network can meet the data upload requirements. When network carrying capacity and upload time are guaranteed, the goal is to ensure complete data upload. If the upload quality is insufficient for data upload, the synchronization time can be reduced by decreasing the number of synchronization nodes based on node priority. If reducing the number of nodes still fails to meet the data upload time requirements, an algorithm is used to convert a portion of the data into corresponding hash values for upload, reducing network load and upload time until a balance between data upload time and quality is finally achieved. Furthermore, it enables large amounts of data to be uploaded to the blockchain while ensuring that the network does not experience congestion or data loss. This maximizes the ability of raw data to be uploaded to the blockchain.
[0054] In this embodiment, since the blockchain network contains multiple ledger nodes, and each ledger node, upon joining the blockchain network, first sends test packets to other nodes via a routing protocol to obtain routing tables and latency information for reaching other ledger nodes. Thus, each ledger node in the network maintains a routing table containing latency information. The priority of a ledger node to each target node is determined based on latency and hop count. Shorter latency has higher priority, and longer latency has lower priority. With the same latency, fewer hops have higher priority, and more hops have lower priority. Simultaneously, the ledger node stores the minimum number of nodes required by the system. This is achieved by obtaining the data uplink routing table via multicast. The priority of a ledger node to each target node is comprehensively determined by combining the return time and hop count in the routing table, providing a basis for selecting nodes for subsequent data uplink. Each ledger node in the network maintains a routing table containing latency information. The priority of each ledger node is determined based on latency and hop count. Shorter latency has higher priority, and longer latency has lower priority. With the same latency, fewer hops have higher priority, and more hops have lower priority. At the same time, the minimum number of nodes required by the system is stored on the accounting node. The routing table can be as follows: Figure 4As shown, this includes the current node (i.e., the accounting node), the target node (other accounting nodes distinct from this node), the duration (i.e., the time consumed), and the number of hops (i.e., the routing hop count). Specifically, the duration from current node a to target node e is 30ms, with 3 hops. The duration from current node a to target node f is 45ms, with 4 hops. The duration from current node a to target node g is 22ms, with 4 hops. The duration from current node a to target node h is 65ms, with 5 hops. The duration from current node a to target node i is 70ms, with 4 hops.
[0055] Step S20: Obtain the data upload time corresponding to the data file, and detect whether the data upload time is greater than the preset data upload interval;
[0056] Data files are uploaded to the blockchain via ledger nodes (i.e., stored on the blockchain). After the accounting is completed, the ledger nodes record the data upload time. Therefore, the data upload time can be directly obtained, and it will be checked whether the data upload time is greater than the preset data upload interval (the time interval set in advance by the user). That is, this embodiment provides a queuing algorithm, which determines whether the current network can meet the data upload operation by monitoring the node data upload time and the preset data upload interval. Provided that network capacity and upload time are guaranteed, it ensures that the data can be fully uploaded to the blockchain.
[0057] Step S30: If the data upload time is greater than the preset data upload interval, calculate the target queuing time of the target data file to be uploaded based on the routing table.
[0058] If the data upload time is found to be less than or equal to the preset data upload interval, the next data upload operation can continue in the current manner, using the maximum number of nodes. However, if the data upload time exceeds the preset interval, adjustments are needed for the next data upload. Adjustments can be made by calculating the target queuing time for the target data file to be uploaded based on the priority of the target node, and then adjusting based on the target queuing time. The target queuing time can include the total queuing time and the duration. The duration can be determined by the priority of the target node and the time consumed, and the total queuing time can be calculated by dividing the total amount of data in the queue by the upload efficiency. The upload efficiency is calculated by dividing the capacity of the most recent n data files by the total upload time of these n files, where n can be any value, such as 10.
[0059] Step S40: If the target queuing time does not meet the preset time requirement, the routing table is updated based on the priority, and the target data file is uploaded to the blockchain based on the updated routing table.
[0060] Once the target queuing time is obtained, it needs to be checked whether the target queuing time meets the pre-set preset time requirements. Since the target queuing time includes the total queuing time and the duration, if the total queuing time exceeds the limit threshold 'a' and the duration exceeds the limit threshold 'b', it is determined that the target queuing time does not meet the preset time requirements. The limit thresholds 'a' and 'b' can be any values set by the user in advance and are not restricted here.
[0061] Furthermore, if the target queuing time does not meet the preset time requirement, the routing table can be updated. Specifically, if the quality of data upload cannot be guaranteed, the synchronization time can be reduced by decreasing the number of synchronization nodes based on node priority. If reducing the number of nodes still fails to meet the data upload time requirement, some data can be converted into corresponding hash values for upload to reduce network load and upload time, until a balance is finally achieved between data upload time and quality. After updating the routing table, if the data upload time is less than or equal to the preset data upload interval, the target data file can be uploaded to the blockchain to store it.
[0062] In this embodiment, the priority of each target node is determined according to the routing table corresponding to the accounting node on the blockchain. When the data upload time of the data file is greater than the preset data upload interval, the target queuing time is calculated based on the routing table. When the target queuing time does not meet the preset time requirement, the routing table is updated based on the priority of the target node before data upload is performed. This avoids the low processing efficiency in the prior art when uploading data to the blockchain. It can ensure that the data can be fully uploaded to the blockchain while ensuring network capacity and data upload time. It can also ensure that the network will not be congested and the data will not be lost when a large amount of data is uploaded to the blockchain, thus maximizing the data upload operation and improving the overall efficiency of the blockchain network.
[0063] Furthermore, based on the first embodiment of the present invention described above, a second embodiment of the blockchain on-chain data processing method of the present invention is proposed. In this embodiment, step S40 of the above embodiment, the step of updating the routing table based on the priority, is refined to include:
[0064] Step a: Based on the priority, remove the target node with the lowest priority from the routing table to obtain the updated routing table.
[0065] Step b involves continuing to calculate the target queuing time for the target data file to be uploaded to the blockchain based on the updated routing table.
[0066] In this embodiment, when updating the routing table, the lowest-priority target node in the routing table can be removed to obtain an updated routing table. Based on the updated routing table, the new target queuing time, i.e., the new total queuing time and duration, is recalculated. If the total queuing time continues to exceed the limit threshold 'a', and the duration continues to exceed the limit threshold 'b', then the lowest-priority target node in the updated routing table continues to be removed until the target queuing time meets the preset time requirement, or until the number of synchronization nodes associated with the accounting node in the routing table reaches the preset minimum number of nodes (i.e., the minimum number of nodes required by the system). The number of synchronization nodes refers to the total number of all other target nodes in the blockchain that share a smart contract with the accounting node.
[0067] In this embodiment, by removing the target node with the lowest priority from the routing table based on priority, an updated routing table is obtained, and then the target queuing time is calculated again, thereby reducing the time for nodes to be added to the chain and improving overall efficiency.
[0068] Specifically, after continuing to execute the step of calculating the target queuing time of the target data file to be uploaded to the blockchain based on the updated routing table, the process includes:
[0069] Step c: If the number of target nodes in the updated routing table reaches the preset minimum number of nodes, and the data upload time of the target data file is greater than the preset data upload interval, then the non-compliant data in the target data file is determined.
[0070] In this embodiment, during the process of updating the routing table, if it is found that the number of data synchronization nodes in the updated routing table has reached the minimum number of nodes, and the data upload time of the target data file when it is uploaded to the chain through the accounting node is still greater than the preset data upload interval, it can be determined that the data synchronization nodes in the routing table have reached the minimum number of synchronization nodes, but still cannot meet the data upload time requirement. At this time, the non-compliant data and compliant data can be statistically recorded.
[0071] Step d: Determine the number of times the non-compliance data corresponds to the non-compliance data, calculate the product between the number of times the non-compliance data is calculated and the preset ratio, and use the product as the conversion ratio;
[0072] The system counts the number of times non-compliant data fails to meet system requirements. This non-compliant count can be defined as the number of data packets whose on-chain time does not meet the system's requirements. Non-compliant data is then converted into corresponding hash values and saved according to a preset ratio, such as C%. If the requirements still cannot be met, the number of non-compliant data occurrences (N) is recorded, and the conversion ratio (N*C%) is increased further.
[0073] Step e: Hash the substandard data according to the conversion ratio to obtain a hash value, and upload the data to the blockchain according to the hash value.
[0074] After determining the conversion ratio, data that does not meet the requirements can be hashed according to the conversion ratio, and the hash values can be added to the blockchain. The remaining data can be added to the blockchain directly. If the data on-chain time is still longer than the data arrival time interval, then as N increases, the proportion of data converted into hash values increases until the data on-chain time is less than the data arrival time interval.
[0075] In this embodiment, when the number of target nodes is greater than the minimum number of nodes and the data upload time is greater than the preset data upload interval, the conversion ratio corresponding to the number of times the target is not met is calculated, and a hash conversion is performed according to the conversion ratio to obtain a hash value. Data is then uploaded to the blockchain according to the hash value, thereby ensuring the effective implementation of data upload.
[0076] Specifically, after calculating the product between the number of non-compliances and the preset ratio, and using the product as the conversion ratio, the process includes:
[0077] Step f: Continue to calculate the latest data on-chain time of the target data file. If the latest data on-chain time is greater than the preset data on-chain interval, increase the number of non-compliance counts, and perform the step of calculating the product between the number of non-compliance counts and the preset ratio based on the increased number of non-compliance counts, until the new data on-chain time of the target data file is less than or equal to the preset data on-chain interval.
[0078] In this embodiment, when uploading data to the blockchain based on hash values and qualified data, the latest data uploading time of the target data file can be calculated. If the latest data uploading time is still greater than the preset data uploading interval, the number of non-qualified data can be increased by including some qualified data as non-qualified data, thereby increasing the number of non-qualified data. Then, based on the increased number of non-qualified data, the product between the number of non-qualified data and the preset ratio, i.e., the conversion ratio, is calculated, and the uploading operation is performed according to the conversion ratio until the data uploading time of the target data file is less than or equal to the preset data uploading interval.
[0079] In this embodiment, by increasing the number of non-compliance times when the latest data upload time is greater than the preset data upload interval, the conversion ratio is increased, thereby effectively reducing network load and upload time.
[0080] Further, the step of determining the priority of each target node based on the consumption time and routing hop count from the accounting node to all target nodes in the routing table includes:
[0081] Step g: Determine the time consumed from the accounting node to all target nodes in the routing table, and determine the priority of each target node in order of the time consumed;
[0082] In this embodiment, the accounting node is added to the blockchain, and a routing table of all target nodes associated with the accounting node is obtained, such as... Figure 4 As shown. Then, the time taken from the accounting node to all target nodes in the routing table is determined, and the priority of each target node is determined based on the time taken, i.e., the priority of the data files in the local accounting node to the target accounting node. The priority can be determined based on the length of the time taken; for example, accounting nodes with longer time taken have lower priority, and accounting nodes with shorter time taken have higher priority.
[0083] Step h: If there are multiple identical target nodes with the same consumption time among the target nodes, then count the routing hop count of each identical target node, and determine the priority of each identical target node in turn according to the size of the routing hop count.
[0084] However, when determining the priority of target nodes based on their respective consumption times, there is a high probability that multiple target nodes will have the same consumption time. In this case, these target nodes can be treated as common target nodes. Then, the priority of each common target node can be determined based on its hop count. Similarly, the priority can be determined based on the size of the hop count; that is, common target nodes with smaller hop counts have lower priority, and those with larger hop counts have higher priority. In other words, in this embodiment, the priority of the accounting node can be determined based on the consumption time from the accounting node to the target node and the hop count.
[0085] In this embodiment, the priority of the target node is determined by the time consumed from the accounting node to the target node in the routing table and the number of routing hops, thereby ensuring the accuracy and effectiveness of the determined priority.
[0086] Further, the step of calculating the target queuing time for the target data file to be uploaded to the blockchain based on the routing table includes:
[0087] Step i: Determine the total amount of data in queue at the accounting node based on the target data file to be uploaded to the blockchain, and determine the total queuing time based on the total amount of data in queue.
[0088] In this embodiment, the target queuing time includes the total queuing time and the duration. Therefore, when calculating the target queuing time, it is necessary to calculate the total queuing time and the duration. That is, we can first count the number and size of the target data files waiting to be uploaded to the blockchain in the ledger node to determine the total amount of data in the queue, and then calculate the total queuing time based on the total amount of data in the queue.
[0089] Specifically, the step of determining the total queuing time based on the total amount of queued data includes:
[0090] Step k: Obtain the data file capacity of the historical data file that has been uploaded to the blockchain, and determine the total uploading time corresponding to the historical data file;
[0091] Step 1: The ratio between the data file size and the total on-chain time is taken as the on-chain efficiency;
[0092] Step m: The ratio between the total amount of data in the queue and the on-chain efficiency is taken as the total queuing time.
[0093] In this embodiment, when calculating the total queuing time, the file size and total on-chain time of historical data files that have already been uploaded to the blockchain can be obtained. The number of historical data files is unlimited and can be multiple, such as 10. The ratio between the file size and the total on-chain time is calculated and used as the on-chain efficiency. Then, the ratio between the total amount of data in the queue and the on-chain efficiency is calculated and used as the total queuing time. This ensures the accuracy of the calculated total queuing time.
[0094] Step j: Determine the consumption time in the routing table, and determine the duration based on the consumption time.
[0095] The duration can be calculated based on the routing table. Since the routing table stores the time it takes for a local accounting node to reach other accounting nodes (i.e., target nodes), the time taken can be determined based on the priority of each accounting node. For example, the time taken for the accounting node with the lowest priority is the duration.
[0096] In this embodiment, the total queuing time is determined by the ratio between the total queuing data volume and the on-chain efficiency, and the duration is determined by the consumption time in the routing table. The target queuing time includes both the total queuing time and the duration, thus improving the accuracy of determining the target queuing time.
[0097] In addition, refer to Figure 3 This invention also provides a blockchain on-chain data processing device, comprising:
[0098] The acquisition module A10 is used to acquire the routing table corresponding to the accounting node on the blockchain, and determine the priority of each target node based on the consumption time and routing hop count from the accounting node to all target nodes in the routing table;
[0099] The detection module A20 is used to obtain the data upload time corresponding to the data file and detect whether the data upload time is greater than the preset data upload interval.
[0100] The calculation module A30 is used to calculate the target queuing time of the target data file to be uploaded to the blockchain based on the routing table if the data upload time is greater than the preset data upload interval.
[0101] The data upload module A40 is used to update the routing table based on the priority if the target queuing time does not meet the preset time requirement, and upload the target data file to the blockchain based on the updated routing table.
[0102] Optionally, the data on-chain module A40 is used for:
[0103] Based on the priority, the target node with the lowest priority in the routing table is removed to obtain the updated routing table;
[0104] Based on the updated routing table, continue with the step of calculating the target queuing time for the target data file to be uploaded to the blockchain.
[0105] Optionally, the data on-chain module A40 is used for:
[0106] If the number of target nodes in the updated routing table reaches the preset minimum number of nodes, and the data upload time of the target data file is greater than the preset data upload interval, then the non-compliant data in the target data file is determined.
[0107] Determine the number of non-compliances corresponding to the non-compliance data, calculate the product between the number of non-compliances and a preset ratio, and use the product as the conversion ratio;
[0108] The substandard data is hashed according to the conversion ratio to obtain a hash value, and the data is then uploaded to the blockchain based on the hash value.
[0109] Optionally, the data on-chain module A40 is used for:
[0110] Continue calculating the latest data upload time of the target data file. If the latest data upload time is greater than the preset data upload interval, increase the number of non-compliance counts. Then, based on the increased number of non-compliance counts, perform the step of calculating the product between the number of non-compliance counts and the preset ratio until the new data upload time of the target data file is less than or equal to the preset data upload interval.
[0111] Optionally, module A10 is used for:
[0112] Determine the time consumed from the accounting node to all target nodes in the routing table, and determine the priority of each target node in order of the consumption time.
[0113] If there are multiple identical target nodes with the same consumption time among the target nodes, the routing hop count of each identical target node is counted, and the priority of each identical target node is determined sequentially according to the size of the routing hop count.
[0114] Optionally, the target queuing time includes the total queuing time and the duration, and the calculation module A30 is used for:
[0115] The total amount of data in queue at the accounting node is determined based on the target data file to be uploaded to the blockchain, and the total queuing time is determined based on the total amount of data in queue.
[0116] Determine the consumption time in the routing table, and determine the duration based on the consumption time.
[0117] Optionally, the computing module A30 is used for:
[0118] Obtain the data file capacity of the historical data file that has been uploaded to the blockchain, and determine the total uploading time corresponding to the historical data file;
[0119] The ratio between the data file size and the total on-chain time is used as the on-chain efficiency.
[0120] The ratio between the total amount of data in the queue and the on-chain efficiency is used as the total queuing time.
[0121] The steps for implementing each functional module of the blockchain on-chain data processing device can be referred to in the various embodiments of the blockchain on-chain data processing method of the present invention, and will not be repeated here.
[0122] Furthermore, the present invention also provides a blockchain on-chain data processing device, which includes: a memory, a processor, and a blockchain on-chain data processing program stored in the memory; the processor is used to execute the blockchain on-chain data processing program to implement the steps of the above-described embodiments of the blockchain on-chain data processing method.
[0123] The present invention also provides a computer storage medium, which can be a computer-readable storage medium storing one or more programs, which can be executed by one or more processors to implement the steps of the above-described embodiments of the blockchain on-chain data processing method.
[0124] The specific implementation of the computer-readable storage medium of the present invention is basically the same as the various embodiments of the blockchain on-chain data processing method described above, and will not be repeated here.
[0125] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0126] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0127] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0128] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for processing on-chain data in a blockchain, characterized in that, The blockchain on-chain data processing method includes the following steps: Obtain the routing table corresponding to the accounting node on the blockchain, and determine the priority of each target node based on the consumption time and routing hop count from the accounting node to all target nodes in the routing table; Obtain the data upload time corresponding to the data file, and check whether the data upload time is greater than the preset data upload interval; If the data upload time is greater than the preset data upload interval, the target queuing time for the target data file to be uploaded to the blockchain is calculated based on the routing table. If the target queuing time does not meet the preset time requirement, the routing table is updated based on the priority, and the target data file is uploaded to the blockchain based on the updated routing table. The step of updating the routing table based on the priority includes: Based on the priority, the target node with the lowest priority in the routing table is removed to obtain the updated routing table; Based on the updated routing table, continue executing the step of calculating the target queuing time for the target data file to be uploaded to the blockchain based on the routing table; After continuing the step of calculating the target queuing time of the target data file to be uploaded to the blockchain based on the updated routing table, the process includes: If the number of target nodes in the updated routing table reaches the preset minimum number of nodes, and the data upload time of the target data file is greater than the preset data upload interval, then the non-compliant data in the target data file is determined. Determine the number of non-compliance times corresponding to the non-compliant data, calculate the product between the number of non-compliance times and a preset ratio, and use the product as the conversion ratio; wherein, the number of non-compliance times is the number of data packets whose data upload time does not meet the system requirements; The substandard data is hashed according to the conversion ratio to obtain a hash value, and the data is then uploaded to the blockchain based on the hash value.
2. The blockchain on-chain data processing method as described in claim 1, characterized in that, After the step of calculating the product between the number of non-compliances and the preset ratio, and using the product as the conversion ratio, the following steps are included: Continue calculating the latest data upload time of the target data file. If the latest data upload time is greater than the preset data upload interval, increase the number of non-compliance counts. Then, based on the increased number of non-compliance counts, perform the step of calculating the product between the number of non-compliance counts and the preset ratio until the new data upload time of the target data file is less than or equal to the preset data upload interval.
3. The blockchain on-chain data processing method as described in claim 1, characterized in that, The step of determining the priority of each target node based on the time consumed from the accounting node to all target nodes in the routing table includes: Determine the time consumed from the accounting node to all target nodes in the routing table, and determine the priority of each target node in order of the consumption time. If there are multiple identical target nodes with the same consumption time among the target nodes, the routing hop count of each identical target node is counted, and the priority of each identical target node is determined sequentially according to the size of the routing hop count.
4. The blockchain on-chain data processing method as described in claim 1, characterized in that, The target queuing time includes the total queuing time and the duration. The step of calculating the target queuing time of the target data file to be uploaded to the blockchain based on the routing table includes: The total amount of data in queue at the accounting node is determined based on the target data file to be uploaded to the blockchain, and the total queuing time is determined based on the total amount of data in queue. Determine the consumption time in the routing table, and determine the duration based on the consumption time.
5. The blockchain on-chain data processing method as described in claim 4, characterized in that, The step of determining the total queuing time based on the total amount of queuing data includes: Obtain the data file capacity of the historical data file that has been uploaded to the blockchain, and determine the total upload time corresponding to the historical data file; The ratio between the data file size and the total on-chain time is used as the on-chain efficiency. The ratio between the total amount of data in the queue and the on-chain efficiency is used as the total queuing time.
6. A blockchain on-chain data processing device, characterized in that, The blockchain on-chain data processing device includes: The acquisition module is used to acquire the routing table corresponding to the accounting node on the blockchain, and determine the priority of each target node based on the consumption time and routing hop count from the accounting node to all target nodes in the routing table; The detection module is used to obtain the data upload time corresponding to the data file and detect whether the data upload time is greater than the preset data upload interval. The calculation module is used to calculate the target queuing time of the target data file to be uploaded to the blockchain based on the routing table if the data upload time is greater than the preset data upload interval. The data uploading module is used to update the routing table based on the priority if the target queuing time does not meet the preset time requirement, and then upload the target data file to the blockchain based on the updated routing table. The step of updating the routing table based on the priority includes: removing the target node with the lowest priority from the routing table to obtain an updated routing table; continuing to calculate the target queuing time for the target data file to be uploaded based on the updated routing table; and continuing to calculate the target queuing time for the target data file to be uploaded based on the updated routing table. After the target queuing time of the data packet, the process includes: if the number of target nodes in the updated routing table reaches the preset minimum number of nodes, and the data upload time of the target data file is greater than the preset data upload interval, then non-compliant data in the target data file is identified; the non-compliant number corresponding to the non-compliant data is determined, the product between the non-compliant number and a preset ratio is calculated, and the product is used as a conversion ratio; wherein, the non-compliant number is the number of data packets whose data upload time does not meet the system requirements; the non-compliant data is hashed according to the conversion ratio to obtain a hash value, and the data is uploaded to the blockchain according to the hash value.
7. A blockchain on-chain data processing device, characterized in that, The blockchain on-chain data processing device includes: a memory, a processor, and a blockchain on-chain data processing program stored in the memory and executable on the processor. When the blockchain on-chain data processing program is executed by the processor, it implements the steps of the blockchain on-chain data processing method as described in any one of claims 1 to 5.
8. A computer storage medium, characterized in that, The computer storage medium stores a blockchain on-chain data processing program, which, when executed by a processor, implements the steps of the blockchain on-chain data processing method as described in any one of claims 1 to 5.