Conversion method and device of on-chain data and terminal equipment
By extracting and converting on-chain data of different blockchains and generating target data with standard data structures, the problem of inefficient analysis caused by different blockchain data formats is solved, and more efficient transaction behavior analysis is achieved.
Patent Information
- Application Number
- CN202411886164.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-11
AI Technical Summary
The on-chain data formats of different blockchains are different, so it is difficult to combine on-chain data in multiple blockchains for transaction behavior analysis, resulting in large amounts of analysis and inefficient efficiency.
By obtaining on-chain data of at least one blockchain, the transaction data corresponding to each transaction voucher type is extracted, and intermediate data is generated according to the standard data structure. Extract liquidity pool data and log data from the on-chain data, add it to the intermediate data, and obtain target data with a standard data structure.
The on-chain data of different blockchains is realized to convert the target data of the same standard data structure, thereby reducing the on-chain data of each blockchain separately, reducing the analysis workload, and improving the analysis efficiency.
Smart Images

Figure CN119814809A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of blockchain technology, and in particular, relates to a method, device and terminal device for converting on-chain data. Background Art
[0002] Blockchain is a distributed ledger that combines data blocks into a specific data structure in the form of a chain. It is used to store data and has the characteristics of decentralization and immutability, which ensures the authenticity and security of the data. It is widely used in the financial field and the Internet of Things field.
[0003] At present, in order to evaluate the activity of transaction behaviors and monitor the legality of transaction behaviors, it is necessary to analyze the transaction behaviors stored in the blockchain based on the on-chain data in the blockchain to strengthen the management of transaction behaviors in the blockchain.
[0004] However, different blockchains store on-chain data in different data formats, which makes it difficult to combine on-chain data from multiple blockchains to analyze transaction behaviors. Even if it is possible to integrate on-chain data from multiple blockchains, it is necessary to process the on-chain data of each blockchain separately, resulting in a large analysis workload and low analysis efficiency. Summary of the invention
[0005] The embodiments of the present application provide a method, apparatus and terminal device for converting on-chain data, aiming to solve the problem that it is difficult to combine on-chain data from multiple blockchains to analyze transaction behaviors due to different data formats in existing different blockchains, resulting in large analysis workload and low analysis efficiency.
[0006] In a first aspect, an embodiment of the present application provides a method for converting on-chain data, the method comprising:
[0007] Obtain on-chain data of at least one blockchain, and extract transaction data corresponding to each transaction voucher type from the on-chain data;
[0008] Generate intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure;
[0009] Extracting liquidity pool data corresponding to each of the transaction voucher types from the on-chain data, and obtaining log data corresponding to the transaction data from each node of the blockchain; wherein the liquidity pool data is used to evaluate transaction behaviors related to the transaction voucher type;
[0010] The liquidity pool data and the log data are added to the intermediate data to obtain target data having the standard data structure.
[0011] In a possible implementation of the first aspect, obtaining on-chain data of at least one blockchain includes:
[0012] Creating at least two reading programs, and simultaneously reading the on-chain data of each target node in the blockchain through at least two of the reading programs; wherein the target node is a node with the same transaction voucher type in the blockchain;
[0013] According to the transaction voucher type, the on-chain data is divided into at least one on-chain data set; wherein the on-chain data set corresponds one-to-one to the transaction voucher type.
[0014] In a possible implementation of the first aspect, the simultaneously reading the on-chain data of the target node in each of the blockchains by at least two of the reading programs includes:
[0015] Determine the time when each of the on-chain data in each of the blockchains is added;
[0016] According to the adding time, the on-chain data of the target node in each blockchain within the target time period is simultaneously read by at least two of the reading programs; wherein the target time period is related to the reading cycle of reading the on-chain data.
[0017] In a possible implementation manner of the first aspect, extracting transaction data corresponding to each transaction voucher type from the on-chain data includes:
[0018] Determine the on-chain data corresponding to each of the transaction voucher types, and determine the parsing method corresponding to each of the transaction voucher types; wherein different transaction voucher types correspond to different parsing methods, and the same transaction voucher type corresponds to different parsing methods in different blockchains;
[0019] Parsing the on-chain data according to a parsing method corresponding to the transaction voucher type to obtain decoded data of the on-chain data;
[0020] Extract the target field in the decoded data to obtain transaction data corresponding to each of the transaction voucher types; wherein the target field is a field in the decoded data related to the transaction behavior.
[0021] In a possible implementation manner of the first aspect, generating, according to the transaction data and the standard data structure, intermediate data corresponding to each transaction voucher type includes:
[0022] Create blank data with standard data structure;
[0023] The transaction data is updated to the fields at corresponding positions in the blank data to obtain intermediate data corresponding to each transaction voucher type.
[0024] In a possible implementation manner of the first aspect above, before adding the liquidity pool data and the log data to the intermediate data to obtain the target data having the standard data structure, the method further includes:
[0025] The numerical unit of the liquidity pool data is converted into a numerical unit corresponding to a benchmark transaction voucher type; wherein the benchmark transaction voucher type is a transaction voucher type used for transaction behavior analysis among all the transaction voucher types.
[0026] In a possible implementation manner of the first aspect above, the method further includes:
[0027] Inputting the target data into a preset transaction data table;
[0028] A derivative table of at least one analysis angle is generated based on the transaction data table; wherein the derivative table is used to perform transaction behavior analysis operations according to the corresponding analysis angle.
[0029] In a possible implementation manner of the first aspect, generating at least one derivative table of an analysis angle based on the transaction data table includes:
[0030] Identify at least one analytical perspective;
[0031] According to the standard data structure, data related to each analysis angle is read from the transaction data table respectively to obtain a derivative table corresponding to each analysis angle.
[0032] In a second aspect, an embodiment of the present application provides a device for converting on-chain data, the device comprising:
[0033] An acquisition module, used to acquire on-chain data of at least one blockchain, and extract transaction data corresponding to each transaction voucher type from the on-chain data;
[0034] A generating module, used for generating intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure;
[0035] An extraction module, configured to extract the liquidity pool data corresponding to each of the transaction voucher types from the on-chain data, and to obtain log data corresponding to the transaction data from each node of the blockchain; wherein the liquidity pool data is used to evaluate transaction behaviors related to the transaction voucher type;
[0036] An adding module is used to add the liquidity pool data and the log data to the intermediate data to obtain target data having the standard data structure.
[0037] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the on-chain data conversion method provided in the first aspect above is implemented.
[0038] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is run on a computer, the computer executes the on-chain data conversion method provided in the first aspect above.
[0039] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the on-chain data conversion method provided in the first aspect above is implemented.
[0040] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0041] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0042] In an embodiment of the present application, by obtaining on-chain data of at least one blockchain, and extracting transaction data corresponding to each transaction voucher type from the on-chain data, generating intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure, extracting liquidity pool data corresponding to each transaction voucher type from the on-chain data, obtaining log data corresponding to the transaction data from each node of the blockchain, adding the liquidity pool data and the log data to the intermediate data, and obtaining target data with a standard data structure, the on-chain data of at least one blockchain can be converted into target data with the same standard data structure, and performing transaction behavior analysis operations based on the target data combined with at least one blockchain, thereby reducing the situation of processing the on-chain data of each blockchain separately, reducing the analysis workload, and improving the analysis efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is a flowchart of a method for converting on-chain data provided by an embodiment of the present application;
[0044] Figure 2 This is a flowchart of another method for converting on-chain data provided by an embodiment of the present application;
[0045] Figure 3is a schematic diagram of blank data provided by an embodiment of the present application;
[0046] Figure 4 This is a flowchart of a method for converting on-chain data provided by an embodiment of the present application.
[0047] Figure 5 It is a structural diagram of a device for converting on-chain data provided by an embodiment of the present application;
[0048] Figure 6 It is a structural block diagram of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] Blockchain is a distributed ledger that combines blocks into a specific data structure in a chain manner for storing data. Specifically, blockchain is usually composed of a data layer, a network layer, and a consensus layer. Among them, the data layer includes at least one block, and the data layer can store transaction data through each block. The network layer can be a peer-to-peer network composed of at least one node, and the network layer can include a proposal node for proposing and creating blocks, and a verification node for verifying the legitimacy and validity of blocks. Among them, the proposal node can collect data on corresponding transaction behaviors from the blockchain, and propose to build blocks based on the collected data. The verification node can verify the validity and legitimacy of the information stored in the block, so that the block can be added to the blockchain when the block passes the verification. The consensus layer can encapsulate various consensus algorithms, and through the consensus algorithm, the information stored in each block between each node is consistent, so as to ensure the consistency of data of each node in the blockchain, thereby ensuring the security and credibility of the information in the blockchain.
[0051] At present, in order to evaluate the activity of transaction behaviors and monitor the legality of transaction behaviors, it is necessary to analyze the transaction behaviors stored in the blockchain based on the on-chain data in the blockchain to strengthen the management of transaction behaviors in the blockchain.
[0052] However, different blockchains store on-chain data in different data formats, which makes it difficult to combine on-chain data from multiple blockchains to analyze transaction behaviors. Even if it is possible to combine on-chain data from multiple blockchains, it is necessary to process the on-chain data of each blockchain separately, resulting in a large analysis workload and low analysis efficiency.
[0053] Based on this, an embodiment of the present application provides a method for converting on-chain data, by obtaining on-chain data of at least one blockchain, and extracting transaction data corresponding to each transaction voucher type from the on-chain data, generating intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure, extracting liquidity pool data corresponding to each transaction voucher type from the on-chain data, obtaining log data corresponding to the transaction data from each node of the blockchain, adding the liquidity pool data and the log data to the intermediate data, and obtaining target data with a standard data structure, so that the on-chain data of at least one blockchain can be converted into target data with the same standard data structure, and performing transaction behavior analysis operations based on the target data combined with at least one blockchain, thereby reducing the situation of processing the on-chain data of each blockchain separately, reducing the analysis workload, and improving analysis efficiency.
[0054] See also Figure 1 , Figure 1 A flowchart of a method for converting on-chain data provided by an embodiment of the present application is shown, which may specifically include the following steps:
[0055] Step 101, obtain on-chain data of at least one blockchain, and extract transaction data corresponding to each transaction voucher type from the on-chain data.
[0056] Among them, on-chain data can be data stored on the blockchain, and on-chain data can include transaction data, liquidity pool data, smart contract data, block data and other data. Transaction data can be transaction information for each transaction behavior, including the time of occurrence of the transaction behavior, the block identifier storing the transaction behavior, the hash value used to identify the transaction behavior, etc. Liquidity pool data can be data used to evaluate transaction behaviors related to transaction voucher types, and liquidity pool data can include data such as the total value of all transaction vouchers, the type of each transaction voucher, the total value of each transaction voucher type, and the value ratio between each transaction voucher type. Smart contract data can be data describing smart contracts, and smart contract data can include data such as the identifier of the smart contract and the type of the smart contract. Block data can include data such as the block number, block hash value, and block timestamp of the block. The transaction voucher type may be a type of transaction voucher. The transaction voucher may be a digital asset issued in a blockchain network, used to represent the value of a certain asset, equity or service. The transaction voucher type may be related to the consensus mechanism of the consensus layer in the blockchain, that is, different types of consensus mechanisms may correspond to different types of transaction vouchers. For example, blockchain A supports the ERC-20 standard, and the transaction voucher it issues may be Ethereum, while blockchain B supports the BEP-20 standard, and the transaction voucher it issues may be Bitcoin.
[0057] In practical applications, when transaction behavior needs to be analyzed, the on-chain data in each blockchain can be obtained.
[0058] In an embodiment of the present application, obtaining on-chain data of at least one blockchain in step 101 may include the following steps:
[0059] Create at least two reading programs, and use the at least two reading programs to simultaneously read the on-chain data of the target node in each blockchain, and divide the on-chain data into at least one on-chain data set according to the transaction voucher type.
[0060] Among them, the reading program can be used to read the on-chain data in the blockchain. The reading program can access each node in each blockchain. The target node can be a node with the same transaction voucher type in the blockchain. The on-chain data set can correspond one-to-one to the transaction voucher type.
[0061] Before obtaining on-chain data, at least two readers can be created in any node, or at least one reader can be created in at least two nodes, or at least two readers can be created in any terminal device that can access each node. Then, when it is necessary to obtain on-chain data, all readers can access each node in batches and obtain the on-chain data of each node.
[0062] In actual applications, the corresponding on-chain data can be read from all nodes in turn according to the transaction voucher type. That is, for any transaction voucher type, all nodes in the blockchain that store transaction data of this transaction voucher type can be determined as target nodes, and the on-chain data of all target nodes can be obtained through the reading program, thereby obtaining the on-chain data of each transaction voucher type.
[0063] In a specific implementation, after determining the target node, the number of reading programs and the number of target nodes can also be determined, and then based on the number of reading programs and the number of target nodes, the total batch for reading all target nodes can be determined, as well as the batch in which each target node is located. In any batch, the on-chain data of all target nodes in the batch can be read simultaneously through all reads, so that the on-chain data of each node can be obtained in batches.
[0064] For example, the number of target nodes can be 100, and the number of reading programs can be 4, so it can be determined that the total batches for reading all target nodes are 20, and the batch for reading target nodes 1 to target nodes 4 is determined to be the first batch, and the batch for reading target nodes 5 to target nodes 8 is the second batch, and so on. In the first batch, all reading programs are used to read all target nodes of the first batch at the same time, that is, read the on-chain data of target nodes 1 to target nodes 4, and different reading programs read different target nodes in the batch, such as reading program 1 reads the on-chain data of target node 1, reading program 2 reads the on-chain data of target node 2, and so on. All reading programs can be used to read all target nodes of each batch at the same time, thereby reducing the number of times the on-chain data is read and improving the efficiency of reading the on-chain data.
[0065] After obtaining the on-chain data of all nodes, the on-chain data can be divided into at least one on-chain data set according to the transaction voucher type, and different on-chain data sets correspond to different transaction voucher types.
[0066] In one embodiment of the present application, the on-chain data of the target node in each blockchain can be read simultaneously by at least two reading programs in the following manner:
[0067] Determine the time at which each on-chain data in each blockchain is added, and according to the time at which it is added, simultaneously read the on-chain data of the target node in each blockchain within the target time period through at least two reading programs.
[0068] The adding time may be the time when the on-chain data is added to the blockchain, specifically the time when the block storing the on-chain data is added to the blockchain, and the target time period may be related to the reading cycle of reading the on-chain data.
[0069] In practical applications, the time of adding each on-chain data in each blockchain can be determined in advance, that is, the time when each on-chain data is added to the blockchain can be determined, and then the target time period corresponding to each on-chain data can be determined according to the addition time and the reading cycle of the on-chain data, that is, the on-chain data in the target node in the target time period can be determined, and the on-chain data of the target node in each blockchain within the target time period can be read simultaneously through all reading programs.
[0070] In a specific implementation, the time of adding the on-chain data read in the previous cycle can also be determined, and then the time period of the current cycle can be determined based on the time of adding the on-chain data read in the previous cycle and the reading cycle, and the on-chain data in the current cycle can be determined based on the time of adding each on-chain data in the current cycle, that is, the time period of the current cycle is the target time period.
[0071] For example, the time of adding the on-chain data in the previous cycle can be 19:00, and the reading cycle can be to read the on-chain data every 5 minutes, so that the time period of the current cycle can be determined to be 19:00 to 19:05, and the time period of the next cycle can be 19:05 to 19:10. The time of adding the on-chain data a in the target node can be 19:01, the time of adding the on-chain data b can be 19:06, and the time of adding the on-chain data c can be 19:02, so that the on-chain data a and the on-chain data c in the target time period can be read simultaneously through all reading programs, that is, the on-chain data read is the data that needs to be read in the current cycle, and there is no need to read the on-chain data of the previous cycle, which can reduce the amount of data read, thereby improving the efficiency of reading on-chain data.
[0072] After obtaining the on-chain data in each blockchain, the transaction data corresponding to each transaction voucher type can be extracted from the on-chain data. Specifically, after obtaining the on-chain data set of each transaction voucher type, the transaction data can be extracted from each on-chain data set to obtain the transaction data corresponding to each transaction voucher type.
[0073] In a specific implementation, the field type of each data in the on-chain data can be identified, and then the transaction data used to describe each transaction behavior can be extracted according to the field type of each data.
[0074] Step 102: Generate intermediate data corresponding to each transaction voucher type based on the transaction data and the standard data structure.
[0075] The standard data structure may be a data structure defined by a user for analyzing transaction behavior, and the intermediate data may be data obtained by adding transaction data according to the standard data structure.
[0076] After obtaining the transaction data, the user-defined standard data structure can be determined, and the transaction data can be added according to the standard data structure to generate intermediate data, so that the intermediate data corresponding to each transaction voucher type can be obtained.
[0077] Step 103, extracting the liquidity pool data corresponding to each transaction voucher type from the on-chain data, and obtaining the log data corresponding to the transaction data from each node of the blockchain.
[0078] Among them, liquidity pool data can be used to evaluate transaction behaviors related to transaction voucher types, and log data can be data that records the transaction processing process of transaction behaviors. Log data may include transaction objects, the value paid by the buyer, the value obtained by the seller, and the address of the block where the transaction data related to the transaction behavior is stored.
[0079] After obtaining the intermediate data, you can also extract the liquidity pool data corresponding to each transaction voucher type according to the field type of each data in the on-chain data, and obtain the log data corresponding to the transaction data from each node of the blockchain.
[0080] In actual applications, the node can record the transaction processing process of each transaction behavior, obtain the transaction data and log data of the transaction behavior, and add the transaction data to the blockchain. Since the log data also includes the privacy data of the node, the log data is stored in the storage space of the node instead of adding the log data to the blockchain. When the log data needs to be obtained, a request for the log data corresponding to the transaction data can be sent to each node, and the log data returned by each node can be obtained, that is, the log data corresponding to the transaction data is obtained from each node in the blockchain.
[0081] Step 104, adding the liquidity pool data and the log data to the intermediate data to obtain the target data with a standard data structure.
[0082] The target data may be data that combines transaction data, liquidity pool data, and log data and has a standard data structure.
[0083] After obtaining the liquidity pool data and the log data, the liquidity pool data and the log data may be added to the intermediate data to obtain the target data having a standard data structure.
[0084] In a specific implementation, the location in the intermediate data for storing liquidity pool data and the location for storing log data can be determined, and then the liquidity pool data can be updated to the location in the intermediate data for storing liquidity pool data, and the log data can be added to the location in the intermediate data for storing log data to obtain target data with a standard data structure.
[0085] In an embodiment of the present application, before step 104, the following steps may also be included:
[0086] Convert the numerical unit of the liquidity pool data into the numerical unit corresponding to the benchmark transaction voucher type.
[0087] The benchmark transaction voucher type may be a transaction voucher type used for transaction behavior analysis among all transaction voucher types.
[0088] In actual applications, the benchmark transaction voucher type used for transaction behavior analysis can be determined in advance, and the transaction voucher type included in the liquidity pool data in the current blockchain can be determined, and then the value ratio between each transaction voucher type and the benchmark transaction voucher type can be determined. According to the value ratio, the numerical unit of the transaction voucher type included in the liquidity pool data can be converted into the numerical unit corresponding to the benchmark transaction voucher type.
[0089] Specifically, the liquidity pool data in the blockchain may include at least one type of transaction voucher.
[0090] In an embodiment of the present application, the following steps may also be included:
[0091] The target data is input into a preset transaction data table, and a derivative table of at least one analysis angle is generated based on the transaction data table.
[0092] Among them, the derivative table can be used to perform transaction behavior analysis operations according to the corresponding analysis angle. The analysis angle can be the angle for analyzing the transaction behavior. The analysis angle may include the transaction time angle, transaction object angle, transaction voucher type angle, etc.
[0093] After obtaining the target data with a standard data structure, the target data can be input into a pre-set transaction data table, and then the transaction data table can read the data used to analyze the transaction behavior based on the data structure of the target data, and generate at least one derivative table of the analysis angle according to different analysis angles.
[0094] In practical applications, a transaction data table for performing transaction behavior analysis can be generated in advance, and the transaction data table can identify the corresponding data according to the standard data structure, and then can convert on-chain data in different data formats into target data of the same data structure, and read the data used to analyze transaction behavior through the data structure of the target data through the transaction data table, thereby reducing the need to process on-chain data of each blockchain individually, reducing analysis workload, and improving analysis efficiency.
[0095] In an embodiment of the present application, the following method may be used to generate a derivative table of at least one analysis angle based on the transaction data table:
[0096] At least one analysis angle is determined, and data related to each analysis angle is read from the transaction data table according to the standard data structure to obtain a derivative table corresponding to each analysis angle.
[0097] After the target data is input into a preset transaction data table, at least one analysis angle can be determined, and then the data related to each analysis angle can be read from the transaction data table according to the standard data structure, and a derivative table corresponding to each analysis angle can be generated based on the read data.
[0098] Exemplarily, when the analysis angle is the transaction voucher type angle, the data of each transaction voucher type can be read from the transaction data table, and a corresponding derivative table can be generated according to each transaction voucher type. When the analysis angle is the transaction time angle, the data of each transaction time can be read from the transaction data table, and a corresponding derivative table can be generated according to each transaction voucher type, and so on.
[0099] For example, data of transaction voucher type a may be read from a transaction data table, and the data of transaction voucher type a may be sorted, and then transaction behavior analysis may be performed on the data of transaction voucher type a to obtain analysis results on transaction voucher type a.
[0100] In an embodiment of the present application, by obtaining on-chain data of at least one blockchain, and extracting transaction data corresponding to each transaction voucher type from the on-chain data, generating intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure, extracting liquidity pool data corresponding to each transaction voucher type from the on-chain data, obtaining log data corresponding to the transaction data from each node of the blockchain, adding the liquidity pool data and the log data to the intermediate data, and obtaining target data with a standard data structure, the on-chain data of at least one blockchain can be converted into target data with the same standard data structure, and performing transaction behavior analysis operations based on the target data combined with at least one blockchain, thereby reducing the situation of processing the on-chain data of each blockchain separately, reducing the analysis workload, and improving the analysis efficiency.
[0101] See also Figure 2 , Figure 2 A flowchart showing another method for converting on-chain data provided by an embodiment of the present application is shown, which may specifically include the following steps:
[0102] Step 201, obtaining on-chain data of at least one blockchain.
[0103] For the relevant description of step 201, please refer to step 101 and will not be repeated here.
[0104] Step 202, determine the on-chain data corresponding to each transaction voucher type, and determine the parsing method corresponding to each transaction voucher type.
[0105] Among them, different transaction voucher types can correspond to different parsing methods, and the same transaction voucher type can correspond to different parsing methods in different blockchains.
[0106] After obtaining the on-chain data, the on-chain data of each transaction voucher type can be determined separately, and the parsing method corresponding to each transaction voucher type can be determined.
[0107] It should be understood that on-chain data of different transaction voucher types can be encoded in different encoding methods, such as hexadecimal encoding, Base58 encoding, etc., and on-chain data of different transaction voucher types can have different data structures, so that the encoded data will also be different, that is, the decoding method of on-chain data of different transaction voucher types will also be different. For each type of on-chain data of transaction voucher, the corresponding encoding method can be used for encoding, and the same decoding method as the encoding method can be used for parsing during decoding.
[0108] In practical applications, the data structure of the on-chain data of each transaction voucher type can be determined in advance, and the encoding method and decoding method corresponding to each transaction voucher type can be defined based on the transaction voucher type and the data structure of the on-chain data of each transaction voucher type. After obtaining the on-chain data, the on-chain data of each transaction voucher type and its corresponding decoding method can be determined, that is, the parsing method corresponding to each transaction voucher type can be determined.
[0109] Step 203: parse the on-chain data in accordance with the parsing method corresponding to the transaction voucher type to obtain decoded data of the on-chain data.
[0110] The decoded data may be data obtained by parsing the on-chain data.
[0111] After determining the parsing method corresponding to each transaction voucher type, the corresponding parsing method can be used to parse the on-chain data of the transaction voucher type to obtain the decoded data corresponding to each transaction voucher type.
[0112] In practical applications, on-chain data of different transaction voucher types can be encoded using different encoding methods, such as hexadecimal encoding, Base58 encoding, and other encoding methods. Then, for on-chain data of different transaction voucher types, the same decoding method as the encoding method can be used, such as hexadecimal decoding, Base58 decoding, and other decoding methods to parse the on-chain data and obtain the decoded data of the on-chain data.
[0113] Step 204, extract the target field in the decoded data to obtain the transaction data corresponding to each transaction voucher type.
[0114] The target field may be a field in the decoded data that is related to the transaction behavior.
[0115] After obtaining the decoded data, the fields related to the transaction behavior in the decoded data can be extracted, such as the block identifier, the time when the transaction behavior occurred, the hash value of the block, and other fields, and then the transaction data corresponding to each transaction voucher type can be obtained.
[0116] Step 205: Create blank data with a standard data structure.
[0117] The blank data may be data having a standard data structure and not containing real data.
[0118] After obtaining the transaction data corresponding to each transaction voucher type, blank data with a standard data structure may be created according to a predefined standard data structure.
[0119] Step 206, update the transaction data to the fields at the corresponding positions in the blank data to obtain the intermediate data corresponding to each transaction voucher type.
[0120] After obtaining the blank data, the transaction data may be updated to the fields at the corresponding positions in the blank data to obtain the intermediate data, and further the intermediate data corresponding to each transaction voucher type may be obtained.
[0121] See also Figure 3 , Figure 3 A schematic diagram of blank data provided by an embodiment of the present application is shown. Figure 3 As shown, the data structure of the blank data is a standard data structure, including fields for storing transaction data, wherein the fields for storing transaction data include a field for storing a block identifier, a field for storing a block hash value, and a field for storing the occurrence time of the transaction behavior, and the values of the field for storing the block identifier, the field for storing the block hash value, and the field for storing the occurrence time of the transaction behavior are all empty values, and then the block identifier in the transaction data can be updated to the field for storing the block identifier in the blank data, and the block hash value in the transaction data can be updated to the field for storing the block hash value in the blank data to obtain intermediate data.
[0122] And, if Figure 3 As shown, the blank data may also include a field for storing log data and a field for storing liquidity pool data, and the values of the field for storing log data and the field for storing liquidity pool data are null values. After obtaining the liquidity pool data and the log data, the liquidity pool data and the log data can be added to the corresponding fields to obtain the target data.
[0123] Step 207, extract the liquidity pool data corresponding to each transaction voucher type from the on-chain data, and obtain the log data corresponding to the transaction data from each node of the blockchain.
[0124] Step 208, adding the liquidity pool data and the log data to the intermediate data to obtain the target data with a standard data structure.
[0125] For the related descriptions of step 207 to step 208, please refer to step 103 to step 104, which will not be repeated.
[0126] In an embodiment of the present application, by acquiring on-chain data of at least one blockchain, determining the on-chain data corresponding to each transaction voucher type, and determining the parsing method corresponding to each transaction voucher type, and parsing the on-chain data according to the parsing method corresponding to the transaction voucher type, obtaining decoded data of the on-chain data, extracting the target field in the decoded data, obtaining the transaction data corresponding to each transaction voucher type, creating blank data with a standard data structure, and updating the transaction data to the field at the corresponding position in the blank data, obtaining the intermediate data corresponding to each transaction voucher type, extracting the liquidity pool data corresponding to each transaction voucher type from the on-chain data, and obtaining the log data corresponding to the transaction data from each node of the blockchain, adding the liquidity pool data and the log data to the intermediate data, and obtaining the target data with a standard data structure, the on-chain data of at least one blockchain can be converted into the target data with the same standard data structure, and the transaction behavior analysis operation is performed based on the target data combined with at least one blockchain, thereby reducing the situation of processing the on-chain data of each blockchain separately, reducing the analysis workload, and improving the analysis efficiency.
[0127] Reference Figure 4 , Figure 4 A flowchart of a method for converting on-chain data provided by an embodiment of the present application is shown, which may specifically include the following steps:
[0128] Step 401, pull the on-chain data of different transaction voucher types through at least two reading levels, and retrieve the corresponding log data, wherein the on-chain data includes transaction data and liquidity pool data.
[0129] Step 402: parse the on-chain data to obtain transaction data.
[0130] Step 403, convert the numerical unit of the liquidity pool data into the numerical unit of the same type as the benchmark transaction voucher to obtain the converted liquidity pool data.
[0131] Step 404, create blank data according to the standard data structure, and add the transaction data to the corresponding fields of the blank data to obtain intermediate data.
[0132] Step 405, adding the liquidity pool data and the log data to the corresponding fields of the intermediate data to obtain the target data.
[0133] Step 406: input the target data into the transaction data table, and generate at least one derivative table of the analysis angle based on the transaction data table.
[0134] In practical applications, data integrity checks can also be performed on derivative tables and transaction data tables.
[0135] In an embodiment of the present application, by obtaining on-chain data of at least one blockchain, and extracting transaction data corresponding to each transaction voucher type from the on-chain data, generating intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure, extracting liquidity pool data corresponding to each transaction voucher type from the on-chain data, obtaining log data corresponding to the transaction data from each node of the blockchain, adding the liquidity pool data and the log data to the intermediate data, and obtaining target data with a standard data structure, the on-chain data of at least one blockchain can be converted into target data with the same standard data structure, and performing transaction behavior analysis operations based on the target data combined with at least one blockchain, thereby reducing the situation of processing the on-chain data of each blockchain separately, reducing the analysis workload, and improving the analysis efficiency.
[0136] Reference Figure 5 , Figure 5 The schematic diagram of the structure of a device for converting on-chain data provided by an embodiment of the present application is shown, which may specifically include the following modules:
[0137] An acquisition module 501 is used to acquire on-chain data of at least one blockchain, and extract transaction data corresponding to each transaction voucher type from the on-chain data;
[0138] A generating module 502, for generating intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure;
[0139] Extraction module 503, used to extract liquidity pool data corresponding to each transaction voucher type from the on-chain data, and obtain log data corresponding to the transaction data from each node of the blockchain; wherein the liquidity pool data is used to evaluate transaction behaviors related to the transaction voucher type;
[0140] The adding module 504 is used to add the liquidity pool data and the log data to the intermediate data to obtain the target data with a standard data structure.
[0141] In one implementation, the acquisition module 501 may be specifically used for:
[0142] Create at least two reading programs, and use at least two reading programs to simultaneously read the on-chain data of the target node in each blockchain; wherein the target node is a node with the same transaction voucher type in the blockchain;
[0143] According to the transaction voucher type, the on-chain data is divided into at least one on-chain data set; wherein the on-chain data set corresponds to the transaction voucher type one by one.
[0144] In one implementation, the acquisition module 501 may be specifically used for:
[0145] Determine the time when each on-chain data is added in each blockchain;
[0146] According to the adding time, the on-chain data of the target node in each blockchain within the target time period is read simultaneously by at least two reading programs; wherein the target time period is related to the reading cycle of reading the on-chain data.
[0147] In one implementation, the acquisition module 501 may be specifically used for:
[0148] Determine the on-chain data corresponding to each transaction voucher type, and determine the parsing method corresponding to each transaction voucher type; different transaction voucher types correspond to different parsing methods, and the same transaction voucher type corresponds to different parsing methods in different blockchains;
[0149] Parse the on-chain data according to the parsing method corresponding to the transaction voucher type to obtain decoded data of the on-chain data; different transaction voucher types correspond to different parsing methods;
[0150] The target field in the decoded data is extracted to obtain the transaction data corresponding to each transaction voucher type; wherein the target field is a field in the decoded data related to the transaction behavior.
[0151] In one implementation, the generating module 502 may be specifically used for:
[0152] Create blank data with standard data structure;
[0153] Update the transaction data to the fields at the corresponding positions in the blank data to obtain the intermediate data corresponding to each transaction voucher type.
[0154] In one implementation, the device may further include the following modules:
[0155] A conversion module is used to convert the numerical units of liquidity pool data into numerical units corresponding to a benchmark transaction voucher type before adding liquidity pool data and log data to intermediate data to obtain target data with a standard data structure; wherein the benchmark transaction voucher type is a transaction voucher type used for transaction behavior analysis among all transaction voucher types.
[0156] In one implementation, the device may further include the following modules:
[0157] An input module, used for inputting target data into a pre-set transaction data table;
[0158] In one implementation, the generating module 502 may be specifically used for:
[0159] A derivative table of at least one analysis angle is generated based on the transaction data table; wherein the derivative table is used to perform transaction behavior analysis operations according to the corresponding analysis angle.
[0160] In one implementation, the generating module 502 may be specifically used for:
[0161] Generate at least one derived table of analysis angle based on the transaction data table, including:
[0162] Identify at least one analytical perspective;
[0163] According to the standard data structure, the data related to each analysis angle is read from the transaction data table respectively to obtain a derivative table corresponding to each analysis angle.
[0164] In an embodiment of the present application, by obtaining on-chain data of at least one blockchain, and extracting transaction data corresponding to each transaction voucher type from the on-chain data, generating intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure, extracting liquidity pool data corresponding to each transaction voucher type from the on-chain data, obtaining log data corresponding to the transaction data from each node of the blockchain, adding the liquidity pool data and the log data to the intermediate data, and obtaining target data with a standard data structure, the on-chain data of at least one blockchain can be converted into target data with the same standard data structure, and performing transaction behavior analysis operations based on the target data combined with at least one blockchain, thereby reducing the situation of processing the on-chain data of each blockchain separately, reducing the analysis workload, and improving the analysis efficiency.
[0165] It should be noted that the information interaction, execution process and other contents between the above-mentioned devices are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0166] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0167] Reference Figure 6 , Figure 6 A structural block diagram of a terminal device provided by an embodiment of the present application is shown as follows: Figure 6 As shown, an embodiment of the present application also provides a terminal device 61, which includes: at least one processor 611, a memory 612, and a computer program 6121 stored in the memory 612 and executable on the at least one processor 611, and when the processor 611 executes the computer program 6121, the steps in any of the above-mentioned method embodiments are implemented.
[0168] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any one of the above method embodiments can be implemented.
[0169] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0170] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the camera device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium.
[0171] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for converting on-chain data, characterized in that: The method comprises: Obtain on-chain data of at least one blockchain, and extract transaction data corresponding to each transaction voucher type from the on-chain data; Generate intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure; Extracting liquidity pool data corresponding to each of the transaction voucher types from the on-chain data, and obtaining log data corresponding to the transaction data from each node of the blockchain; wherein the liquidity pool data is used to evaluate transaction behaviors related to the transaction voucher type; The liquidity pool data and the log data are added to the intermediate data to obtain target data having the standard data structure.
2. The method for converting on-chain data according to claim 1, characterized in that: The obtaining of on-chain data of at least one blockchain includes: Creating at least two reading programs, and simultaneously reading the on-chain data of each target node in the blockchain through at least two of the reading programs; wherein the target node is a node with the same transaction voucher type in the blockchain; According to the transaction voucher type, the on-chain data is divided into at least one on-chain data set; wherein the on-chain data set corresponds one-to-one to the transaction voucher type.
3. The method for converting on-chain data as claimed in claim 2, characterized in that: The simultaneously reading the on-chain data of the target node in each of the blockchains through at least two of the reading programs includes: Determine the time when each of the on-chain data in each of the blockchains is added; According to the adding time, the on-chain data of the target node in each blockchain within the target time period is simultaneously read by at least two of the reading programs; wherein the target time period is related to the reading cycle of reading the on-chain data.
4. The method for converting on-chain data according to any one of claims 1 to 3, characterized in that: The extracting transaction data corresponding to each transaction voucher type from the on-chain data includes: Determine the on-chain data corresponding to each of the transaction voucher types, and determine the parsing method corresponding to each of the transaction voucher types; wherein different transaction voucher types correspond to different parsing methods, and the same transaction voucher type corresponds to different parsing methods in different blockchains; Parsing the on-chain data according to a parsing method corresponding to the transaction voucher type to obtain decoded data of the on-chain data; Extract the target field in the decoded data to obtain transaction data corresponding to each of the transaction voucher types; wherein the target field is a field in the decoded data related to the transaction behavior.
5. The method for converting on-chain data according to claim 4, characterized in that: Generating the intermediate data corresponding to each transaction voucher type according to the transaction data and the standard data structure includes: Create blank data with standard data structure; The transaction data is updated to the fields at corresponding positions in the blank data to obtain intermediate data corresponding to each transaction voucher type.
6. The method for converting on-chain data according to any one of claims 1 to 3 or 5, characterized in that: Before adding the liquidity pool data and the log data to the intermediate data to obtain the target data having the standard data structure, the method further includes: The numerical unit of the liquidity pool data is converted into a numerical unit corresponding to a benchmark transaction voucher type; wherein the benchmark transaction voucher type is a transaction voucher type used for transaction behavior analysis among all the transaction voucher types.
7. The method for converting on-chain data according to claim 6, characterized in that: The method further comprises: Inputting the target data into a preset transaction data table; A derivative table of at least one analysis angle is generated based on the transaction data table; wherein the derivative table is used to perform transaction behavior analysis operations according to the corresponding analysis angle.
8. The method for converting on-chain data according to claim 7, characterized in that: The generating at least one derivative table of analysis angle based on the transaction data table comprises: Identify at least one analytical perspective; According to the standard data structure, data related to each analysis angle is read from the transaction data table respectively to obtain a derivative table corresponding to each analysis angle.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
10. A computer program product, comprising a computer program, which enables the computer to perform the method according to any one of claims 1 to 8 when the computer program is run on a computer.