Blockchain data request processing method and apparatus, server, and storage medium
By caching high-frequency data in a blockchain data oracle and analyzing request characteristics, the target data can be retrieved directly from the cache, solving the problem of excessive resource consumption in existing technologies and achieving faster data request response and resource conservation.
Patent Information
- Application Number
- CN202011448992.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-09
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2040-12-09
AI Technical Summary
Existing blockchain data oracle designs consume excessive network and node resources when processing data requests, resulting in slow response times.
By monitoring data requests from blockchain nodes, storing high-frequency data in a data cache, and analyzing the characteristics of historical data requests to determine if the target data is high-frequency data, the target data can be retrieved directly from the cache to reduce access to external data sources and improve response speed.
It improves the response speed of blockchain data requests and reduces the network and node resource consumption of the server node where the oracle is located.
Smart Images

Figure CN114679283B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a blockchain data request processing method, apparatus, server, and storage medium. Background Technology
[0002] With the rapid development of the internet, blockchain technology has attracted increasing attention. This decentralized, tamper-proof technology based on cryptography has been applied in a growing number of fields. Although blockchain technology has made significant progress during this period, it still cannot fundamentally solve the inherent defects of blockchain itself, such as the inability of blockchain smart contracts to spontaneously acquire external data. However, the emergence of oracles has solved this problem to some extent. An oracle is a mechanism that writes information from outside the blockchain into the blockchain, thereby enabling data exchange between the blockchain and the real world. It allows deterministic smart contracts to react to the uncertain external world, and is the only way for smart contracts to interact with the outside world, as well as the interface for data interaction between the blockchain and the real world. In the development of blockchain oracles, oracles can be divided into cross-chain oracles, data oracles, and computation oracles according to their data interaction type and function. Among them, the function of data oracles is to accept data requests from on-chain nodes, obtain data from the corresponding data source, and return it to the on-chain nodes.
[0003] However, current data oracle designs, considering factors such as data confidentiality, integrity, and data source reliability, consume excessive network and node resources of the server node where the data oracle resides. Summary of the Invention
[0004] The main objective of this application is to provide a blockchain data request processing method, apparatus, server, and storage medium, which improves the response speed of oracles to data requests sent by the blockchain, while reducing the network and node resources of the server node where the oracle is located.
[0005] To achieve the above objectives, this application provides a blockchain data request processing method, comprising: listening to data requests from blockchain nodes; analyzing whether the target data of the data request is high-frequency data based on the data characteristics of historical data requests; when the target data of the data request is high-frequency data, searching for the target data in a data cache; wherein the data cache is used to store high-frequency data; and returning the data request result to the blockchain node.
[0006] To achieve the above objectives, this application also provides a blockchain data request processing apparatus, comprising: a request listening module for listening to data requests from blockchain nodes; a request analysis module for analyzing whether the target data of a data request is high-frequency data based on the data characteristics of historical data requests; a data acquisition module for searching for the target data in a data cache when the target data of a data request is high-frequency data, wherein the data cache is used to store high-frequency data; and a data return module for returning the data request result to the blockchain node.
[0007] To achieve the above objectives, embodiments of this application also provide a server, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the above-described blockchain data request processing method.
[0008] To achieve the above objectives, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the aforementioned blockchain data request processing method.
[0009] The blockchain data request processing method proposed in this application predicts whether the currently received data request from the blockchain is a high-frequency data request based on the data characteristics of historical data requests. When the prediction result is yes, the target data of the existing high-frequency data request is directly searched from the data cache. This avoids encrypting and acquiring external data for all data requests, reduces the operations that the oracle needs to perform when responding to data requests, thereby improving the response speed to data requests and reducing the network resources consumed in processing data requests. Attached Figure Description
[0010] Figure 1 This is a flowchart of a blockchain data request processing method according to the first embodiment of the present invention;
[0011] Figure 2 This is a flowchart of a blockchain data request processing method according to a second embodiment of the present invention;
[0012] Figure 3 This is a flowchart of the oracle processing data requests according to the second embodiment of the present invention;
[0013] Figure 4 This is a schematic diagram of the structure of a blockchain data request processing device according to the third embodiment of the present invention;
[0014] Figure 5 This is a schematic diagram of the oracle structure according to the third embodiment of the present invention;
[0015] Figure 6 This is a schematic diagram of the server structure according to the fourth embodiment of the present invention. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details have been provided in the various embodiments of this application to help readers better understand this application. However, the technical solutions claimed in this application can be implemented even without these technical details and various changes and modifications based on the following embodiments. The division of the various embodiments below is for the convenience of description and should not constitute any limitation on the specific implementation of this application. The various embodiments can be combined with and referenced by each other without contradiction.
[0017] The first embodiment of the present invention relates to a blockchain data request processing method, the specific process of which is as follows: Figure 1 As shown, this includes: using the data characteristics of historical data requests (such as the proportion of user personalization, the proportion of data sources, data content, request events, data types, etc.) to predict whether the currently received data request from the blockchain is a high-frequency data request. When the prediction result is yes, the target data of the existing high-frequency data request is directly searched from the data cache. This avoids encrypting all data requests and performing external data acquisition operations, reducing the operations that the oracle needs to perform when responding to data requests, thereby improving the response speed to data requests and reducing the network resources consumed in processing data requests.
[0018] This embodiment can rely on a blockchain network that supports smart contracts (such as Hyperledger Fabric, Ethereum, etc.) as the operating environment to provide external data acquisition services for each node in the blockchain network, which can be called by smart contracts or applications that need external data acquisition services. It can be regarded as a method of implementing a data oracle.
[0019] In one example, the blockchain data request processing method in this embodiment can also provide external data acquisition services to various nodes in the blockchain network through multiple data oracles, i.e., a multi-node oracle network.
[0020] The following is a detailed description of the implementation details of the blockchain data request processing method in this embodiment. The following content is only for the convenience of understanding and is not necessary for implementing this solution.
[0021] The blockchain data request processing method in this embodiment is as follows: Figure 1 As shown, it specifically includes:
[0022] Step 101: Listen for data requests from blockchain nodes.
[0023] Specifically, in this embodiment, the data oracle listens to the target blockchain nodes in the blockchain network. When a blockchain node generates an external data request, it sends the relevant information parameters of the requested data to the data oracle in the form of a data request.
[0024] In one example, to protect the privacy of blockchain users from being stolen by users and third parties outside the oracle network, each blockchain node will encrypt the information parameters in the data request using the encryption method specified by the data oracle before sending it to the data oracle. When the data oracle hears the data request, it will decrypt the data request to obtain the information parameters carried in the data request.
[0025] In one example, the data oracle will store the data requests it receives in chronological order into a request queue, and then process the data requests in the request queue in subsequent steps.
[0026] Step 102: Based on data characteristics derived from historical data requests, such as user personalization percentage, data source percentage, data content, request events, and data types, analyze whether the target data of the data request is high-frequency data. If the target data of the data request is high-frequency data, proceed to step 103; if the target data of the data request is not high-frequency data, proceed to step 104.
[0027] Step 103: Locate the target data in the data cache.
[0028] Step 104: Obtain the target data from an external data source.
[0029] Specifically, historical data requests refer to other data requests that the data oracle detected before detecting the current data request. The oracle stores all data requests detected within a certain period and analyzes the data characteristics of these requests to determine whether the currently detected data request requests target data that has been repeatedly requested. For target data of historically high-frequency data requests, the oracle writes this data into a data cache for subsequent data requests to look up. Data characteristics can include one or any combination of the following: user personalization percentage, data source percentage, data content, request event, and data type.
[0030] When a new data request requests high-frequency data, the oracle will look for the target data in the data cache.
[0031] When a new data request requests data that is not frequently accessed, the oracle will obtain the target data from an external data source.
[0032] In one example, because the data source has a certain time sensitivity, data that has been stored in the data cache for too long will affect the accuracy of the target data. Users can set an update cycle for the oracle's data cache according to the actual data source or type. The oracle will periodically clean up the data in the data cache according to the update cycle, only saving data within a certain period up to the current time point or clearing all data from the previous cycle, thereby ensuring the consistency between the cached data and the external data.
[0033] Step 105: Return the data request result to the blockchain node.
[0034] Specifically, after the oracle finds the target data in the data cache or obtains the target data from an external data source, it verifies the reliability of the target data and then generates a data request result to be returned to the blockchain node that sent the data request.
[0035] In one example, when the blockchain data request processing method in this embodiment is implemented through an oracle network, after the oracle finds the target data from the data cache or obtains the target data from an external data source, it needs to encrypt the obtained target data according to a preset encryption algorithm, add the signature of the node, and then send it to other oracle nodes in the oracle network. All oracle nodes verify and confirm the legitimacy of the target data through a consensus mechanism. That is, each node performs the data acquisition operation according to the data request, then processes and aggregates the acquired data, reaches a consensus on the final result, and then generates a data request result to be returned to the blockchain node that sent the data request.
[0036] Compared to related technologies in this field, the blockchain data request processing method in this embodiment caches the target data of high-frequency requests. When a data request is detected by a blockchain node, the data request is analyzed to determine whether it is a high-frequency data request. For high-frequency data requests, the target data is searched in the data cache, avoiding the need to retrieve data from external data sources for all data requests. For data requests that are determined not to need to be retrieved from the data source (i.e., high-frequency requests), the target data is directly searched from the local data cache, thereby improving the oracle's response speed to blockchain data requests and reducing the oracle's resource consumption.
[0037] It should be noted that the examples described above in this embodiment are merely illustrative for ease of understanding and do not constitute a limitation on the technical solution of the present invention.
[0038] The second embodiment of this invention relates to a blockchain data request processing method. This embodiment is largely the same as the first embodiment, except that: in this embodiment, the method analyzes whether the target data of the data request is high-frequency data based on the data characteristics of historical data requests, including: analyzing the data request based on a request prediction model; wherein, the request prediction model is trained based on the data characteristics of historical data requests, and the request prediction model is used to predict whether the data request is a high-frequency data request or a low-frequency data request; when the data request is a high-frequency data request, it is determined that the target data of the data request is high-frequency data. When the data request is a low-frequency data request, the target data is obtained from an external data source (such as a user-specified data source or other data sources) according to the data request.
[0039] Similar to the first embodiment, this embodiment can also rely on a blockchain network that supports smart contracts (such as Hyperledger Fabric, Ethereum, etc.) as the operating environment to provide external data acquisition services for each node in the blockchain network, which can be called by smart contracts or applications that need external data acquisition services. This can be regarded as a method of implementing a data oracle.
[0040] The blockchain data request processing method in this embodiment will be described in detail below with reference to the accompanying drawings. The blockchain data request processing method in this embodiment is as follows: Figure 2 As shown, it includes:
[0041] Step 201: Listen for data requests from blockchain nodes.
[0042] Step 201 is the same as step 101 in the first embodiment of the present invention. The relevant implementation details have been specifically described in the first embodiment and will not be repeated here.
[0043] Step 202: Analyze the data request based on the request prediction model.
[0044] Step 203: Determine whether the data request is a high-frequency data request or a low-frequency data request; if the data request is a high-frequency data request, then determine that the target data of the data request is high-frequency data and proceed to step 204; if the data request is a low-frequency data request, then determine that the target data of the data request is not high-frequency data and proceed to step 205.
[0045] Specifically, the request prediction analysis model is used to predict whether a data request will request high-frequency data, i.e., whether the data request is a high-frequency data request. High-frequency data requests typically involve multiple requests to the same external data source within a certain timeframe. In this embodiment, a suitable mathematical model is selected, historical data requests are recorded, and appropriate features are selected to train the mathematical model using these historical data requests, resulting in a request prediction model. When a new data request is detected, the data characteristics of the new request (such as user personalization ratio, data source ratio, data content, request event, data type, etc.) are input into the request prediction model. Based on the output of the request prediction model, it is determined whether the data request is a high-frequency data request.
[0046] In one example, since the model training for the request prediction analysis model is a classification of high-frequency and low-frequency requests, a Support Vector Machine (SVM) algorithm with good classification quality is used to classify the requests, which can effectively predict future requests based on the various features of the requests. A natural SVM is a linearly separable two-dimensional classifier. This algorithm uses the feature vectors in the training dataset to create an optimal hyperplane that maximizes the nearest distance from the training samples to the hyperplane. For classification of nonlinear features, it transforms the feature space to a higher dimension, making the features linear, thereby classifying them in a high-dimensional space using a linear classifier. The classification function of the feature vector is shown in equation (1), where x... i These are support vectors, determined through features requested in the data request; y i Encode their category members, a i Here, b is the weighting coefficient, and a is the distance from the hyperplane to the origin. i The values of b are determined during sample training.
[0047]
[0048] Dimensionality increase of feature space is usually achieved using kernel functions, that is, using kernel functions to replace the dot product operation in equation (1) to transform the feature space to a higher dimension. Common kernel functions include polynomial functions, radial basis functions (RBF), and sigmoid functions. Usually, the RBF kernel is more universal, so the RBF kernel function is used to achieve dimensionality increase of feature vectors, as shown in equation (2).
[0049]
[0050] Based on formulas (1) and (2) and historical data requests as training samples, a request prediction and analysis model is trained. In practical applications, relevant information about data requests, such as time, request ratio, field characteristics, and other factors and attributes, can be used as labels to annotate the requests and use them as datasets to train the model, thereby obtaining the corresponding request prediction and analysis model. Furthermore, new requests are continuously used to optimize the model and adjust the relevant parameters.
[0051] In other words, during the oracle's operation, each time a data request is detected from a blockchain node, it is stored in a training database used to store historical data requests. Periodically, the oracle trains and updates the request prediction model based on all data requests in the training database. This update includes dynamically adjusting the threshold used to determine whether a data request is a high-frequency request. In other words, the oracle continuously trains the request prediction model based on new data requests, ensuring that the model can accurately predict whether a currently detected data request is a high-frequency request.
[0052] In one example, when the oracle hears a data request from the blockchain, it decrypts the data request and processes it into a standardized data request. The request information parameters in the standardized data request are standardized parameters that conform to the request prediction model. That is, the request information parameters are decomposed into features, and the decomposed features are mapped into numerical values to form a multidimensional vector suitable for support vector machines. The standardized data request is then added to the request queue for analysis by the request prediction model.
[0053] Step 204: Search for the target data in the data cache and determine if the target data is found. If the target data is found, proceed to step 206; if the target data is not found, proceed to step 205.
[0054] Step 205: Obtain the target data from an external data source.
[0055] Step 206: Return the data request result to the blockchain node.
[0056] Specifically, when a data request is identified as a high-frequency data request, the oracle stores this data in the data cache. It then searches the data cache to see if the target data for the data request exists. When the target data is found in the data cache, it directly generates the data request result and returns it to the blockchain node that is the source of the data request.
[0057] If the target data is not found in the data cache, the target data is retrieved from the external data source according to the data request. After successfully retrieving the target data, the target data is written into the data cache so that it can be retrieved and retrieved by subsequent high-frequency data requests.
[0058] In a specific implementation, this embodiment uses currency exchange rate data as an application scenario for illustration. First, 1000 currency exchange rate data requests are randomly generated according to the actual occurrence probability of various requests. The request data is then statistically analyzed, encoded, and labeled. The request-related information includes: user information, data source API / URL (e.g., the exchange Coinmarketcap), currency conversion (e.g., Ethereum (ETH) / US Dollar (USD), request time period (e.g., 6:00 AM to 12:00 PM), and data source accuracy (e.g., above 99%). The standard for high-frequency repetitive requests is determined based on the probability of the request occurring; in this example, requests exceeding 2% (i.e., more than 20 times) are defined as repetitive requests. Using this embodiment as a specific implementation of an oracle, the specific process of the oracle processing data requests is as follows: Figure 3 As shown, it includes:
[0059] Step 301: Listen for data request events and put the data request into the message queue.
[0060] Specifically, the oracle invokes pre-written smart contract functions on the blockchain platform, inputting request-related information as parameters and generating corresponding request events. After the oracle network detects the request event on the blockchain, it stores the request information parameters and places them in a message queue. In this embodiment, given the known results, we invoke two identical high-frequency recurring requests and one low-frequency request. The request information is: User1 requests ETH / USD exchange rate data with 99% accuracy at 9 AM from Coinmarket, and User1 requests XRP / JPY exchange rate data with 90% accuracy at 9 AM from Truebit.
[0061] Step 302: Analyze the data request and store the data request in the training database.
[0062] Specifically, the request information is used as a parameter to call the prediction function of the pre-trained SVM prediction model to obtain the prediction result. Let's assume 1 represents a predicted high-frequency repetitive request, and 0 represents a predicted non-high-frequency repetitive request. If the prediction result is 1, the hash table is checked to see if the corresponding data for the request information is empty. If it is empty, the information is sent to the oracle network; otherwise, the corresponding data is returned to the encryption module as the result of the request. Conversely, if the prediction result is 0, the data is directly retrieved from the oracle network. In this embodiment, both requests are high-frequency repetitive requests, but in the first request test, the cached hash table will not contain any cached data; it will be added after the oracle network reads the data. In the second request test, the cached hash table will contain the data from the first request, and it will be read directly.
[0063] Step 303: Return the requested data result to the blockchain node.
[0064] Specifically, after receiving the request result information, the oracle encrypts it according to the encryption requirements, calls the interface function, and sends the encrypted information as a parameter to the user on the target blockchain. The blockchain user, upon receiving the information, will send a corresponding receipt. All data is encrypted using flexible encryption algorithms (such as Elliptic Curve Cryptography (ECC)) and receives a receipt from the blockchain.
[0065] Step 304: Perform statistical processing on the information parameters in the data request.
[0066] Specifically, the request information parameters are statistically processed, and five key features—data source request ratio (s1), currency conversion ratio (s2), total request ratio for a given time period (s3), recent time period request ratio (s4), and data source accuracy (s5)—are combined to form a special vector T = (s1, s2, s3, s4, s5) for model training. A classifier is created using the libsvm library in Java, and 1000 labeled request data points are used for model training.
[0067] Step 305: The oracle network reaches a consensus on the results of the data request.
[0068] Specifically, upon receiving a request, each node in the oracle network pulls data from the requested data source and uploads the requested data results to the oracle network. After receiving the requested data pull results from each node, the oracle network processes and aggregates the results, reaches a consensus on the final results, and then returns the requested results to the prediction and data caching module. The prediction and data caching module sends a receipt upon receiving the requested result data.
[0069] Compared to related technologies in this field, the blockchain data request processing method in this embodiment selects a suitable mathematical model to analyze data requests, thereby improving the accuracy of data request analysis. Specifically, the model is trained based on historical data requests and a mathematical model with classification capabilities (such as the SVM algorithm). The monitored data requests are input into the trained request prediction model for analysis to predict whether a data request is for high-frequency data. This improves the accuracy of data request analysis, enabling the oracle to better handle data requests for high-frequency data. Furthermore, the monitored data requests can be stored in a training database for storing historical data requests. The request prediction model is periodically trained and updated based on the data characteristics of all data requests in the training database. This update includes dynamically adjusting the threshold used to determine whether a data request is a high-frequency data request. This further improves the accuracy of the oracle's judgment on high-frequency data requests, ensures the response speed of blockchain data requests, and reduces the oracle's resource consumption.
[0070] The steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.
[0071] The third embodiment of the present invention relates to a blockchain data request processing device, the structure of which is as follows: Figure 4 As shown, it includes:
[0072] The request listening module 401 is used to listen for data requests from blockchain nodes.
[0073] The request analysis module 402 is used to analyze whether the target data of the data request is high-frequency data based on the data characteristics of historical data requests.
[0074] The data acquisition module 403 is used to search for the target data in the data cache when the target data of the data request is high-frequency data. The data cache is used to store high-frequency data.
[0075] The data return module 404 is used to return the data request result to the blockchain node.
[0076] In one example, the data characteristics of historical data requests include one or any combination of the following: user personalization percentage, data source percentage, data content, request event, and data type. The request analysis module 402 is specifically used to analyze the data request based on a request prediction model; wherein, the request prediction model is trained based on the data characteristics of historical data requests, and the request prediction model is used to predict whether the target data of the data request is a high-frequency data request or a low-frequency data request. When the data request is a high-frequency data request, the target data of the data request is determined to be high-frequency data. When the data request is a low-frequency data request, the target data is obtained from an external data source according to the data request.
[0077] In one example, the request listening module 401 is also used to store data requests into a training database for storing historical data requests; the request analysis module 402 periodically trains the request prediction model based on the data characteristics of all data requests in the training database and then updates the request prediction model; wherein, the update of the request prediction model includes dynamically adjusting the threshold in the request prediction model used to determine whether a data request is a high-frequency data request.
[0078] In one example, the data acquisition module 403 is further configured to acquire the target data from an external data source according to the data request when the data request is a low-frequency data request.
[0079] In one example, the data acquisition module 403 is further configured to acquire the target data from an external data source according to the data request when the target data is not found in the data cache.
[0080] In another example, the request listening module 401 is also used to decrypt the data request and process the decrypted data request into a standardized data request; wherein, the request information parameters in the standardized data request are standardized parameters that conform to the request prediction model; and the standardized data request is added to the request queue for analysis by the request prediction model.
[0081] In a specific implementation, the blockchain data request processing device in this embodiment can be regarded as a data oracle, and the structure of the data oracle is as follows: Figure 5 As shown, it includes: a request listening and queuing module 501, a prediction and data caching module 502, an encryption module 503, and a model training module 504.
[0082] The request listening and queuing module 501 is used to listen for requests on various target blockchains, standardize the data format of the transmitted parameters, generate requests according to the standard request format, and store them in the request queue. To protect user privacy from being stolen by users or third parties outside the oracle network, the oracle requires nodes on each blockchain to encrypt the request information parameters according to the encryption method specified by the oracle network before sending a request. The request listening and queuing module decrypts the encrypted information upon receiving it, thus completing the user privacy protection.
[0083] The prediction and data caching module 502 is used to receive requests sent from the request queue and to receive and process data from the request data source returned by the oracle network.
[0084] Specifically, after receiving a request from the request queue, the prediction and data caching modules analyze the request and send it to the model training module for model training, respectively. During the request analysis phase, if the trained model determines that the request is a data request from a duplicate data source for prediction (i.e., a prediction hit), the corresponding data is retrieved from the cache; otherwise, it is considered a low-frequency request, meaning that the data source will not be requested again in the future, and is directly sent to the oracle network for data retrieval. When searching for cached data, if the requested data exists in the cache, the data is sent to the encryption module 503; otherwise, the request is sent to the oracle network.
[0085] To ensure consistency between the cached data of the prediction and data caching modules and the data from external data sources, the modules will clear all cached request results at the end of each time period.
[0086] The oracle network primarily receives requests from the prediction and data caching modules and returns requested data to them. Upon receiving a request, each node in the oracle network pulls data from the requested data source and uploads the resulting data to the oracle network. After receiving the data pull results from each node, the oracle network processes and aggregates the results, reaches a consensus on the final outcome, and then returns the requested result to the prediction and data caching modules.
[0087] The encryption module 503 is used to receive blockchain user requests and corresponding data request results sent by the prediction and data caching module, encrypt them in the manner specified by the user, and return them to the corresponding user.
[0088] The model training module 504 receives requests from the prediction and data caching modules. After collecting requests for one time period, it uses these requests, along with requests from previous time periods, as a dataset for training the prediction model. Since the model training involves classifying high-frequency and low-frequency requests, the Support Vector Machine (SVM) algorithm, known for its high classification quality, is chosen to classify the requests, enabling effective prediction of future requests based on various request features.
[0089] It is not difficult to see that this embodiment is a virtual device embodiment corresponding to the first and second embodiments, and this embodiment can be implemented in conjunction with the first and second embodiments. The relevant technical details mentioned in the first and second embodiments are still valid in the first and second embodiments, and will not be repeated here to reduce repetition. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the first and second embodiments.
[0090] It is worth mentioning that all modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of this invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by this invention; however, this does not mean that other units are absent from this embodiment.
[0091] The fourth embodiment of the present invention relates to a server, such as Figure 6As shown, the system includes: at least one processor 601; and a memory 602 communicatively connected to at least one processor 601. The memory 602 stores instructions executable by at least one processor 601, which, when executed, enable at least one processor 601 to perform the blockchain data request processing method of the first or second embodiment. The memory 602 and processor 601 are connected via a bus, which may include any number of interconnected buses and bridges, connecting various circuits of one or more processors 601 and memory 602 together. The bus may also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be further described herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 601 is transmitted over a wireless medium via an antenna, which further receives data and transmits it to processor 601. Processor 601 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory 602 can be used to store data used by processor 601 during operation.
[0092] The sixth embodiment of this invention relates to a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the above-described method embodiments. That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Those skilled in the art will understand that the above embodiments are specific embodiments for implementing this invention, and in practical applications, various changes in form and detail can be made without departing from the spirit and scope of this invention.
Claims
1. A blockchain data request processing method, characterized in that, include: Listen for data requests from blockchain nodes; Based on the characteristics of historical data requests, analyze whether the target data of the data request is high-frequency data; When the target data of the data request is high-frequency data, the target data is searched in the data cache; wherein, the data cache is used to store high-frequency data; Return the data request result to the blockchain node; The data characteristics of the historical data request include one or any combination of the following: user personalization ratio, data source ratio, data content, request event, and data type; The step of analyzing whether the target data of the data request is high-frequency data based on the data characteristics of historical data requests includes: The data request is analyzed according to the request prediction model; wherein, the request prediction model is trained based on the data characteristics of historical data requests, and the request prediction model is used to predict whether the data request is a high-frequency data request or a low-frequency data request. When the data request is a high-frequency data request, the target data of the data request is determined to be high-frequency data.
2. The blockchain data request processing method according to claim 1, characterized in that, After analyzing the data request based on the request prediction model, the method further includes: When the data request is a low-frequency data request, the target data is obtained from an external data source according to the data request.
3. The blockchain data request processing method according to claim 1, characterized in that, Following the monitoring of data requests from blockchain nodes, the following is also included: The data request is stored in a training database used to save historical data requests; The request prediction model is periodically trained and updated based on the data features of all data requests in the training database. The update of the request prediction model includes dynamically adjusting the threshold in the request prediction model used to determine whether a data request is a high-frequency data request.
4. The blockchain data request processing method according to claim 1, characterized in that, After searching for the target data in the data cache, the method further includes: If the target data is not found in the data cache, the target data is obtained from an external data source according to the data request. Write the target data into the data cache.
5. The blockchain data request processing method according to claim 1, characterized in that, The monitoring of data requests from blockchain nodes includes: The data request is decrypted, and the decrypted data request is processed into a standardized data request; wherein, the request information parameters in the standardized data request are standardized parameters that conform to the request prediction model; The standardized data requests are added to the request queue for analysis by the request prediction model.
6. The blockchain data request processing method according to any one of claims 1 to 5, characterized in that, Before returning the data request result to the blockchain node, the method further includes: The target data is encrypted according to a preset encryption algorithm.
7. A blockchain data request processing device, characterized in that, include: The request listening module is used to listen for data requests from blockchain nodes; The request analysis module is used to analyze whether the target data of the data request is high-frequency data based on the data characteristics of historical data requests. The data acquisition module is used to search for the target data in the data cache when the target data of the data request is high-frequency data; wherein, the data cache is used to store high-frequency data; The data return module is used to return the data request result to the blockchain node; The data characteristics of the historical data request include one or any combination of the following: user personalization ratio, data source ratio, data content, request event, and data type; The request analysis module is also used for: The data request is analyzed according to the request prediction model; wherein, the request prediction model is trained based on the data characteristics of historical data requests, and the request prediction model is used to predict whether the data request is a high-frequency data request or a low-frequency data request. When the data request is a high-frequency data request, the target data of the data request is determined to be high-frequency data.
8. A server, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the blockchain data request processing method as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the blockchain data request processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Processing method and system of data access
CN103177005A
