Data processing method, device and equipment based on block chain and readable storage medium
By monitoring the changes in the blockchain data file of the blockchain node in real time and synchronizing it to the off-chain database, the problem of inconvenience in obtaining blockchain data is solved and the convenience and efficiency of data acquisition are improved.
Patent Information
- Application Number
- CN202311517175.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2025-05-16
AI Technical Summary
In the prior art, data acquisition in blockchain requires frequent call to interfaces, resulting in inconvenient data acquisition and inefficient efficiency.
By obtaining the operating characteristics of blockchain nodes, creating node monitoring scripts, monitoring changes in block data files in real time, and synchronizing new blocks in the on-chain ledger to the off-chain database.
Real-time synchronization of on-chain data to off-chain database is realized, which improves the convenience and efficiency of data acquisition and avoids the tedious process of frequent call to interfaces.
Smart Images

Figure CN120011442A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a blockchain-based data processing method, device, equipment, and readable storage medium. Background Art
[0002] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. It is mainly used to organize data in chronological order and encrypt it into a ledger to make it impossible to be tampered with or forged. It can also verify, store, and update data.
[0003] For the data stored in the blockchain (such as transaction data), when the data analysis object (such as a user) has data analysis needs, the data analysis object needs to obtain detailed transaction data from the blockchain by calling the remote procedure call (rpc) interface, and then perform data analysis on the obtained data.
[0004] However, this method of calling the interface to obtain transaction data from the blockchain requires an interface call to be made each time transaction data is obtained, which is very inconvenient for data acquisition and will also have a certain impact on data analysis efficiency. Summary of the invention
[0005] The embodiments of the present application provide a blockchain-based data processing method, apparatus, device, and readable storage medium, which can synchronize on-chain data to an off-chain database in real time, thereby improving the convenience of data acquisition.
[0006] On the one hand, an embodiment of the present application provides a data processing method based on blockchain, including:
[0007] Obtaining a node operation characteristic reflecting an operation attribute of the first blockchain node;
[0008] Performing script creation processing on the first blockchain node according to the node operation characteristics to obtain a node monitoring script of the first blockchain node;
[0009] The block data file of the first blockchain node is monitored in real time by the node monitoring script; the block data file of the first blockchain node is used to record the data of the blocks stored in the on-chain account book of the first blockchain node;
[0010] When a change is detected in the block data file of the first blockchain node, it is determined that a new block exists in the on-chain account book of the first blockchain node, and the new block in the on-chain account book of the first blockchain node is synchronized to the off-chain database.
[0011] On the one hand, an embodiment of the present application provides a data processing device based on blockchain, including:
[0012] A feature acquisition module, used to acquire a node operation feature for reflecting an operation attribute of the first blockchain node;
[0013] A script creation module, used to perform script creation processing on the first blockchain node according to the node operation characteristics, to obtain a node monitoring script of the first blockchain node;
[0014] A file monitoring module, used to monitor the block data file of the first blockchain node in real time through the node monitoring script; the block data file of the first blockchain node is used to record the data of the block stored in the on-chain account book of the first blockchain node;
[0015] The block synchronization module is used to determine the presence of a new block in the on-chain account book of the first blockchain node when a change is detected in the block data file of the first blockchain node, and synchronize the new block in the on-chain account book of the first blockchain node to the off-chain database.
[0016] In one embodiment, the script creation module performs script creation processing on the first blockchain node through the node operation characteristics to obtain a specific implementation method of the node monitoring script of the first blockchain node, including:
[0017] Obtain a monitoring script template set; each monitoring script template in the monitoring script template set is configured with a logic code for real-time monitoring of changes in a block data file; the block data file is used to record the data of the block stored in the on-chain ledger of the blockchain node in the blockchain; the blockchain node in the blockchain includes a first blockchain node;
[0018] According to the script adaptation rule, determine the monitoring script template adapted to the node operation characteristics from the monitoring script template set;
[0019] Obtaining a node identifier of a first blockchain node;
[0020] The node identifier of the first blockchain node is integrated with a monitoring script template adapted to the node operation characteristics to obtain a node monitoring script of the first blockchain node.
[0021] In one embodiment, the node operation feature includes the node occupied computing power of the first blockchain node; the script adaptation rule refers to the computing power adaptation rule associated with the node occupied computing power; the monitoring script template set includes the monitoring script template S i , i is a positive integer;
[0022] The script creation module determines the specific implementation of the monitoring script template adapted to the node operation characteristics from the monitoring script template set according to the script adaptation rule, including:
[0023] According to the computing power adaptation rule, obtain the monitoring script template S in the monitoring script template set i The amount of script code included;
[0024] Perform power analysis on the script code volume to determine the monitoring script template S i The required computing power;
[0025] When the required computing power required for each monitoring script template in the monitoring script template set is determined, the required computing power in the required computing power set is compared and analyzed by the node occupied computing power to obtain the optimal required computing power in the required computing power set;
[0026] The monitoring script template indicated by the optimal required computing power in the monitoring script template set is determined as the monitoring script template adapted to the node operation characteristics.
[0027] In one embodiment, the script creation module compares and analyzes the required computing power in the required computing power set by the node occupied computing power, and obtains the specific implementation method of the optimal required computing power in the required computing power set, including:
[0028] Obtain the total node computing power of the first blockchain node;
[0029] Determine a first computing power difference between the total computing power of the node and the computing power occupied by the node, and determine the first computing power difference as the node remaining computing power of the first blockchain node;
[0030] Filter the required computing power in the required computing power set that is greater than the remaining computing power of the node to obtain a filtered required computing power set;
[0031] Determine the optimal required computing power from the filtered required computing power set based on the node's remaining computing power.
[0032] In one embodiment, the specific implementation method of the script creation module determining the optimal required computing power from the filtered required computing power set based on the node remaining computing power includes:
[0033] Determine and filter the second computing power difference between each required computing power and the remaining computing power of the node in the required computing power set to obtain a second computing power difference set;
[0034] Obtaining a minimum value in the second computing power difference value set, and determining the minimum value in the second computing power difference value set as the optimal computing power difference;
[0035] The required computing power indicated by the optimal computing power difference in the filtered required computing power set is determined as the optimal required computing power.
[0036] In one embodiment, the node operation characteristics include a data processing type of the first blockchain node; the script adaptation rule refers to a type adaptation rule associated with the data processing type;
[0037] The script creation module determines the specific implementation of the monitoring script template adapted to the node operation characteristics from the monitoring script template set according to the script adaptation rule, including:
[0038] According to the type adaptation rule, the configuration data type indicated by each monitoring script template in the monitoring script template set is obtained to obtain a configuration data type set;
[0039] Determine the configuration data type that matches the data processing type of the first blockchain node in the configuration data type set as the matching data type;
[0040] The monitoring script template indicated by the matching data type in the monitoring script template set is determined as the monitoring script template adapted to the node operation characteristics.
[0041] In one embodiment, the script creation module fuses the node identifier of the first blockchain node with the monitoring script template adapted to the node operation characteristics to obtain a specific implementation of the node monitoring script of the first blockchain node, including:
[0042] In a monitoring script template adapted to the node operation characteristics, obtain identification parameters and fill in fields;
[0043] In the Identification Parameter Fill-in field, write the node identification of the first blockchain node;
[0044] The monitoring script template into which the node identifier of the first blockchain node is written is determined as the node monitoring script of the first blockchain node.
[0045] In one embodiment, the specific implementation method of the block synchronization module synchronizing the newly added block in the on-chain ledger of the first blockchain node to the off-chain database includes:
[0046] In the on-chain ledger of the first blockchain node, block data contained in the newly added block is obtained;
[0047] The block data contained in the newly added block is synchronized to the off-chain database in parallel.
[0048] In one embodiment, the number of off-chain databases is N, where N is a positive integer;
[0049] The specific implementation method of the block synchronization module synchronizing the newly added blocks in the on-chain ledger of the first blockchain node to the off-chain database includes:
[0050] Obtain the data processing type of the first blockchain node and the configuration service type of each of the N off-chain databases;
[0051] Determine, among the N configuration service types, a configuration service type that matches the data processing type of the first blockchain node as a matching service type;
[0052] Determine the off-chain database indicated by the matching service type among the N off-chain databases as the target database;
[0053] Synchronize the newly added blocks in the on-chain ledger of the first blockchain node to the target database.
[0054] In one embodiment, after the block synchronization module synchronizes the newly added block in the on-chain account book of the first blockchain node to the off-chain database, the blockchain-based data processing device further includes:
[0055] A request receiving module is used to receive a transaction analysis request sent by a data analysis object; the transaction analysis request is used to request transaction analysis of the transaction data to be analyzed;
[0056] The transaction acquisition module is used to obtain the transaction data to be analyzed from the off-chain database based on the transaction analysis request;
[0057] A transaction analysis module is used to perform transaction analysis on the transaction data to be analyzed according to the transaction analysis rules to obtain the transaction analysis results of the transaction data to be analyzed;
[0058] The result return module is used to return the transaction analysis results to the data analysis object.
[0059] In one embodiment, the transaction type of the transaction data to be analyzed is a resource transfer type;
[0060] The transaction analysis module performs transaction analysis on the transaction data to be analyzed according to the transaction analysis rules, and obtains the specific implementation method of the transaction analysis results of the transaction data to be analyzed, including:
[0061] According to the transaction analysis rules, the resource transfer amount indicated by the transaction data to be analyzed is obtained;
[0062] comparing the resource transfer amount to a transfer threshold;
[0063] If it is determined that the resource transfer amount is greater than the transfer threshold, the transaction analysis result of the transaction data to be analyzed is determined to be a transaction unqualified result;
[0064] If it is determined that the resource transfer amount is less than the transfer threshold, the transaction analysis result of the transaction data to be analyzed is determined to be a qualified transaction result.
[0065] An embodiment of the present application provides a computer device, including: a processor and a memory;
[0066] The memory stores a computer program, and when the computer program is executed by the processor, the processor executes the method in the embodiment of the present application.
[0067] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the method in the embodiment of the present application is executed.
[0068] In one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method provided in one aspect of the embodiments of the present application.
[0069] In an embodiment of the present application, for a certain blockchain node (such as the first blockchain node), a script creation process can be performed through the node operation characteristics of the first blockchain node, thereby obtaining a node monitoring script of the first blockchain node, and the changes in the block data file of the first blockchain node can be monitored in real time through the node monitoring script. Among them, the block data file is used to record the data of the blocks stored in the on-chain account book of the first blockchain node, so once the block data file of the first blockchain node is monitored to change, it can be determined that there are new blocks on the on-chain account book of the first blockchain node, and then the new blocks can be synchronized to the off-chain database in a timely manner. It should be understood that this application creates a node monitoring script for a blockchain node based on the node operation characteristics of the blockchain node, so that the created node monitoring script can be in line with the operation properties of the blockchain node. The node monitoring script that conforms to the node operation properties can monitor the block data file of the blockchain node in real time, and then synchronize the on-chain storage data of the blockchain node (the block stored in the on-chain account book) to the off-chain database in real time. Based on this, the acquisition of on-chain storage data can be converted to acquisition in the off-chain database. For objects that have acquisition requirements for on-chain storage data, there is no need to call the relevant interface to obtain relevant data from the chain. It only needs to directly consult the off-chain database, which can greatly improve the convenience of on-chain data acquisition. In summary, this application can realize the real-time synchronization of on-chain data to the off-chain database, and through the real-time nature of data synchronization, the on-chain data acquisition can be converted to off-chain data acquisition, which can improve the convenience of on-chain data acquisition. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0071] Figure 1 This is a network architecture diagram provided by an embodiment of the present application;
[0072] Figure 2 It is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application;
[0073] Figure 3 This is a schematic diagram of a scenario of synchronizing on-chain data to off-chain provided in an embodiment of the present application;
[0074] Figure 4 It is a flowchart of creating a node monitoring script for a blockchain node provided by an embodiment of the present application;
[0075] Figure 5 It is a structural schematic diagram of a blockchain-based data processing device provided in an embodiment of the present application;
[0076] Figure 6 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0077] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0078] The method provided in the embodiment of the present application involves blockchain and other related technologies. For ease of understanding, the following will give priority to blockchain and its related technologies:
[0079] 1. Blockchain: In a narrow sense, blockchain is a chain data structure with blocks as the basic unit. The digital summary is used in the block to verify the transaction history previously obtained, which is suitable for the needs of tamper-proof and scalability in the distributed accounting scenario; in a broad sense, blockchain also refers to the distributed accounting technology implemented by the blockchain structure, including distributed consensus, privacy and security protection, peer-to-peer communication technology, network protocols, smart contracts, etc. The goal of the blockchain is to realize a distributed data record book, which only allows additions but not deletions. The basic structure of the underlying ledger is a linear linked list. The linked list is composed of "blocks" connected in series, and the hash value of the previous block is recorded in the subsequent block. Whether each block (and the transactions in the block) is legal can be quickly verified by calculating the hash value. If a node in the network proposes to add a new block, it must reach a consensus on the block through the consensus mechanism.
[0080] 2. Blockchain nodes: The blockchain network divides nodes into consensus nodes (also called core nodes), data nodes or light nodes. Among them, the consensus node is responsible for the consensus business of the entire blockchain network; the data node or light node is responsible for synchronizing the ledger information of the consensus node, that is, synchronizing the latest block data. Whether it is a consensus node or a data node (or light node), its internal structure includes network communication components, because the blockchain network is essentially a point-to-point network, and it needs to communicate with other nodes in the blockchain network through related components. The resources and services in the blockchain network are scattered on each node, and the transmission of information and the implementation of services are directly carried out between nodes, without the intervention of intermediate links or centralized servers (third parties).
[0081] 3. Hash value: Also known as information characteristic value or characteristic value, hash value is generated by converting input data of any length into a password and performing fixed output through a hash algorithm. The original input data cannot be retrieved by decrypting the hash value. It is a one-way encryption function. In the blockchain, each block (except the initial block) contains the hash value of the previous block, which is called the parent block of the current block. Hash value is the potential core foundation and the most important aspect of blockchain technology. It retains the authenticity of recorded and viewed data, as well as the integrity of the blockchain as a whole.
[0082] 4. Smart Contract: It is a computer protocol designed to disseminate, verify or execute contracts in an information-based manner. In the blockchain system, a smart contract (referred to as a contract) is a code that can be understood and executed by each node of the blockchain, which can execute any logic and obtain results. In practical applications, smart contracts are managed and tried through transactions on the blockchain. Each transaction is equivalent to a remote procedure call (RPC) request to the blockchain system. If a smart contract is equivalent to an executable program, the blockchain is equivalent to an operating system that provides an operating environment. The blockchain can contain multiple contracts, which are distinguished by contract accounts (Identity, ID), identification numbers or names. For example, a smart contract can include a governance consensus committee contract, which is mainly used to manage consensus nodes, and can include recording the node status of consensus nodes, dynamically adding consensus nodes, and removing abnormal consensus nodes.
[0083] See also Figure 1 , Figure 1 This is a network architecture diagram provided by an embodiment of the present application. Figure 1 As shown, the network architecture may include a terminal device cluster 10 and a blockchain network, and the blockchain network may include a core node (consensus node) cluster 1000 and a data node or light node cluster 100. The core node cluster 1000 may include at least two core nodes, and the data node cluster 100 may include at least two data nodes. Figure 1 As shown, the core node cluster 1000 may include core node 1000a, core node 1000b, ..., core node 1000n, the data node cluster 100 may specifically include data node 100a, data node 100b, ..., data node 100n, and the terminal device cluster 10 may specifically include terminal device 10a, terminal device 10b, ..., terminal device 10n.
[0084] like Figure 1As shown, terminal device 10a, terminal device 10b, ..., terminal device 10n can respectively establish network connection with data node 100a, data node 100b, ..., data node 100n, so that the terminal device can exchange data with the data node through the network connection; data node 100a, data node 100b, ..., data node 100n can respectively establish network connection with core node 1000a, core node 1000b, ..., core node 1000n, so that the data node can exchange data with the core node through the network connection; data node 100a, data node 100b, ..., data node 100n are connected to each other, so that data nodes can exchange data with each other, and core node 1000a, core node 1000b, ..., core node 1000n are connected to each other, so that core nodes can exchange data with each other.
[0085] Taking the terminal device 10a, the data node 100a and the core node 1000a as an example, the data node 100a can receive a transaction service request sent by the terminal device 10a (the transaction service request carries the ID or name of the smart contract), and then the data node 100a can send the transaction service request to the core node 1000a through the data node cluster 100; the core node 1000a can run the smart contract and execute the transaction service through the smart contract. After obtaining the execution result, the execution result can be stored in the memory pool (such as the transaction pool), and a new block can be generated according to the execution result; then, the core node 1000a can send the newly generated blocks to other core nodes in the blockchain network where it is located according to the node identifiers of other core nodes (i.e., consensus nodes) in the blockchain network, and other core nodes will verify the newly generated blocks (i.e., reach consensus), and add the newly generated blocks to the blockchain stored thereafter (that is, the execution results are stored in the blockchain after the consensus is passed). Among them, each core node in the blockchain network has a corresponding node identifier, and each core node in the blockchain network can store the node identifiers of other core nodes in the blockchain network, so that the generated blocks can be broadcast to other core nodes in the blockchain network according to the node identifiers of other core nodes, so that the data stored on all core nodes in the blockchain network are consistent.
[0086] Among them, Figure 1The terminal device shown can be a desktop terminal or mobile terminal used by the business party that generates transaction information, and can be a smart terminal with data processing functions such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, a smart speaker, a desktop computer, a smart watch, a smart car terminal, etc., but is not limited to this. The transaction information (transaction data) generated by the terminal device can be transmitted to the consensus node via a data node or a light node after user authorization, and the consensus node can record the transaction information (transaction data) generated by the terminal device on the blockchain. Any data node in the data node cluster 100 can be implemented with an independent server or a server cluster composed of multiple servers, and any core node in the core node cluster 1000 can be implemented with an independent server or a server cluster composed of multiple servers.
[0087] It can be understood that the transaction business of the terminal device can be understood as transaction data. The main form of storing transaction data in the blockchain is: the transaction data is passed to the consensus node in the form of a baton, and the consensus node then verifies the received transaction data. After the transaction verification is passed, it can be added to its own transaction pool. After adding the transaction data to its own transaction pool, the consensus node can broadcast the transaction data to other consensus nodes in the blockchain, and other consensus nodes will also verify the transaction data, and then verify the transaction data again. After the verification is passed, the transaction data can be added to its own transaction pool. Further, for each consensus node, when receiving a block signal (a block signal can refer to a block signal issued by a timer or a block signal issued by a transaction pool), the consensus node can obtain a batch of transaction data from the transaction pool to package and generate blocks (i.e., package transaction data to generate blocks). The generated blocks need to be broadcast to each consensus node so that all consensus nodes can perform consensus verification on the newly generated blocks. After passing the consensus of each consensus node, the blocks can be added to the blockchain.
[0088] It should be understood that for the data (transaction data) stored on the blockchain, when an external object (such as a user, an intelligent robot) has a need to obtain the on-chain data, it is necessary to call the relevant interface (such as the RPC interface) to read or obtain it from the blockchain. Each time the transaction data is obtained from the blockchain, the interface needs to be called once. This method is very cumbersome. In order to improve the convenience of obtaining on-chain data of the blockchain, this application provides a method for synchronizing off-chain data. Through the method provided by this application, the blocks stored in the on-chain ledger of the blockchain node in the blockchain can be synchronized to the off-chain database in real time. Then, the on-chain data of the blockchain can be directly obtained from the off-chain database without calling the interface multiple times. At the same time, the method provided by this application can synchronize the on-chain data to the off-chain database in real time without delay, thereby ensuring that the data stored in the off-chain database is consistent with the data stored on the chain, so the data obtained from the off-chain database is also complete, recorded and traceable.
[0089] Specifically, taking a certain blockchain node in the blockchain (which may be referred to as the first blockchain node) as an example, for the first blockchain node, the present application may first obtain a node operation feature used to characterize the operation attributes of the first blockchain node. The operation attributes here may be understood as the operation state, and the node operation feature may refer to a feature used to characterize the operation state (operation performance) of the blockchain node. Node operation features include, for example, the computing power occupied by the node (the computing power occupied by the node may reflect the computing performance of the blockchain node when it is running), the node storage space (the storage performance of the blockchain node when it is running may be reflected through the node storage space), the data processing type of the node (that is, the type of transaction data that the first blockchain node is responsible for processing, and the data processing type of the node may reflect the type of transaction data that the blockchain node can process when it is running, that is, it may reflect the node processing performance of the blockchain node), and the like. Through the node operation characteristics, the present application can perform script creation processing, so as to obtain the node monitoring script of the first blockchain node, wherein the node monitoring script in the present application should be configured with a monitoring script with a logic code for real-time monitoring of the block data file of the first blockchain node (a file for recording the data of the block stored in the on-chain account book of the first blockchain node. The maximum block height of the block currently stored by the first blockchain node can be clearly and intuitively clarified through the block data file. The relevant data of all blocks stored in the on-chain account book of the first blockchain node (such as block height, block number, etc.) will be recorded in the block data file). The block data file of the first blockchain node can be monitored in real time through the node monitoring script. At the same time, since the node monitoring script is created and generated through the node operation characteristics of the first blockchain node, the node monitoring script is in line with the operation status of the first blockchain node, and can be deployed to the first blockchain node for real-time monitoring of the block data file of the first blockchain node.
[0090] It should be noted that once the block data file of the first blockchain node is monitored to have changed, it can be determined that there is a new block in the on-chain account book of the first blockchain node, and the new block in the on-chain account book of the first blockchain node can be synchronized to the off-chain database. After that, the external object can obtain certain transaction data from the off-chain database for transaction analysis or transaction verification, etc., without calling the relevant interface to obtain transaction data from the blockchain.
[0091] It is understandable that the terminal device of the present application may be installed with a target application (ie, an application client). When the application client runs in the terminal device, it may be compatible with the above-mentioned Figure 1Data is exchanged between other blockchain nodes in the blockchain network shown. Among them, the application client may include multimedia clients (for example, video clients), entertainment clients (for example, game clients), education clients, live broadcast clients and other application clients. Among them, the application client can be an independent client, or it can be an embedded sub-client integrated in a client (for example, an education client and a multimedia client, etc.), which is not limited here. In this application, a blockchain node may refer to a server, which can exchange data with a terminal device through an application in the terminal device (such as a server can receive business data of an application in the terminal device (such as transaction data generated by a user), and the server can process these business data and upload them to the chain). The server here can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and basic cloud computing services such as big data and artificial intelligence platforms.
[0092] It is understandable that the method provided in the embodiment of the present invention can be executed by a computer device, including but not limited to a terminal device or a server (such as a business server). The blockchain node in the embodiment of the present invention can be a computer device.
[0093] It should be noted that in the specific implementation of the present application, data related to user information, user data (such as transaction information initiated by users, transaction data, requests for obtaining certain transaction data, and transaction analysis requests initiated by users mentioned later) are all subject to manual authorization by the user (i.e., user consent) before they can be obtained. In other words, when the above embodiments of the present application are applied to specific products or technologies, the methods and related functions provided by the embodiments of the present application are operated with the permission or consent of the user (the functions provided by the embodiments of the present application can be actively enabled by the user), and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of the relevant regions and areas.
[0094] The embodiments of the present application can be applied to various scenarios, including but not limited to gaming scenarios, financial scenarios, cloud technology, artificial intelligence, smart transportation, assisted driving, etc. For ease of understanding, the blockchain-based data processing method provided by the embodiments of the present application will be described in detail in conjunction with the accompanying drawings. Figure 2 , Figure 2 This is a flowchart of a data processing method based on blockchain provided by an embodiment of the present application. The process can be executed by a computer device, which can be Figure 1The terminal device shown in the figure may also be a background server corresponding to the target application, or may be Figure 1 The blockchain nodes (such as core nodes) shown. Figure 2 As shown, the process may include at least the following steps S101 to S104:
[0095] Step S101, obtaining node operation characteristics for reflecting the operation attributes of the first blockchain node.
[0096] In this application, the first blockchain node may refer to any blockchain node in the blockchain, for example, the first blockchain node may refer to a core node in the blockchain. The node operation characteristics of the first blockchain node may refer to the characteristics used to reflect the operation attributes of the first blockchain node, or the node operation characteristics may refer to the characteristics used to reflect the operation performance or operation status of the first blockchain node (that is, the operation attributes may be understood as operation performance). For example, the node remaining computing power of the first blockchain node can be calculated by the node occupied computing power of the first blockchain node, and the computing performance of the first blockchain node can be evaluated by the node remaining computing power (such as the more node remaining computing power, the better the computing performance), and the computing performance of the first blockchain node is also the operation performance of the first blockchain node, then the node occupied computing power of the first blockchain node can be used as a node operation feature of the first blockchain node. Among them, it should be noted that the computing power in this application may refer to the computing power of the first blockchain node. In this application, the measurement of the computing power of the first blockchain node can usually be measured by the central processing unit (CPU) computing power and the graphics processing unit (GPU) computing power. Among them, CPU computing power is generally measured by the number of operations per second (OPS); GPU computing power can have a variety of measurement indicators according to the type of calculation, generally measured by two indicators: computing power (according to the type of calculation, measured by the number of floating-point operations per second (FLOPS), OPS, half-precision peak computing power and double-precision peak computing power) and data read throughput. For computing power resources, in addition to CPU computing power resources and CPU computing power resources, of course, other computing power resources can also be included, such as memory resources, network bandwidth resources, disk resources, etc. This application does not limit the content of computing power resources. In the subsequent writing, this application will take the example of computing power resources including CPU computing power resources for explanation.
[0097] For another example, the remaining storage space of the first blockchain node can be calculated through the used storage space of the first blockchain node, and the storage performance of the first blockchain node can be evaluated through the remaining storage space (e.g., the more remaining storage space, the more content the first blockchain node can store, and the better the storage performance of the first blockchain node), and the storage performance of the first blockchain node is also the operating performance of the first blockchain node, so the used storage space of the first blockchain node can also be used as a node operating feature of the first blockchain node. For another example, the data processing type of the first blockchain node (which can be understood as the type of transaction data that the first blockchain node is responsible for processing) can be used to evaluate the data processing performance of the first blockchain node (e.g., the richer or more complex the type of transaction data that the first blockchain node is responsible for processing, the more general the first blockchain node is, and the better the data processing performance of the first blockchain node is), and the data processing performance of the first blockchain node is also the operating performance of the first blockchain node, so the data processing type of the first blockchain node can also be used as a node operating feature of the first blockchain node.
[0098] In summary, the node operation characteristics in the present application may specifically refer to a certain characteristic used to reflect the operation performance of the first blockchain node, which may include the node occupied computing power, data processing type, used storage space, etc. of the first blockchain node. Of course, the node operation characteristics of the first blockchain node are not limited to this. The above-mentioned node occupied computing power, data processing type, and used storage space are only an exemplary explanation made for ease of understanding.
[0099] Step S102: Perform script creation processing on the first blockchain node through the node operation characteristics to obtain a node monitoring script of the first blockchain node.
[0100] In the present application, based on the node operation characteristics of the first blockchain node, a node monitoring script adapted to the operation performance of the first blockchain node can be created for the first blockchain node, and the node monitoring script is configured with a logic code for real-time monitoring of file changes of the block data file of the first blockchain node, so by running the node monitoring script, the changes of the block data file of the first blockchain node can be monitored in real time. Among them, the block data file of the first blockchain node is used to record the data of the blocks stored in the chain account book of the first blockchain node. Every time a new block is added to the chain account book of the first blockchain node, the block data file will be modified and updated accordingly. Based on this, through the changes in the block data file of the first blockchain node, it can be determined whether a new block is stored in the chain account book of the first blockchain node. If there is a change in the block data file, then the new block is stored in the chain account book of the first blockchain node.
[0101] It can be understood that, based on the above, the node operation characteristics in this application include node occupied computing power, used storage space, and data processing type, etc., and when creating a node monitoring script for the first blockchain node, this application can also create different node monitoring scripts according to the different node operation characteristics of the first blockchain node. Specifically, this application can pre-configure different monitoring script templates, each monitoring script template contains a logic code for real-time monitoring of changes in the block data file of the blockchain node in the blockchain, and the amount of script code contained in each two monitoring script templates can be different from each other, and due to the difference in the amount of script code, the computing power required to run different monitoring script templates is also different. Based on this, when creating a node monitoring script for the first blockchain node, the node occupied computing power of the first blockchain node can be analyzed according to the monitoring script template, which monitoring script template is most suitable for the node remaining computing power of the first blockchain node. After finding the most suitable monitoring script template, the relevant parameters of the first blockchain node can be filled in and merged with the most suitable monitoring script template, thereby generating a node monitoring script for real-time monitoring of the block data file of the first blockchain node.
[0102] Of course, the above is a method of creating a node monitoring script according to the node operation feature of the first blockchain node, that is, the node occupation of computing power. For other node operation features of the first blockchain node, the present application may also adopt certain rules to select the monitoring script template that best suits the operation performance of the first blockchain node (that is, the monitoring script template that best suits the node operation feature) from various monitoring script templates, and then merge the relevant parameters of the first blockchain node (such as the node identifier of the first blockchain node) with the monitoring script template to generate a node monitoring script for real-time monitoring of the block data file of the first blockchain node.
[0103] It can be understood that the present application can make each monitoring script template have the ability to monitor files in real time (that is, have the ability to monitor the block data files of blockchain nodes in real time) and adapt to blockchain nodes with different operating performances by pre-creating different monitoring script templates. Then, when it is expected to monitor the block data files of a certain blockchain node in real time, the monitoring script template that is most suitable for the operating performance of the blockchain node can be quickly matched based on the node operating characteristics of the blockchain node, so that the node monitoring script for real-time monitoring of the block data files of the blockchain node can be quickly integrated and generated, which can greatly improve the script generation efficiency of the node monitoring script; in addition, since the node monitoring script is generated according to the node operating characteristics of the blockchain node, the node monitoring script is also generated under the support of the operating performance of the blockchain node, so the node monitoring script can be deployed and run to monitor the changes of the block data files of the blockchain node in real time.
[0104] It should be understood that in this application, different script adaptation rules can be selected according to different node operation characteristics, and a monitoring script template adapted to the first blockchain node can be selected from various monitoring script templates according to the script adaptation rules. Further, the monitoring script template of the first blockchain node can be integrated to generate a node monitoring script of the first blockchain node. For its specific implementation method, please refer to the subsequent Figure 4 The description in the corresponding embodiment, that is, the specific method of performing script creation processing on the first blockchain node through the node operation characteristics to obtain the node monitoring script of the first blockchain node can be referred to in the subsequent Figure 4 The description in the corresponding embodiment.
[0105] Step S103, real-time monitoring of the block data file of the first blockchain node is performed through a node monitoring script; the block data file of the first blockchain node is used to record the data of the blocks stored in the on-chain ledger of the first blockchain node.
[0106] In the present application, it can be seen from the above that each monitoring script template configured and created has the ability to monitor the block data files of the blockchain node in real time. Then the node monitoring script generated by a certain monitoring script template also has the ability to monitor the block data files of the first blockchain node in real time. Here, the block data files of the first blockchain node can be monitored in real time through the node monitoring script to detect whether there are any changes in the block data files.
[0107] Step S104, when a change is detected in the block data file of the first blockchain node, it is determined that there is a new block in the on-chain account book of the first blockchain node, and the new block in the on-chain account book of the first blockchain node is synchronized to the off-chain database.
[0108] In the present application, the block data file of the first blockchain node may refer to the file modification time of the block data file (the time of modifying the block data file) having an updated change, or may refer to the change in the file size of the block data file. Specifically, since the block data file of the first blockchain node is a file for recording the data of all blocks stored in the on-chain account book of the first blockchain node (such as the block height of each block), if a new block is stored in the on-chain account book of the first blockchain node, the block data file will also be modified and updated accordingly to record the relevant data of the new block, and each time the block data file is modified, its corresponding file modification time will also be updated accordingly. Based on this, it can be known that when the file modification time of the block data file is updated, it can be considered that the block data file has been modified, and then it can be considered that a new block is stored in the on-chain account book of the first blockchain node (i.e., there is a newly added block). Similarly, the file size of the block data file is used to reflect the amount of data recorded in the block data file. The larger the block data file is, the more data it records. If the file size of the block data file is updated, it can be considered that the block data file has new data, and then it can be determined that a new block is stored in the on-chain ledger of the first blockchain node (i.e., there is a new block).
[0109] Based on the above, once a change is detected in the block data file of the first blockchain node, it can be determined that there is a new block in the on-chain ledger of the first blockchain node. At this time, the new block in the on-chain ledger of the first blockchain node can be synchronized to the off-chain database in a timely manner.
[0110] It should be noted that there may be multiple (two or more) newly added blocks in the on-chain ledger of the first blockchain node, and in order to improve the efficiency of synchronizing on-chain data to off-chain, the present application can synchronize multiple newly added blocks in parallel, that is, it is not necessary to perform serial synchronization according to the block height of each newly added block (i.e., first synchronize the newly added blocks with smaller block heights, and after the synchronization is completed, the newly added blocks indicated by the next block height). The specific method of synchronizing the newly added blocks in the on-chain ledger of the first blockchain node to the off-chain database can be: the block data contained in the newly added blocks can be obtained in the on-chain ledger of the first blockchain node; further, the block data contained in the newly added blocks can be synchronized in parallel to the off-chain database.
[0111] It can be understood that synchronizing blocks to off-chain databases mainly involves synchronizing the block data of blocks to off-chain databases. The block data may include transaction data, transaction receipts, transaction lists, status data, etc. in the blocks, and the data stored in the off-chain database in this application (block data of each block) can be used for external objects (i.e. objects outside the blockchain, such as external users) to consult, and external objects can consult certain transaction data from the off-chain database to perform transaction analysis or other transaction processing. In order to improve the data reading efficiency in the off-chain database, this application can configure different off-chain databases according to the data processing types of different blockchain nodes. An off-chain database can be used to store block data of a transaction type. Here, the transaction type of transaction data stored by the off-chain database can be called a configuration service type. By making a one-to-one correspondence between the configuration service type and the off-chain database, the transaction data of the same transaction type can be synchronized to an off-chain database for storage. Based on this, when there is a need for data consultation, the corresponding off-chain database can be traversed and queried according to the transaction type of the transaction data, without traversing all the transaction data, thereby improving the data query efficiency.
[0112] That is to say, the number of off-chain databases in the present application can be multiple (such as N, where N is a positive integer), and the specific method of synchronizing the newly added blocks in the on-chain ledger of the first blockchain node to the off-chain database can be: the data processing type of the first blockchain node and the configuration service type of each off-chain database in the N off-chain databases can be obtained (the configuration service type of the off-chain database can be understood as the transaction type configured for the off-chain database and responsible for storing transaction data); further, the configuration service type among the N configuration service types that matches the data processing type of the first blockchain node can be determined as the matching service type; the off-chain database indicated by the matching service type in the N off-chain databases can be determined as the target database; further, the newly added blocks in the on-chain ledger of the first blockchain node can be synchronized to the target database.
[0113] It should be noted that the purpose of configuring multiple off-chain databases in this application is to improve the efficiency of reading transaction data from the off-chain database. The off-chain database can also be configured as one, and one off-chain database stores the block data of different blockchain nodes on the blockchain. However, since the data stored in the on-chain ledgers of different blockchain nodes on the blockchain needs to be consistent, the block data synchronized to the off-chain database may be block data of the same block from different blockchain nodes. Therefore, in order to save storage space, before synchronizing the newly added blocks of a certain blockchain node to the off-chain database, it is possible to first detect whether the block data of the same block already exists in the off-chain database. If the block data of the block already exists, then repeated synchronization is no longer required.
[0114] Based on the above, it can be seen that since the data stored in the on-chain ledgers of different blockchain nodes on the blockchain need to maintain consistency, the present application can also timely detect whether there are blockchain nodes with lagging data by configuring different off-chain databases. For example, if a blockchain node is responsible for processing transaction data of a transaction type, and an off-chain database is responsible for storing transaction data of a transaction type, then it is equivalent to an off-chain database storing the data of the blocks of a blockchain node. Based on this, taking the first blockchain node as an example, assuming that the block data of the first blockchain node is synchronized to the corresponding off-chain database in real time, the off-chain database can be compared with the off-chain databases of other blockchain nodes to compare whether the transaction data stored in the off-chain database is consistent. If the data stored in the off-chain database of the first blockchain node is less than the data in other off-chain databases, it can be considered that the blocks stored in the on-chain ledger of the first blockchain node are behind, and the first blockchain node can be notified in time to synchronize the lagging blocks from other blockchain nodes on the blockchain to the local to keep the data stored by all blockchain nodes on the chain consistent.
[0115] Optionally, in a feasible embodiment, the computer device of the present application can also be configured with different transaction analysis rules (the transaction analysis rules can be defined and deployed by the user), so if there is a transaction analysis demand for an external object, a transaction analysis request can be directly initiated through the target application on the terminal device, and the computer device in the present application can obtain the corresponding transaction data from the off-chain database according to the transaction analysis request, and automatically perform transaction analysis on the transaction data according to the transaction analysis rules, and the obtained transaction analysis results can be returned to the external object. That is to say, after synchronizing the newly added blocks in the on-chain ledger of the first blockchain node to the off-chain database, if a transaction analysis request is received from a data analysis object (an object that expects to perform transaction analysis, such as a user); wherein the transaction analysis request is used to request transaction analysis of the transaction data to be analyzed (the transaction data to be analyzed refers to the transaction data that the data analysis object expects to perform transaction analysis), the transaction data to be analyzed can be obtained from the off-chain database based on the transaction analysis request; further, the transaction data to be analyzed can be automatically analyzed according to the transaction analysis rules to obtain the transaction analysis results of the transaction data to be analyzed; further, the transaction analysis results can be returned to the data analysis object.
[0116] It should be noted that the transaction analysis rules in this application may be different based on different business scenario requirements, that is, the transaction analysis rules may refer to rules determined based on business analysis requirements, and this application does not specify or limit the transaction analysis rules. For ease of understanding, the following will use an example to describe a transaction analysis rule and a specific method of performing transaction analysis according to the transaction analysis rule. Taking the transaction type of the transaction data to be analyzed as a resource transfer type as an example, the specific implementation method of performing transaction analysis on the transaction data to be analyzed according to the transaction analysis rule and obtaining the transaction analysis result of the transaction data to be analyzed can be: according to the transaction analysis rule, the resource transfer amount indicated by the transaction data to be analyzed can be obtained; further, the resource transfer amount can be compared with the transfer threshold; if it is determined that the resource transfer amount is greater than the transfer threshold, the transaction analysis result of the transaction data to be analyzed can be determined to be an unqualified transaction result; and if it is determined that the resource transfer amount is less than the transfer threshold, the transaction analysis result of the transaction data to be analyzed can be determined to be a qualified transaction result.
[0117] It should be understood that the transaction analysis rule in this application may refer to a rule that the amount of resource transfer for each transaction data cannot exceed the transfer threshold (such as 5,000 gold coins). According to the transaction analysis rule, it can be detected whether the amount of resource transfer of the transaction data to be analyzed exceeds the transfer threshold. If it exceeds, it can be determined that the transaction data is unqualified. Of course, this application is an exemplary explanation made for ease of understanding and does not have actual reference significance. Specific transaction analysis rules can be set based on actual business needs.
[0118] In the embodiment of the present application, by creating a node monitoring script for a blockchain node based on the node operation characteristics of the blockchain node, the created node monitoring script can be made to conform to the operation properties of the blockchain node. The node monitoring script that conforms to the node operation properties can monitor the block data file of the blockchain node in real time, and then synchronize the on-chain storage data of the blockchain node (the block stored in the on-chain account book) to the off-chain database in real time. By monitoring the block data file of the blockchain node in real time through the node monitoring script, the on-chain data of the node can be synchronized to the off-chain database in real time, without the need for regular polling or other methods with synchronization delays, with high real-time performance, and the data on the chain and off-chain can be kept consistent. Based on this, the acquisition of on-chain storage data can be converted into acquisition in the off-chain database. For objects that have acquisition requirements for on-chain storage data, there is no need to call the relevant interface to obtain relevant data from the chain, and only needs to directly consult the off-chain database, which can greatly improve the convenience of on-chain data acquisition.
[0119] For easier understanding, please also refer to Figure 3 , Figure 3 This is a schematic diagram of a scenario in which on-chain data is synchronized to off-chain data provided by an embodiment of the present application. Figure 3 As shown, the node monitoring script created for the blockchain node 3000 in this application can be deployed in the node monitoring component, and the node monitoring component is run in the node monitoring component to monitor the block data file of the blockchain node in real time. Figure 3 As shown, assuming that blocks 301 and 302 are newly added to the on-chain ledger of blockchain node 3000, since the on-chain ledger contains the newly added blocks 301 and 302, the block data file 300 of the blockchain node 3000 will be modified to record that the blockchain node 3000 has newly added blocks 301 and 302.
[0120] Furthermore, since the block data file 300 has been modified and changed, the node monitoring component can monitor it through the node monitoring script, and the node monitoring component can send a file change notification to the block synchronization component to notify that the block data file 300 has changed. Based on the file change notification, the block synchronization component can obtain the relevant block data of the newly added block 301 and the newly added block 302 from the on-chain account book of the blockchain node 3000, and synchronize the on-chain data of the newly added block 301 and the newly added block 302 to the off-chain database. Among them, the node monitoring component and the block synchronization component in this application can be deployed in a server (such as a blockchain node) for block synchronization, and the node monitoring script in the node monitoring component can realize real-time monitoring of file changes, so that the on-chain data of the node can be synchronized to the off-chain in real time.
[0121] For further information, see Figure 4 , Figure 4 This is a schematic diagram of a process for creating a node monitoring script for a blockchain node provided by an embodiment of the present application. Figure 2 In the corresponding embodiment, the script creation process is performed on the first blockchain node through the node operation characteristics to obtain the node monitoring script process of the first blockchain node. Figure 4 As shown, the process may include at least the following steps S401 to S404:
[0122] Step S401, obtaining a monitoring script template set; each monitoring script template in the monitoring script template set is configured with a logic code for real-time monitoring of changes in a block data file; the block data file is used to record the data of the block stored in the on-chain ledger of the blockchain node in the blockchain; the blockchain node in the blockchain includes a first blockchain node.
[0123] Specifically, a monitoring script template set may refer to a set composed of different monitoring script templates. Each monitoring script template may be pre-written and configured. The monitoring script template in the present application may be written with the aid of a software writing tool (such as an inotify software tool). Each written monitoring script template should contain logic code for real-time monitoring of block data files of blockchain nodes. Through the monitoring script template, real-time monitoring of block data files of blockchain nodes can be achieved.
[0124] It should be noted that the present application can write configuration monitoring script templates according to the different operating performance of blockchain nodes. For example, monitoring script templates containing different amounts of code can be written. Then, for different blockchain nodes, the corresponding monitoring script templates can be obtained based on their remaining computing power to generate a node monitoring script for real-time monitoring of the block data files of the blockchain node; for another example, different monitoring script templates can be written for blockchain nodes with different processing performance. Then, for different blockchain nodes, an adapted monitoring script template can be obtained according to their processing performance to generate a node monitoring script for real-time monitoring of the block data files of the blockchain node.
[0125] That is to say, each monitoring script template in the monitoring script template set in the present application is configured with logic code for real-time monitoring of changes in block data files (used to record block data stored in the on-chain ledger of blockchain nodes in the blockchain), and the amount of code contained in each monitoring script template may be different, and the corresponding node processing performance may also be different.
[0126] Step S402: According to the script adaptation rule, a monitoring script template adapted to the node operation characteristics is determined from the monitoring script template set.
[0127] Specifically, based on the above, the node operation characteristics of the first blockchain node may include the computing power occupied by the node, the used storage space, the data processing type, etc., then the script adaptation rules here can also be configured according to the rules of the operation performance of the blockchain node. For example, for the computing performance of the blockchain node, the present application can configure the computing power adaptation rule, through which the monitoring script template adapted to the computing power of the blockchain node can be found from the monitoring script template set; for the processing performance of the blockchain node, the present application can configure the type adaptation rule, through which the monitoring script template adapted to the data processing type of the blockchain node can be found from the monitoring script template set; for the storage performance of the blockchain node, the present application can configure the storage space adaptation rule, through which the monitoring script template adapted to the storage space of the blockchain node can be found from the monitoring script template set.
[0128] Then, according to the script adaptation rules, the specific implementation method of determining the monitoring script template adapted to the node operation characteristics from the monitoring script template set will be different based on the different script adaptation rules. Specifically, taking the node operation characteristics including the node occupied computing power of the first blockchain node as an example, the script adaptation rule can refer to the computing power adaptation rule associated with the node occupied computing power. The present application can determine the required computing power required for each monitoring script template according to the computing power adaptation rule, and then compare these required computing powers based on the node occupied computing power of the first blockchain node, so as to obtain an optimal required computing power. The monitoring script template indicated by the optimal required computing power can be determined as the monitoring script template adapted to the node operation characteristics.
[0129] It can be understood that the monitoring script template set includes the monitoring script template S i (i is a positive integer) as an example to illustrate the required computing power for determining each monitoring script template. i It may refer to any monitoring script template in the monitoring script template set. That is, for each monitoring script template, the monitoring script template S may be determined. i The required computing power is calculated by the required computing power method to obtain the required computing power for each monitoring script template. i The required computing power can be obtained by: According to the computing power adaptation rule, the monitoring script template S in the monitoring script template set can be obtained. i The amount of script code included; further, the amount of script code can be analyzed by computing power, thereby determining the monitoring script template S i When the required computing power required by each monitoring script template in the monitoring script template set is determined, the required computing power in the required computing power set can be compared and analyzed by the computing power occupied by the node, thereby obtaining the optimal required computing power in the required computing power set; finally, the monitoring script template indicated by the optimal required computing power in the monitoring script template set can be determined as the monitoring script template adapted to the node operation characteristics.
[0130] Among them, for comparing and analyzing the required computing powers in the required computing power set through the node occupied computing power to obtain the specific implementation method of the optimal required computing power in the required computing power set, it is possible to obtain the total node computing power of the first blockchain node; further, the first computing power difference between the total node computing power and the node occupied computing power can be determined, and the first computing power difference can be determined as the node residual computing power of the first blockchain node; further, the required computing power in the required computing power set that is greater than the node residual computing power can be filtered, thereby obtaining a filtered required computing power set; based on the node residual computing power, the optimal required computing power can be determined from the filtered required computing power set.
[0131] It can be understood that the node occupied computing power of the first blockchain node can refer to the computing power resources that have been occupied during the operation of the first blockchain node. Then, the node remaining computing power of the first blockchain node can be determined by the total node computing power and the node occupied computing power (the remaining available computing power resources, that is, the first computing power difference between the total node computing power and the node occupied computing power). Through the node remaining computing power, part of the required computing power in the required computing power set can be filtered. For example, the required computing power greater than the node remaining computing power can be filtered and deleted. Because the required computing power is greater than the node remaining computing power, the node remaining computing power of the first blockchain node does not have the ability to calculate the corresponding monitoring script template. Then, the required computing power greater than the node remaining computing power can be deleted and filtered. The obtained filtered required computing power set can be called a filtered required computing power set, and the optimal required computing power can be queried from the filtered required computing power set.
[0132] As for the specific method of determining the optimal required computing power from the filtered required computing power set based on the node's remaining computing power, it can be as follows: the second computing power difference between each required computing power and the node's remaining computing power in the filtered required computing power set can be determined, thereby obtaining a second computing power difference set; further, the minimum value in the second computing power difference set can be obtained, and the minimum value in the second computing power difference set can be determined as the optimal computing power difference; further, the required computing power indicated by the optimal computing power difference in the filtered required computing power set can be determined as the optimal required computing power.
[0133] It is understandable that the present application can determine the required computing power that is closest to the remaining computing power of the node as the optimal required computing power, because for the first blockchain node, after calculating and running the monitoring script template, there may still be a surplus, but the remaining computing power cannot calculate other data, then this remaining computing power will cause waste, then considering this point, the present application can calculate the computing power difference between each required computing power and the remaining computing power of the node in the filtered required computing power set (for ease of distinction, referred to as the second computing power difference), thereby obtaining multiple second computing power differences, among which the smallest value can be determined as the optimal computing power difference (the required computing power indicated by the optimal computing power difference is closest to the remaining computing power of the node), and the required computing power indicated by the optimal computing power difference in the filtered required computing power set is determined as the optimal required computing power. And since the node's remaining computing power is very close to the optimal required computing power, then after the first blockchain node runs the monitoring script template, the remaining computing power will be very small, and the wasted computing power will also be small.
[0134] Of course, the above is only an example of a method of determining the optimal required computing power and determining a monitoring script template adapted to the node operation characteristics from the aspect of saving computing power resources. In actual scenarios, after determining the required computing power required for each monitoring script template, any required computing power can be directly selected as the optimal required computing power (for example, the minimum required computing power is selected as the optimal required computing power) from the required computing power that is less than the remaining computing power of the node. That is to say, in actual application scenarios, it is also possible to directly select a required computing power that is less than the remaining computing power of the node as the optimal required computing power, and determine the monitoring script template indicated by the required computing power as the monitoring script template adapted to the node operation characteristics. The present application does not specifically limit the method of determining the optimal required computing power and determining a monitoring script template adapted to the node operation characteristics.
[0135] Of course, in a feasible embodiment, when the node operation characteristic is the data processing type of the first blockchain node, the script adaptation rule can also be a type adaptation rule associated with the data processing type. The specific method of determining the monitoring script template adapted to the node operation characteristic from the monitoring script template set according to the script adaptation rule can also be another implementation method. The specific implementation method can be: according to the type adaptation rule, the configuration data type indicated by each monitoring script template in the monitoring script template set can be obtained, thereby obtaining a configuration data type set; further, the configuration data type in the configuration data type set that matches the first data processing type of the first blockchain node can be determined as a matching data type; the monitoring script template indicated by the matching data type in the monitoring script template set can be determined as a monitoring script template adapted to the node operation characteristic.
[0136] That is to say, each monitoring script template can correspond to a data type (that is, the type of transaction data it is responsible for storing, which can be called a configuration data type). According to the type adaptation rules, type matching can be performed directly to find a monitoring script template that matches the first data processing type of the first blockchain node. This template can be used as a monitoring script template adapted to the node operation characteristics.
[0137] Step S403, obtaining the node identifier of the first blockchain node.
[0138] Specifically, the node identifier of the first blockchain node here may refer to an identifier used to uniquely characterize the first blockchain node. For example, the node identifier may refer to the node number, node name, etc. of the first blockchain node.
[0139] Step S404: The node identifier of the first blockchain node is integrated with a monitoring script template adapted to the node operation characteristics to obtain a node monitoring script of the first blockchain node.
[0140] Specifically, the node monitoring script of the first blockchain node can be obtained by fusing the node identification of the first blockchain node with the monitoring script template adapted to the node operation characteristics. The specific implementation method can be as follows: in the monitoring script template adapted to the node operation characteristics, the identification parameter filling field can be obtained; further, the node identification of the first blockchain node can be written into the identification parameter filling field; finally, the monitoring script template with the node identification of the first blockchain node written into it can be determined as the node monitoring script of the first blockchain node.
[0141] It can be understood that after the node identifier of the first blockchain node is filled into the monitoring script template as a parameter, the obtained node monitoring script can obtain the block data file of the first blockchain node and perform real-time monitoring of the block data file.
[0142] In an embodiment of the present application, for a certain blockchain node (such as the first blockchain node), a script creation process can be performed through the node operation characteristics of the first blockchain node, thereby obtaining a node monitoring script of the first blockchain node, and the changes in the block data file of the first blockchain node can be monitored in real time through the node monitoring script. Among them, the block data file is used to record the data of the blocks stored in the on-chain account book of the first blockchain node, so once the block data file of the first blockchain node is monitored to change, it can be determined that there are new blocks on the on-chain account book of the first blockchain node, and then the new blocks can be synchronized to the off-chain database in a timely manner. It should be understood that this application creates a node monitoring script for a blockchain node based on the node operation characteristics of the blockchain node, so that the created node monitoring script can be in line with the operation properties of the blockchain node. The node monitoring script that conforms to the node operation properties can monitor the block data file of the blockchain node in real time, and then synchronize the on-chain storage data of the blockchain node (the block stored in the on-chain account book) to the off-chain database in real time. Based on this, the acquisition of on-chain storage data can be converted to acquisition in the off-chain database. For objects that have acquisition requirements for on-chain storage data, there is no need to call the relevant interface to obtain relevant data from the chain. It only needs to directly consult the off-chain database, which can greatly improve the convenience of on-chain data acquisition. In summary, this application can realize the real-time synchronization of on-chain data to the off-chain database, and through the real-time nature of data synchronization, the on-chain data acquisition can be converted to off-chain data acquisition, which can improve the convenience of on-chain data acquisition.
[0143] For further information, see Figure 5 , Figure 5 : is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application. The blockchain-based data processing device can be a computer program (including program code) running in a computer device, for example, the blockchain-based data processing device is an application software; the blockchain-based data processing device can be used to execute Figure 2 As shown in the method. Figure 5 As shown, the blockchain-based data processing device 1 may include: a feature acquisition module 11, a script creation module 12, a file monitoring module 13 and a block synchronization module 14.
[0144] A feature acquisition module 11, used to acquire a node operation feature for reflecting an operation attribute of the first blockchain node;
[0145] A script creation module 12, used to perform script creation processing on the first blockchain node through the node operation characteristics to obtain a node monitoring script of the first blockchain node;
[0146] The file monitoring module 13 is used to monitor the block data file of the first blockchain node in real time through the node monitoring script; the block data file of the first blockchain node is used to record the data of the block stored in the on-chain account book of the first blockchain node;
[0147] The block synchronization module 14 is used to determine the presence of a new block in the on-chain account book of the first blockchain node when a change is detected in the block data file of the first blockchain node, and synchronize the new block in the on-chain account book of the first blockchain node to the off-chain database.
[0148] The specific implementation of the feature acquisition module 11, the script creation module 12, the file monitoring module 13 and the block synchronization module 14 can be found in the above Figure 2 The description of step S101 to step S104 in the corresponding embodiment will not be repeated here.
[0149] In one embodiment, the script creation module 12 performs script creation processing on the first blockchain node through the node operation characteristics to obtain a specific implementation method of the node monitoring script of the first blockchain node, including:
[0150] Obtain a monitoring script template set; each monitoring script template in the monitoring script template set is configured with a logic code for real-time monitoring of changes in a block data file; the block data file is used to record the data of the block stored in the on-chain ledger of the blockchain node in the blockchain; the blockchain node in the blockchain includes a first blockchain node;
[0151] According to the script adaptation rule, determine the monitoring script template adapted to the node operation characteristics from the monitoring script template set;
[0152] Obtaining a node identifier of a first blockchain node;
[0153] The node identifier of the first blockchain node is integrated with a monitoring script template adapted to the node operation characteristics to obtain a node monitoring script of the first blockchain node.
[0154] In one embodiment, the node operation feature includes the node occupied computing power of the first blockchain node; the script adaptation rule refers to the computing power adaptation rule associated with the node occupied computing power; the monitoring script template set includes the monitoring script template S i , i is a positive integer;
[0155] The script creation module 12 determines the specific implementation of the monitoring script template adapted to the node operation characteristics from the monitoring script template set according to the script adaptation rule, including:
[0156] According to the computing power adaptation rule, obtain the monitoring script template S in the monitoring script template set iThe amount of script code included;
[0157] Perform power analysis on the script code volume to determine the monitoring script template S i The required computing power;
[0158] When the required computing power required for each monitoring script template in the monitoring script template set is determined, the required computing power in the required computing power set is compared and analyzed by the node occupied computing power to obtain the optimal required computing power in the required computing power set;
[0159] The monitoring script template indicated by the optimal required computing power in the monitoring script template set is determined as the monitoring script template adapted to the node operation characteristics.
[0160] In one embodiment, the script creation module 12 compares and analyzes the required computing power in the required computing power set by the node occupied computing power, and obtains the specific implementation method of the optimal required computing power in the required computing power set, including:
[0161] Obtain the total node computing power of the first blockchain node;
[0162] Determine a first computing power difference between the total computing power of the node and the computing power occupied by the node, and determine the first computing power difference as the node remaining computing power of the first blockchain node;
[0163] Filter the required computing power in the required computing power set that is greater than the remaining computing power of the node to obtain a filtered required computing power set;
[0164] Determine the optimal required computing power from the filtered required computing power set based on the node's remaining computing power.
[0165] In one embodiment, the specific implementation method of the script creation module 12 determining the optimal required computing power from the filtered required computing power set based on the node remaining computing power includes:
[0166] Determine and filter the second computing power difference between each required computing power and the remaining computing power of the node in the required computing power set to obtain a second computing power difference set;
[0167] Obtaining a minimum value in the second computing power difference value set, and determining the minimum value in the second computing power difference value set as the optimal computing power difference;
[0168] The required computing power indicated by the optimal computing power difference in the filtered required computing power set is determined as the optimal required computing power.
[0169] In one embodiment, the node operation characteristics include a data processing type of the first blockchain node; the script adaptation rule refers to a type adaptation rule associated with the data processing type;
[0170] The script creation module 12 determines the specific implementation of the monitoring script template adapted to the node operation characteristics from the monitoring script template set according to the script adaptation rule, including:
[0171] According to the type adaptation rule, the configuration data type indicated by each monitoring script template in the monitoring script template set is obtained to obtain a configuration data type set;
[0172] Determine the configuration data type that matches the data processing type of the first blockchain node in the configuration data type set as the matching data type;
[0173] The monitoring script template indicated by the matching data type in the monitoring script template set is determined as the monitoring script template adapted to the node operation characteristics.
[0174] In one embodiment, the script creation module 12 integrates the node identifier of the first blockchain node with the monitoring script template adapted to the node operation characteristics to obtain a specific implementation of the node monitoring script of the first blockchain node, including:
[0175] In a monitoring script template adapted to the node operation characteristics, obtain identification parameters and fill in fields;
[0176] In the Identification Parameter Fill-in field, write the node identification of the first blockchain node;
[0177] The monitoring script template into which the node identifier of the first blockchain node is written is determined as the node monitoring script of the first blockchain node.
[0178] In one embodiment, the specific implementation method of the block synchronization module 14 synchronizing the newly added block in the on-chain ledger of the first blockchain node to the off-chain database includes:
[0179] In the on-chain ledger of the first blockchain node, block data contained in the newly added block is obtained;
[0180] The block data contained in the newly added block is synchronized to the off-chain database in parallel.
[0181] In one embodiment, the number of off-chain databases is N, where N is a positive integer;
[0182] The specific implementation method of the block synchronization module 14 synchronizing the newly added blocks in the on-chain account book of the first blockchain node to the off-chain database includes:
[0183] Obtain the data processing type of the first blockchain node and the configuration service type of each of the N off-chain databases;
[0184] Determine, among the N configuration service types, a configuration service type that matches the data processing type of the first blockchain node as a matching service type;
[0185] Determine the off-chain database indicated by the matching service type among the N off-chain databases as the target database;
[0186] Synchronize the newly added blocks in the on-chain ledger of the first blockchain node to the target database.
[0187] In one embodiment, after the block synchronization module 14 synchronizes the newly added block in the on-chain ledger of the first blockchain node to the off-chain database, the blockchain-based data processing device 1 also includes: a request receiving module 15, a transaction acquisition module 16, a transaction analysis module 17 and a result return module 18.
[0188] A request receiving module 15 is used to receive a transaction analysis request sent by a data analysis object; the transaction analysis request is used to request transaction analysis of the transaction data to be analyzed;
[0189] A transaction acquisition module 16, used to acquire the transaction data to be analyzed from the off-chain database based on the transaction analysis request;
[0190] The transaction analysis module 17 is used to perform transaction analysis on the transaction data to be analyzed according to the transaction analysis rules to obtain the transaction analysis results of the transaction data to be analyzed;
[0191] The result returning module 18 is used to return the transaction analysis result to the data analysis object.
[0192] The specific implementation of the request receiving module 15, the transaction acquisition module 16, the transaction analysis module 17 and the result returning module 18 can be found in the above Figure 2 The relevant description in step S104 in the corresponding embodiment will not be repeated here.
[0193] In one embodiment, the transaction type of the transaction data to be analyzed is a resource transfer type;
[0194] The transaction analysis module 17 performs transaction analysis on the transaction data to be analyzed according to the transaction analysis rules, and obtains the specific implementation method of the transaction analysis result of the transaction data to be analyzed, including:
[0195] According to the transaction analysis rules, the resource transfer amount indicated by the transaction data to be analyzed is obtained;
[0196] comparing the resource transfer amount to a transfer threshold;
[0197] If it is determined that the resource transfer amount is greater than the transfer threshold, the transaction analysis result of the transaction data to be analyzed is determined to be a transaction unqualified result;
[0198] If it is determined that the resource transfer amount is less than the transfer threshold, the transaction analysis result of the transaction data to be analyzed is determined to be a qualified transaction result.
[0199] In an embodiment of the present application, for a certain blockchain node (such as the first blockchain node), a script creation process can be performed through the node operation characteristics of the first blockchain node, thereby obtaining a node monitoring script of the first blockchain node, and the changes in the block data file of the first blockchain node can be monitored in real time through the node monitoring script. Among them, the block data file is used to record the data of the blocks stored in the on-chain account book of the first blockchain node, so once the block data file of the first blockchain node is monitored to change, it can be determined that there is a new block on the on-chain account book of the first blockchain node, and then the new block can be synchronized to the off-chain database in a timely manner. It should be understood that this application creates a node monitoring script for a blockchain node based on the node operation characteristics of the blockchain node, so that the created node monitoring script can be in line with the operation properties of the blockchain node. The node monitoring script that conforms to the node operation properties can monitor the block data file of the blockchain node in real time, and then synchronize the on-chain storage data of the blockchain node (the block stored in the on-chain account book) to the off-chain database in real time. Based on this, the acquisition of on-chain storage data can be converted to acquisition in the off-chain database. For objects that have acquisition requirements for on-chain storage data, there is no need to call the relevant interface to obtain relevant data from the chain. It only needs to directly consult the off-chain database, which can greatly improve the convenience of on-chain data acquisition. In summary, this application can realize the real-time synchronization of on-chain data to the off-chain database, and through the real-time nature of data synchronization, the on-chain data acquisition can be converted to off-chain data acquisition, which can improve the convenience of on-chain data acquisition.
[0200] For further information, see Figure 6 , Figure 6 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 6As shown, the above-mentioned computer device 8000 may include: a processor 8001, a network interface 8004 and a memory 8005. In addition, the above-mentioned computer device 8000 also includes: a user interface 8003, and at least one communication bus 8002. Among them, the communication bus 8002 is used to realize the connection and communication between these components. Among them, the user interface 8003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 8003 may also include a standard wired interface and a wireless interface. The network interface 8004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 8005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 8005 may optionally also be at least one storage device located away from the aforementioned processor 8001. As Figure 6 As shown, the memory 8005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.
[0201] exist Figure 6 In the computer device 8000 shown, the network interface 8004 can provide a network communication function; the user interface 8003 is mainly used to provide an input interface for the user; and the processor 8001 can be used to call the device control application stored in the memory 8005 to achieve:
[0202] Obtaining a node operation characteristic reflecting an operation attribute of the first blockchain node;
[0203] Perform script creation processing on the first blockchain node through the node operation characteristics to obtain a node monitoring script of the first blockchain node;
[0204] The block data file of the first blockchain node is monitored in real time through the node monitoring script; the block data file of the first blockchain node is used to record the data of the block stored in the on-chain account book of the first blockchain node;
[0205] When a change is detected in the block data file of the first blockchain node, it is determined that a new block exists in the on-chain account book of the first blockchain node, and the new block in the on-chain account book of the first blockchain node is synchronized to the off-chain database.
[0206] It should be understood that the computer device 8000 described in the embodiment of the present application can execute the above Figures 2 to 4 The description of the data processing method based on blockchain in the corresponding embodiment can also be performed as described above. Figure 5The description of the blockchain-based data processing device 1 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated here.
[0207] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing computer device 8000 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, the computer program can execute the above-mentioned data processing computer device 8000. Figures 2 to 4 The description of the above-mentioned blockchain-based data processing method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0208] The computer-readable storage medium may be a data processing device based on blockchain provided in any of the aforementioned embodiments or an internal storage unit of the computer device, such as a hard disk or memory of a computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0209] In one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method provided in one aspect of the embodiments of the present application.
[0210] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally includes steps or modules that are not listed, or optionally includes other step units inherent to these processes, methods, devices, products, or equipment.
[0211] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0212] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0213] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0214] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method based on blockchain, characterized in that: include: Obtaining a node operation characteristic reflecting an operation attribute of the first blockchain node; Performing script creation processing on the first blockchain node according to the node operation characteristics to obtain a node monitoring script of the first blockchain node; The block data file of the first blockchain node is monitored in real time by the node monitoring script; the block data file of the first blockchain node is used to record the data of the blocks stored in the on-chain account book of the first blockchain node; When a change is detected in the block data file of the first blockchain node, it is determined that a new block exists in the on-chain account book of the first blockchain node, and the new block in the on-chain account book of the first blockchain node is synchronized to the off-chain database.
2. The method according to claim 1, characterized in that The step of performing script creation processing on the first blockchain node through the node operation feature to obtain a node monitoring script of the first blockchain node includes: Acquire a monitoring script template set; each monitoring script template in the monitoring script template set is configured with a logic code for real-time monitoring of changes in a block data file; the block data file is used to record the data of the block stored in the on-chain ledger of the blockchain node in the blockchain; the blockchain node in the blockchain includes the first blockchain node; According to the script adaptation rule, determining a monitoring script template adapted to the node operation characteristics from the monitoring script template set; Obtaining a node identifier of the first blockchain node; The node identifier of the first blockchain node is integrated with the monitoring script template adapted to the node operation characteristics to obtain a node monitoring script of the first blockchain node.
3. The method according to claim 2, characterized in that The node operation feature includes the node occupied computing power of the first blockchain node; the script adaptation rule refers to the computing power adaptation rule associated with the node occupied computing power; the monitoring script template set includes the monitoring script template S i , i is a positive integer; The step of determining, according to the script adaptation rule, a monitoring script template adapted to the node operation characteristics from the monitoring script template set comprises: According to the computing power adaptation rule, obtain the monitoring script template S in the monitoring script template set i The amount of script code included; Perform computing power analysis on the script code volume to determine the monitoring script template S i The required computing power; When the required computing power required by each monitoring script template in the monitoring script template set is determined, the required computing power in the required computing power set is compared and analyzed by the computing power occupied by the node to obtain the optimal required computing power in the required computing power set; The monitoring script template indicated by the optimal required computing power in the monitoring script template set is determined as a monitoring script template adapted to the node operation characteristics.
4. The method according to claim 3, characterized in that Comparing and analyzing the required computing power in the required computing power set by the computing power occupied by the node to obtain the optimal required computing power in the required computing power set includes: Obtaining the total node computing power of the first blockchain node; Determine a first computing power difference between the total computing power of the node and the computing power occupied by the node, and determine the first computing power difference as the node remaining computing power of the first blockchain node; Filtering the required computing power in the required computing power set that is greater than the remaining computing power of the node to obtain a filtered required computing power set; An optimal required computing power is determined from the filtered required computing power set based on the remaining computing power of the node.
5. The method according to claim 4, characterized in that The determining the optimal required computing power from the filtered required computing power set based on the remaining computing power of the node includes: Determine a second computing power difference between each required computing power in the filtered required computing power set and the remaining computing power of the node to obtain a second computing power difference set; Obtaining a minimum value in the second computing power difference value set, and determining the minimum value in the second computing power difference value set as an optimal computing power difference value; The required computing power indicated by the optimal computing power difference in the filtered required computing power set is determined as the optimal required computing power.
6. The method according to claim 2, characterized in that The node operation characteristics include the data processing type of the first blockchain node; the script adaptation rule refers to the type adaptation rule associated with the data processing type; The step of determining, according to the script adaptation rule, a monitoring script template adapted to the node operation characteristics from the monitoring script template set comprises: According to the type adaptation rule, the configuration data type indicated by each monitoring script template in the monitoring script template set is obtained to obtain a configuration data type set; Determine, in the configuration data type set, a configuration data type that matches the data processing type of the first blockchain node as a matching data type; The monitoring script template indicated by the matching data type in the monitoring script template set is determined as a monitoring script template adapted to the node operation characteristics.
7. The method according to claim 2, characterized in that The step of fusing the node identifier of the first blockchain node with the monitoring script template adapted to the node operation characteristics to obtain a node monitoring script of the first blockchain node includes: In the monitoring script template adapted to the node operation characteristics, obtaining identification parameters to fill in fields; In the identification parameter filling field, write the node identification of the first blockchain node; The monitoring script template into which the node identifier of the first blockchain node is written is determined as the node monitoring script of the first blockchain node.
8. The method according to claim 1, characterized in that The step of synchronizing the newly added blocks in the on-chain ledger of the first blockchain node to the off-chain database includes: In the on-chain account book of the first blockchain node, obtaining block data included in the newly added block; The block data contained in the newly added block is synchronized in parallel to the off-chain database.
9. The method according to claim 1, characterized in that: The number of off-chain databases is N, where N is a positive integer; Synchronizing the newly added blocks in the on-chain ledger of the first blockchain node to the off-chain database, including: Obtaining a data processing type of the first blockchain node and a configuration service type of each of the N off-chain databases; Determine, among the N configuration service types, a configuration service type that matches the data processing type of the first blockchain node as a matching service type; Determine the off-chain database indicated by the matching service type among the N off-chain databases as the target database; Synchronize the newly added blocks in the on-chain ledger of the first blockchain node to the target database.
10. The method according to claim 1, characterized in that After synchronizing the newly added blocks in the on-chain ledger of the first blockchain node to the off-chain database, the method further includes: Receiving a transaction analysis request sent by a data analysis object; the transaction analysis request is used to request transaction analysis of the transaction data to be analyzed; Acquire the transaction data to be analyzed from the off-chain database based on the transaction analysis request; Performing transaction analysis on the transaction data to be analyzed according to the transaction analysis rules to obtain transaction analysis results of the transaction data to be analyzed; The transaction analysis result is returned to the data analysis object.
11. The method according to claim 10, characterized in that The transaction type of the transaction data to be analyzed is a resource transfer type; The step of performing transaction analysis on the transaction data to be analyzed according to the transaction analysis rule to obtain a transaction analysis result of the transaction data to be analyzed includes: According to the transaction analysis rule, obtaining the resource transfer amount indicated by the transaction data to be analyzed; comparing the resource transfer amount with a transfer threshold; If it is determined that the resource transfer amount is greater than the transfer threshold, determining that the transaction analysis result of the transaction data to be analyzed is a transaction unqualified result; If it is determined that the resource transfer amount is less than the transfer threshold, the transaction analysis result of the transaction data to be analyzed is determined to be a qualified transaction result.
12. A data processing device based on blockchain, characterized in that: include: A feature acquisition module, used to acquire a node operation feature for reflecting an operation attribute of the first blockchain node; A script creation module, used to perform script creation processing on the first blockchain node according to the node operation characteristics, to obtain a node monitoring script of the first blockchain node; A file monitoring module, used to monitor the block data file of the first blockchain node in real time through the node monitoring script; the block data file of the first blockchain node is used to record the data of the block stored in the on-chain account book of the first blockchain node; The block synchronization module is used to determine the presence of a new block in the on-chain account book of the first blockchain node when a change is detected in the block data file of the first blockchain node, and synchronize the new block in the on-chain account book of the first blockchain node to the off-chain database.
13. A computer device, characterized in that: include: Processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a network communication function, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the method according to any one of claims 1 to 11.
15. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a computer-readable storage medium. The computer program is suitable for being read and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 11.