Bitcoin transaction autonomous message extraction and analysis method
By synchronizing and parsing blockchain data in a Bitcoin client, extracting and parsing autonomous messages, the problem of neglecting autonomous messages in existing technologies is solved, enabling effective monitoring and public opinion analysis of multi-chain systems and improving network security.
Patent Information
- Application Number
- CN202210878845.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-25
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-07-25
AI Technical Summary
Existing blockchain monitoring technologies primarily focus on transaction relationships between users, neglecting the autonomous messages of individual transactions within the blockchain, especially the extraction and analysis of online public opinion messages.
By building a Bitcoin client to synchronize block stream data, parsing and structuring the data, extracting transaction output scripts, verifying transaction validity, extracting blockchain features, constructing a transaction autonomous message data table, decoding autonomous messages using decoding algorithms, and merging messages through address association analysis to form a merged message.
It enables the effective extraction and parsing of autonomous messages from Bitcoin transactions, is applicable to various blockchain systems, improves the effectiveness of online public opinion monitoring and information analysis, and enhances cyberspace security.
Smart Images

Figure CN116012150B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of blockchain data mining technology, and specifically relates to a method for extracting and parsing autonomous messages from Bitcoin transactions. Background Technology
[0002] With the development of blockchain technology, public blockchains, due to their decentralized and difficult-to-regulate characteristics, are often used in illegal financial activities. Traditional blockchain monitoring technologies typically focus on transaction tracing, often employing address clustering or graph methods, and paying more attention to the transaction relationships between users, while neglecting anomalies in the content of individual transactions. In blockchain systems, in addition to conducting transactions, users can add autonomous transaction messages. These messages can consist of arbitrary content and may include online public opinion messages, but currently there are no effective methods for extracting and parsing such messages.
[0003] Traditional blockchain monitoring technologies generally include the following:
[0004] (1) Blockchain monitoring method based on address clustering: Bitcoin adopts the UTXO model, and the same entity user can have multiple transaction addresses in the network. In terms of entity user address clustering, identifying which addresses belong to the same entity from abnormal transaction records is an important problem.
[0005] (2) Blockchain monitoring method based on graph matching: Taking airdrop candy and greedy investment as typical examples of abnormal transaction behaviors, judgment rules for the two types of abnormal transaction behaviors were designed respectively.
[0006] (3) Blockchain monitoring method based on complex networks: using complex network analysis techniques to study the Bitcoin transaction network, especially effectively using community detection to re-identify multiple addresses belonging to the same user.
[0007] Traditional blockchain monitoring technologies focus on transaction relationships between blockchain users, neglecting to analyze information unrelated to these transactions. Recent blockchain commentary incidents demonstrate that detecting and analyzing blockchain transaction data to achieve public opinion monitoring on the blockchain is a crucial research area in blockchain data mining. Summary of the Invention
[0008] To address the aforementioned problems, the present invention aims to provide a method for extracting and parsing autonomous messages in Bitcoin transactions.
[0009] To achieve the above objectives, the Bitcoin transaction autonomous message extraction and parsing method provided by this invention includes the following steps performed in sequence:
[0010] 1) Set up a Bitcoin client and synchronize the raw block stream data to the local machine; then parse and structure the raw block stream data to obtain Bitcoin structured data; then obtain the output script for each transaction from the Bitcoin structured data;
[0011] 2) Verify the algorithm using trading scripts The validity of the above transaction output script is verified. If the verification passes, it indicates that the transaction is genuine and valid, and does not contain transaction autonomy messages; if the verification fails, the result returned is a transaction autonomy message. ;
[0012] 3) From the above-mentioned autonomous transaction information Extract blockchain features from the data, and then use the aforementioned autonomous transaction messages and blockchain features to construct a data table for autonomous transaction messages;
[0013] 4) Read transaction autonomy messages sequentially from the transaction autonomy message data table. Using the autonomous transaction message decoding algorithm Regarding the aforementioned transaction information Decode the message to obtain the decoded message. Then the information will be decoded. Inserted as a feature into the transaction autonomous message data table;
[0014] 5) By decoding the above messages Perform feature extraction and recognition to decode the message. Perform cleaning and retrieve the successfully decoded information. Decodeable tags Marked as 1, this is the decodable flag for other decoded messages. Mark it as 0, and add the above decodable marker. Inserted as a feature into the transaction autonomous message data table;
[0015] 6) Message fusion algorithm based on transaction address association analysis Autonomous message of a successfully decoded transaction Perform fusion judgment and autonomous message processing of fusionable transactions. The merged messages are generated. ;
[0016] 7) From the merged message Extract the message sequence number before fusion And construct a transaction autonomous message fusion message data table.
[0017] In step 1), the Bitcoin client is set up to synchronize the original block stream data to the local machine; then the original block stream data is parsed and structured to obtain Bitcoin structured data; the specific method for obtaining the output script for each transaction from the Bitcoin structured data is as follows:
[0018] Set up a Bitcoin Core client and synchronize the raw block stream data Dt to your local machine. Then, parse and structure the raw block stream data Dt to obtain Bitcoin structured data St. Here, the raw block stream data Dt represents all block data in the Bitcoin system up to time t; the Bitcoin structured data St is obtained by processing the block data before time t, including the block size. First, a transaction list Tx_List is generated. Then, the transaction list Tx_List is retrieved from the Bitcoin structured data St to output the Script field in the Outputs array, ultimately obtaining the script output for each transaction. .
[0019] In step 3), the above-mentioned autonomous transaction message The specific method for extracting blockchain features and then constructing a transaction autonomous message data table using the aforementioned transaction autonomous messages and blockchain features is as follows:
[0020] From the above transaction autonomy information Extracting blockchain features: serial number Block hash Transaction version number Block height Block generation time Transaction hash Input script transaction hash Enter the amount , Enter address Transaction fees Output script , ASCII script Decoding output script Then, the transaction autonomy message data table is constructed using the aforementioned transaction autonomy message and blockchain features.
[0021] In step 4), the transaction autonomy message decoding algorithm is used. Regarding the aforementioned transaction information Decode the message to obtain the decoded message. The specific methods are as follows:
[0022] 401) Construct an encoding table using known autonomous message encoding rules for transactions.
[0023] 402) Read one transaction autonomy message from the transaction autonomy message data table.
[0024] 403) Read out The first two digits of a hexadecimal string are used to convert it to a char character. bytes
[0025] 404) Judgment Character Char bytes If the character is a natural language character, proceed to step 405; otherwise, proceed to step 406.
[0026] 405) Execute step 410) until the transaction autonomy message. The hexadecimal string is empty, ultimately resulting in the autonomous transaction message. Decoded message
[0027] 406) Continue reading the autonomous transaction message. The first two digits of the hexadecimal string are encoded according to Unicode rules. If the decoding rule is found, proceed to step 407; otherwise, proceed to step 408.
[0028] 407) According to Decode and tag the encoding language of the transaction autonomy message; repeat step 403) until the transaction autonomy message is complete. The hexadecimal string is empty, ultimately resulting in the autonomous transaction message. Decoded message
[0029] 408) Transaction Autonomous Message Marked as undecodeable
[0030] 409) Decode the information If a transaction autonomous message is inserted as a feature into the transaction autonomous message data table, and the transaction autonomous message cannot be decoded, then the transaction autonomous message is inserted. ;
[0031] 410) Repeat steps 402)-409) until all transaction autonomous messages are received. Decoding complete.
[0032] In step 6), the message fusion algorithm based on transaction address association analysis... Autonomous message data that has been successfully decoded Perform fusion assessment and merge fusion-compatible autonomous message data. The merged messages are generated. The specific methods are as follows:
[0033] 601) Input a decoded message for a transaction autonomy message.
[0034] 602) Utilizing fusionable message recognition algorithms Determine the decoded message Is it a mergeable message? If yes, proceed to step 603; otherwise, proceed to step 606.
[0035] 603) If the message is a backward fusion message, proceed to step 604); if the message is a forward fusion message, proceed to step 605); if the message is not a fusionable message, proceed to step 606).
[0036] 604) Read the input script transaction hash of the decoded message from the transaction autonomy message data table generated in step 3). Determine if there are any mergeable messages in the output of the transaction. If so, perform message fusion and generate a fused message. Execute step 606).
[0037] 605) Read the transaction hash of the decoded message from the transaction autonomy message data table generated in step 3). Determine whether messages can be merged using the transaction hash as input to the script transaction hash. If it exists, perform message fusion and generate a fused message.
[0038] 606) Repeat steps 601)-605) until all transaction autonomous messages have been decoded and merged.
[0039] In step 602), the fusionable message recognition algorithm is used. Determine the decoded message The specific method for determining whether a message is fusion-compatible is as follows:
[0040] 60201) Initialize the character table to be matched, containing the flag bit of each character to be matched, with all character flag bits set to 0;
[0041] 60202) Input a decoded message for a transaction autonomy message. ;
[0042] 60203) From the decoded message Read a character and determine whether the character is the character to be matched. If the character is the character to be matched, execute step 60204); otherwise, execute step 60205.
[0043] 60204) Determine whether the character is a start character or a stop character. If it is a start character, increment the flag value of the character to be matched in the character to be matched table by 1; if it is a stop character, decrement the flag value of the character to be matched by 1; if it is neither a start character nor a stop character, do nothing.
[0044] 60205) Repeat steps 60202-60204) until the message is decoded. Empty;
[0045] 60206) Determine the flag values of all characters to be matched. If all are 0, the decoded message is not a mergeable message. If some characters to be matched have positive flag values and some have negative flag values, the decoded message is not a mergeable message. If some characters to be matched have positive flag values and the others are 0, the decoded message is a backward mergeable message and returns the character list to be matched. If some characters to be matched have negative flag values and the others are 0, the decoded message is a forward mergeable message and returns the character list to be matched.
[0046] The beneficial effects of the Bitcoin transaction autonomous message extraction and analysis method provided by this invention are:
[0047] 1. This method has universality: By analyzing the current blockchain technology architecture, it was found that this method is also applicable to mainstream blockchain systems such as Ethereum, EOS, Polkadot, and Fabric.
[0048] 2. The method is effective: Taking the relationship between sentiment and price changes in autonomous transaction messages as an example, the generated dataset has good performance in monitoring online public opinion.
[0049] 3. The method is progressive: This method for extracting and analyzing autonomous Bitcoin transaction messages helps to realize public opinion monitoring in blockchain systems, enhance cyberspace security, and improve information analysis capabilities. Attached Figure Description
[0050] Figure 1 The flowchart of the Bitcoin transaction autonomous message extraction and parsing method provided by the present invention.
[0051] Figure 2 This is a flowchart of the transaction script verification algorithm process in this invention.
[0052] Figure 3 This is a flowchart of the transaction autonomy message encoding and recognition algorithm in this invention.
[0053] Figure 4 This is a flowchart of the message fusion algorithm based on transaction address association analysis in this invention.
[0054] Figure 5 This is a flowchart of the fusion message recognition algorithm process in this invention. Detailed Implementation
[0055] The present invention will now be described in detail with reference to specific embodiments.
[0056] like Figures 1 to 5 As shown, the Bitcoin transaction autonomous message extraction and parsing method provided by this invention includes the following steps performed in sequence:
[0057] 1) Set up a Bitcoin client and synchronize the raw block stream data to the local machine; then parse and structure the raw block stream data to obtain Bitcoin structured data; then obtain the output script for each transaction from the Bitcoin structured data;
[0058] Set up a Bitcoin Core client and synchronize the raw block stream data Dt to your local machine. Then, parse and structure the raw block stream data Dt to obtain Bitcoin structured data St. Here, the raw block stream data Dt represents all block data in the Bitcoin system up to time t; the Bitcoin structured data St is obtained by processing the block data before time t, including the block size. First, a transaction list Tx_List is generated. Then, the transaction list Tx_List is retrieved from the Bitcoin structured data St to output the Script field in the Outputs array, ultimately obtaining the script output for each transaction. .
[0059] 2) Verify the algorithm using trading scripts The validity of the above transaction output script is verified. If the verification passes, it indicates that the transaction is genuine and valid, and does not contain transaction autonomy messages; if the verification fails, the result returned is a transaction autonomy message. ;
[0060] 3) From the above-mentioned autonomous transaction information Extract blockchain features from the data, and then use the aforementioned autonomous transaction messages and blockchain features to construct a data table for autonomous transaction messages;
[0061] The specific method is as follows:
[0062] From the above transaction autonomy information Extracting blockchain features: serial number Block hash Transaction version number Block height Block generation time Transaction hash Input script transaction hash Enter the amount , Enter address Transaction fees Output script , ASCII script Decoding output script Then, the transaction autonomy message data table is constructed using the aforementioned transaction autonomy message and blockchain features.
[0063] 4) Read transaction autonomy messages sequentially from the transaction autonomy message data table. Using the autonomous transaction message decoding algorithm Regarding the aforementioned transaction information Decode the message to obtain the decoded message. Then the information will be decoded. Inserted as a feature into the transaction autonomous message data table;
[0064] The specific method is as follows:
[0065] 401) Construct an encoding table using known autonomous message encoding rules for transactions.
[0066] 402) Read one transaction autonomy message from the transaction autonomy message data table.
[0067] 403) Read out The first two digits of a hexadecimal string are used to convert it to a char character. bytes
[0068] 404) Judgment Character Char bytes If the character is a natural language character, proceed to step 405; otherwise, proceed to step 406.
[0069] 405) Execute step 410) until the transaction autonomy message. The hexadecimal string is empty, ultimately resulting in the autonomous transaction message. Decoded message
[0070] 406) Continue reading the autonomous transaction message. The first two digits of the hexadecimal string are encoded according to Unicode rules. If the decoding rule is found, proceed to step 407; otherwise, proceed to step 408.
[0071] 407) According to Decode and tag the encoding language of the transaction autonomy message; repeat step 403) until the transaction autonomy message is complete. The hexadecimal string is empty, ultimately resulting in the autonomous transaction message. Decoded message
[0072] 408) Transaction Autonomous Message Marked as undecodeable
[0073] 409) Decode the information If a transaction autonomous message is inserted as a feature into the transaction autonomous message data table, and the transaction autonomous message cannot be decoded, then the transaction autonomous message is inserted. ;
[0074] 410) Repeat steps 402)-409) until all transaction autonomous messages are received. Decoding complete.
[0075] 5) By decoding the above messages Perform feature extraction and recognition to decode the message. Perform cleaning and retrieve the successfully decoded information. Decodeable tags Marked as 1, this is the decodable flag for other decoded messages. Mark it as 0, and add the above decodable marker. Inserted as a feature into the transaction autonomous message data table;
[0076] 6) Message fusion algorithm based on transaction address association analysis Autonomous message of a successfully decoded transaction Perform fusion judgment and autonomous message processing of fusionable transactions. The merged messages are generated. ;
[0077] The specific method is as follows:
[0078] 601) Input a decoded message for a transaction autonomy message.
[0079] 602) Utilizing fusionable message recognition algorithms Determine the decoded message Is it a mergeable message? If yes, proceed to step 603; otherwise, proceed to step 606.
[0080] 603) If the message is a backward fusion message, proceed to step 604); if the message is a forward fusion message, proceed to step 605); if the message is not a fusionable message, proceed to step 606).
[0081] 604) Read the input script transaction hash of the decoded message from the transaction autonomy message data table generated in step 3). Determine if there are any mergeable messages in the output of the transaction. If so, perform message fusion and generate a fused message. Execute step 606).
[0082] 605) Read the transaction hash of the decoded message from the transaction autonomy message data table generated in step 3). Determine whether messages can be merged using the transaction hash as input to the script transaction hash. If it exists, perform message fusion and generate a fused message.
[0083] 606) Repeat steps 601)-605) until all transaction autonomous messages have been decoded and merged.
[0084] In step 602), the fusionable message recognition algorithm is used. Determine the decoded message The specific method for determining whether a message is fusion-compatible is as follows:
[0085] 60201) Initialize the character table to be matched, containing the flag bit of each character to be matched, with all character flag bits set to 0;
[0086] 60202) Input a decoded message for a transaction autonomy message. ;
[0087] 60203) From the decoded message Read a character and determine whether the character is the character to be matched. If the character is the character to be matched, execute step 60204); otherwise, execute step 60205.
[0088] 60204) Determine whether the character is a start character or a stop character. If it is a start character, increment the flag value of the character to be matched in the character to be matched table by 1; if it is a stop character, decrement the flag value of the character to be matched by 1; if it is neither a start character nor a stop character, do nothing.
[0089] 60205) Repeat steps 60202-60204) until the message is decoded. Empty;
[0090] 60206) Determine the flag values of all characters to be matched. If all are 0, the decoded message is not a mergeable message. If some characters to be matched have positive flag values and some have negative flag values, the decoded message is not a mergeable message. If some characters to be matched have positive flag values and the others are 0, the decoded message is a backward mergeable message and returns the character list to be matched. If some characters to be matched have negative flag values and the others are 0, the decoded message is a forward mergeable message and returns the character list to be matched.
[0091] 7) From the merged message Extract the message sequence number before fusion And construct a transaction autonomous message fusion message data table.
Claims
1. A method for extracting and parsing autonomous messages in Bitcoin transactions, characterized in that: The method for extracting and parsing autonomous Bitcoin transaction messages includes the following steps performed in sequence: 1) Set up a Bitcoin client and synchronize the raw block stream data to the local machine; then parse and structure the raw block stream data to obtain Bitcoin structured data; Then, the script for each transaction is obtained from the Bitcoin structured data; 2) Verify the algorithm using trading scripts Verify the validity of the above transaction output script. If the verification passes, it indicates that the transaction is genuine and valid, and does not contain transaction autonomy messages; if the verification fails, the result returned is a transaction autonomy message. ; 3) From the above-mentioned autonomous transaction information Extract blockchain features from the data, and then use the aforementioned autonomous transaction messages and blockchain features to construct a data table for autonomous transaction messages; 4) Read the autonomous transaction messages sequentially from the autonomous transaction message data table. Using the autonomous transaction message decoding algorithm Regarding the aforementioned transaction information Decode the message to obtain the decoded message. ; Then decode the information Inserted as a feature into the transaction autonomous message data table; 5) By decoding the above messages Perform feature extraction and recognition to decode the message. Perform cleaning and retrieve the successfully decoded information. Decodeable tags Marked as 1, this is the decodable flag for other decoded messages. Mark it as 0, and add the above decodable marker. Inserted as a feature into the transaction autonomous message data table; 6) Message fusion algorithm based on transaction address association analysis Autonomous message of a successfully decoded transaction Perform fusion judgment and autonomous message processing of fusionable transactions. The merged message is generated. ; 7) From the merged message Extract the message sequence number before fusion And construct a transaction autonomous message fusion message data table.
2. The method for extracting and parsing autonomous messages in Bitcoin transactions according to claim 1, characterized in that: In step 1), the Bitcoin client is set up to synchronize the original block stream data to the local machine; then the original block stream data is parsed and structured to obtain Bitcoin structured data. The specific method for obtaining the output script for each transaction from the Bitcoin structured data is as follows: Set up a Bitcoin Core client and synchronize the original block stream data Dt to the local machine; parse and structure the original block stream data Dt to obtain Bitcoin structured data St; where the original block stream data Dt represents all block data of the Bitcoin system up to time t; Bitcoin's structured data St is obtained by processing the block data up to time t, including the block size. Transaction list Tx_List; Next, the transaction list Tx_List is retrieved from the Bitcoin structured data St to output the Script field in the Outputs array, ultimately obtaining the script output for each transaction. .
3. The method for extracting and parsing autonomous messages in Bitcoin transactions according to claim 1, characterized in that: In step 3), the above-mentioned autonomous transaction message The specific method for extracting blockchain features and then constructing a transaction autonomous message data table using the aforementioned transaction autonomous messages and blockchain features is as follows: From the above transaction autonomy information Extracting blockchain features: Serial Number Block hash Transaction version number Block height Block generation time Transaction hash Input script transaction hash Enter the amount , Enter address Transaction fees Output script , ASCII script Decoding output script Then, the transaction autonomy message data table is constructed using the aforementioned transaction autonomy message and blockchain features.
4. The method for extracting and parsing autonomous messages in Bitcoin transactions according to claim 1, characterized in that: In step 4), the transaction autonomy message decoding algorithm is used. Regarding the aforementioned transaction information Decode the message to obtain the decoded message. The specific methods are as follows: 401) Construct an encoding table using known autonomous message encoding rules for transactions. ; 402) Read one transaction autonomy message from the transaction autonomy message data table. ; 403) Read the autonomous message of the transaction. The first two digits of a hexadecimal string are used to convert it to a char character. bytes ; 404) Determine if the character is Char bytes If the character is a natural language character, proceed to step 405; otherwise, proceed to step 406. 405) Execute step 410) until the transaction autonomy message. The hexadecimal string is empty, ultimately resulting in the autonomous transaction message. Decoded message ; 406) Continue reading the transaction autonomy message The first two digits of the hexadecimal string are encoded according to the Unicode encoding rules in the encoding table. If the decoding rule is found, proceed to step 407; otherwise, proceed to step 408. 407) According to the coding table Decode and tag the encoding language of the transaction autonomy message; repeat step 403) until the transaction autonomy message is complete. The hexadecimal string is empty, ultimately resulting in the autonomous transaction message. Decoded message ; 408) Transaction Autonomous Message Marked as undecodeable; 409) Decode the information If a transaction autonomous message is inserted as a feature into the transaction autonomous message data table, and the transaction autonomous message cannot be decoded, then the transaction autonomous message is inserted. ; 410) Repeat steps 402)-409) until all transaction autonomous messages are received. Decoding complete.
Citation Information
Patent Citations
Block chain case information management method and device, electronic equipment and storage medium
CN111639914A
Blockchain transaction data governance method and device, computer equipment and storage medium
CN112581129A