Disclosure of Invention
The embodiment of the invention provides a blockchain transaction information auditing method and device, which are used for supervising the transaction behaviors of users on a blockchain and guaranteeing the safety and usability of the blockchain.
The method for auditing the blockchain transaction information provided by the embodiment of the invention comprises the following steps:
acquiring the block height of a block chain, and acquiring newly-added transaction information of the block chain if the block height of the block chain is larger than the block height of a local storage;
according to the newly-added transaction information, transaction user audit, transaction data audit and transaction quantity audit are carried out on the newly-added transaction information;
And after auditing that the newly added transaction information is abnormal information, processing the abnormal information.
According to the technical scheme, the auditing platform is arranged and connected with the blockchain, the auditing platform periodically acquires the blockchain block height, if the blockchain block height is determined to be larger than the locally stored blockchain block height, new transaction information, namely, newly-added transaction information, is stored in the blockchain, the auditing platform acquires the newly-added transaction information from the blockchain, audits different dimensions according to the newly-added transaction information, namely, audits the newly-added transaction information on the blockchain from three dimensions of transaction users, transaction data and transaction quantity, and processing is performed after the newly-added transaction information is audited to be abnormal transaction. And auditing the newly-added transaction information sent by the user on the blockchain through multiple dimensions, so that the transaction behavior of the user on the blockchain is effectively supervised, and the safety and the usability of the blockchain are ensured.
Optionally, the auditing the transaction user for the new transaction information according to the new transaction information includes:
Determining a transaction user sending the newly-added transaction information according to the newly-added transaction information;
Judging whether a preset user white list contains the transaction user or not;
If not, determining the newly added transaction information as user abnormal information.
According to the technical scheme, the auditing platform carries out transaction user auditing on the newly-added transaction information according to the newly-added transaction information, namely, determines a transaction user sending the newly-added transaction information, judges whether the transaction user is in a preset user white list, if not, determines that the transaction user sending the newly-added transaction information is an abnormal transaction user, and the newly-added transaction information is user abnormal information. And judging whether the newly-added transaction information sent by the transaction user is normal transaction or not from the dimension of the transaction user, and effectively supervising the transaction user on the blockchain and the transaction behavior of the transaction user.
Optionally, the newly added transaction information is a deployment contract;
and the transaction data audit is carried out on the newly-added transaction information according to the newly-added transaction information, and the transaction data audit comprises the following steps:
determining a contract characteristic value of the deployment contract according to the deployment contract;
judging whether a preset contract white list contains the deployment contract or not according to the contract characteristic value of the deployment contract, and if not, determining that the newly-added transaction information is contract abnormal information.
According to the technical scheme, the auditing platform carries out transaction data auditing on the newly-added transaction information according to the newly-added transaction information, wherein the newly-added transaction information can be a deployment contract, the auditing platform determines a contract characteristic value according to the deployment contract, then determines whether the deployment contract is in a contract white list according to the contract characteristic value, if not, determines that the deployment contract is about an abnormal contract, and the newly-added transaction information is contract abnormal information. And identifying abnormal contracts deployed by transaction users and newly-added transaction information corresponding to the abnormal contracts from the transaction data dimension, and effectively supervising the transaction behaviors of the user deployment contracts on the blockchain.
Optionally, the newly added transaction information is a sending transaction;
and the transaction data audit is carried out on the newly-added transaction information according to the newly-added transaction information, and the transaction data audit comprises the following steps:
Determining a contract characteristic value corresponding to a destination address in the sending transaction according to the sending transaction;
according to the contract characteristic value corresponding to the destination address, determining a contract corresponding to the destination address from a preset contract white list;
and judging whether to determine a transaction interface of the sending transaction according to the contract corresponding to the destination address and the sending transaction, and if not, determining the newly-added transaction information as transaction abnormal information.
According to the technical scheme, the auditing platform carries out transaction data auditing on the newly-added transaction information according to the newly-added transaction information, wherein the newly-added transaction information can be a transmission transaction, the auditing platform determines a contract characteristic value corresponding to a destination address of the transmission transaction according to the transmission transaction, determines a contract corresponding to the destination address from a preset contract white list, judges whether a transaction interface of the transmission transaction can be determined according to the contract corresponding to the destination address and the transmission transaction, and if not, determines the newly-added transaction information to be transaction abnormal information. And identifying transaction abnormal information sent by a transaction user from the transaction data dimension, and effectively supervising the transaction behavior of the user sending the transaction on the blockchain.
Optionally, the newly added transaction information is a plurality of pieces;
The transaction quantity auditing of the newly-added transaction information is carried out according to the newly-added transaction information, and the method comprises the following steps:
Determining a transaction user sending the newly-added transaction information according to the newly-added transaction information;
for any transaction user, acquiring the quantity of newly-added transaction information of the transaction user;
If the number of the newly-added transaction information of the transaction user is larger than a preset transaction number threshold, determining that the transaction user is a number of abnormal transaction users and the newly-added transaction information of the transaction user is a number of abnormal information.
According to the technical scheme, the auditing platform can acquire a plurality of newly-added transaction information, the auditing platform determines transaction users of each newly-added transaction information, acquires the quantity of all newly-added transaction information of each transaction user, and determines that the transaction users are abnormal transaction users and determines that the newly-added transaction information of the abnormal transaction users is abnormal transaction information if the quantity of all newly-added transaction information of the transaction users is greater than a preset transaction quantity threshold. And identifying transaction users with abnormal quantity of the newly-added transaction information and the newly-added transaction information sent by the transaction users with abnormal quantity of the newly-added transaction information from the dimension of the transaction quantity, effectively supervising the quantity of the newly-added transaction information of the users on the blockchain, and preventing the users from abusing computing resources and storage resources on the blockchain.
Optionally, after the obtaining the new transaction information on the blockchain, the method further includes:
And storing the newly added transaction information to the local.
According to the technical scheme, after the audit platform acquires the newly-added transaction information, the transaction information is stored locally, and the audit platform continuously audits the newly-added transaction information on the blockchain.
Correspondingly, the embodiment of the invention also provides a device for auditing the blockchain transaction information, which comprises the following steps:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the block height of a block chain, and acquiring newly-added transaction information of the block chain if the block height of the block chain is larger than the locally-stored block height;
The processing unit is used for conducting transaction user audit, transaction data audit and transaction quantity audit on the newly-added transaction information according to the newly-added transaction information; and processing the abnormal information after auditing that the newly added transaction information is the abnormal information.
Optionally, the processing unit is specifically configured to:
Determining a transaction user sending the newly-added transaction information according to the newly-added transaction information;
Judging whether a preset user white list contains the transaction user or not;
If not, determining the newly added transaction information as user abnormal information.
Optionally, the newly added transaction information is a deployment contract;
The processing unit is specifically configured to:
determining a contract characteristic value of the deployment contract according to the deployment contract;
judging whether a preset contract white list contains the deployment contract or not according to the contract characteristic value of the deployment contract, and if not, determining that the newly-added transaction information is contract abnormal information.
Optionally, the newly added transaction information is a sending transaction;
The processing unit is specifically configured to:
Determining a contract characteristic value corresponding to a destination address in the sending transaction according to the sending transaction;
according to the contract characteristic value corresponding to the destination address, determining a contract corresponding to the destination address from a preset contract white list;
and judging whether to determine a transaction interface of the sending transaction according to the contract corresponding to the destination address and the sending transaction, and if not, determining the newly-added transaction information as transaction abnormal information.
Optionally, the newly added transaction information is a plurality of pieces;
The processing unit is specifically configured to:
Determining a transaction user sending the newly-added transaction information according to the newly-added transaction information;
for any transaction user, acquiring the quantity of newly-added transaction information of the transaction user;
If the number of the newly-added transaction information of the transaction user is larger than a preset transaction number threshold, determining that the transaction user is a number of abnormal transaction users and the newly-added transaction information of the transaction user is a number of abnormal information.
Optionally, the processing unit is further configured to:
After the acquisition unit acquires the newly-added transaction information on the blockchain, the newly-added transaction information is stored locally.
Accordingly, an embodiment of the present invention further provides a computing device, including:
A memory for storing program instructions;
And the processor is used for calling the program instructions stored in the memory and executing the blockchain transaction information auditing method according to the obtained program.
Correspondingly, the embodiment of the invention also provides a computer-readable nonvolatile storage medium, which comprises computer-readable instructions, and when the computer reads and executes the computer-readable instructions, the computer is caused to execute the method for auditing the blockchain transaction information.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 illustrates a system architecture applicable to a method for providing blockchain transaction information audit according to an embodiment of the present invention, where the system architecture may include an audit platform 100 and a blockchain 200, where the blockchain 200 includes a plurality of nodes, each node has a routing function, and each node performs peer-to-peer communication, such as sending transaction information or contract information, between each node, and the audit platform 100 may read block data of each node in the blockchain 200 and audit the transaction information in the block data according to the block data.
Based on the above description, fig. 2 illustrates a flow of a blockchain transaction information auditing method according to an embodiment of the present invention, where the flow may be executed by a blockchain transaction information auditing device, and the device may be located in or be an auditing platform. As shown in fig. 2, the process specifically includes:
step 201, obtaining the block height of the block chain, if the block height of the block chain is greater than the block height of the local storage, obtaining the newly added transaction information of the block chain.
The auditing platform periodically acquires the block height of the block chain, compares the block height of the block chain with the block height of the local storage, and if the block height of the block chain is larger than the block height of the local storage, can determine that new transaction information, namely new transaction information, is stored on the block chain, and the auditing platform acquires the new transaction information. Here, the audit platform may obtain the block heights of the blockchain within a preset audit period, which may be empirically set to one hour or one day or other durations.
Optionally, after obtaining the new transaction information on the blockchain, the audit platform may further store the new transaction information locally. For example, the preset audit period of the audit platform is one day, the audit platform obtains the block height of the blockchain to be 1000 in the current preset audit period (the first day), and the locally stored block height is 800, so that it can be determined that the block height of the blockchain is greater than the locally stored block height, the audit platform obtains the newly added transaction data, namely the transaction data in the newly added block with the block height of 200, and the audit platform obtains the newly added transaction data and then stores the newly added transaction data locally, namely the locally stored block height becomes 1000. Further, if the audit platform acquires the block height of 1300 on the blockchain in the next preset audit period (the next day), transaction data in a newly-added block with the block height of 300 can be further acquired and stored locally, so that the audit platform can continuously audit the newly-added transaction information on the blockchain.
Step 202, according to the newly-added transaction information, transaction user audit, transaction data audit and transaction quantity audit are carried out on the newly-added transaction information.
In order to facilitate the audit platform to audit the newly-added transaction information in the blockchain, audit elements, namely audit dimensions of the audit of the newly-added transaction information, and optionally, transaction user audit, transaction data audit and transaction quantity audit of the newly-added transaction information can be determined in advance. In addition, a user white list, a contract white list, a transaction quantity threshold value and the like can be preset, and the method is used for determining whether the newly added transaction information is abnormal information or not in a specific audit process.
In the embodiment of the invention, the auditing platform can audit the transaction user of the newly-added transaction information, namely audit the transaction user sending the newly-added transaction information, and a user white list can be preset in the auditing platform for judging whether the transaction user of the newly-added transaction information is an abnormal transaction user or not. Specifically, after determining the transaction user sending the newly-added transaction information according to the newly-added transaction information, the audit platform judges whether the transaction user is included in a preset user white list, if not, the transaction user is determined to be an abnormal transaction user, the newly-added transaction information is user abnormal information, and if so, the transaction user and the newly-added transaction information can be determined to be normal.
The auditing platform can analyze the newly added transaction information, acquire a user public key of the transaction user, compare the user public key of the transaction user with a user public key in a preset user white list, and if the user white list does not contain the user public key of the transaction user, determine that the transaction user is an abnormal transaction user, and further, the auditing platform can record key bytes of the user public key of the abnormal transaction user and then is used for identifying the abnormal transaction user, so that the subsequent processing of the abnormal transaction user is facilitated.
In the embodiment of the invention, the newly added transaction information can be divided into deployment contracts and sending transactions according to the transaction structure. Deploying contracts is understood as deploying new contracts in the blockchain after a user creates a new contract; the sending transaction is understood as that after a user generates a new transaction, the generated transaction is written into the blockchain; if the destination address of the newly added transaction information exists in the newly added transaction information, the newly added transaction information can be determined to be a sending transaction, the transaction Input information of the sending transaction can be obtained, otherwise, the newly added transaction information can be determined to be a deployment contract, and the contract Bin (BINary files, binary file) information of the deployment contract can be obtained.
Further, the audit platform carries out transaction data audit on the newly-added transaction information, and can audit the deployment contract or audit the transmitted transaction.
When the newly-added transaction information is a deployment contract, determining a contract characteristic value of the deployment contract according to the deployment contract, judging whether a preset contract white list contains the deployment contract or not according to the contract characteristic value of the deployment contract, if yes, determining that the deployment contract is a normal contract, if not, determining that the deployment contract is an abnormal contract, and determining that the newly-added transaction information is contract abnormal information. The audit platform can record key bytes after the abnormal contract is coded by using Binary, and is used for identifying the abnormal contract, so that the subsequent processing of the abnormal contract and a user deploying the abnormal contract is facilitated.
When the newly added transaction information is a sending transaction, the newly added transaction information comprises a destination address of the sending transaction, a contract characteristic value corresponding to the destination address in the sending transaction is determined according to the sending transaction, whether a preset contract white list contains a contract corresponding to the destination address is judged according to the contract characteristic value corresponding to the destination address, if yes, the contract corresponding to the destination address is determined from the preset contract white list, and if not, the sending transaction is determined to be transaction abnormal information. After determining the contract corresponding to the destination address from the preset contract white list, the method can combine with the sending transaction to judge whether the transaction interface of the sending transaction can be determined, if so, the sending transaction can be determined to be a normal sending transaction, meanwhile, the specific transaction interface corresponding to the sending transaction is determined, otherwise, the sending transaction is determined to be an abnormal sending transaction, and the newly-added transaction information is transaction abnormal information.
In the embodiment of the invention, the audit platform periodically acquires the newly-added transaction information, can acquire a plurality of pieces of newly-added transaction information, performs transaction quantity audit on the newly-added transaction information, can preset a transaction quantity threshold value, and performs audit on the transaction quantity of the newly-added transaction information sent by the same user in a preset audit period. That is, according to the newly added transaction information, determining the transaction user who sends the newly added transaction information, and for any transaction user, acquiring the number of the newly added transaction information of the transaction user, if the number of the newly added transaction information of the transaction user is greater than a preset transaction number threshold, determining that the transaction user is a transaction user with abnormal number and the newly added transaction information of the transaction user is abnormal number information.
If the preset auditing period is one day, the daily transaction quantity of the transaction user is audited, if the preset transaction quantity threshold is 1000, and the daily transaction quantity of a certain transaction user is 1500, the transaction quantity sent by the transaction user can be determined to exceed the preset transaction quantity threshold, the transaction user is a quantity abnormal transaction user, and all the transactions sent by the transaction user are quantity abnormal information.
In the embodiment of the invention, the auditing platform carries out transaction quantity audit on the newly-added transaction information, can audit the quantity of the newly-added transaction information sent by a certain user, can divide the newly-added transaction information sent by the user into two parts of deployment contracts and sending transactions according to the structure, respectively count the transaction quantity of the deployment contracts and the transaction quantity of the sending transactions sent by the user, and compare the transaction quantity of the deployment contracts of the auditing transaction user with a preset transaction quantity threshold value to audit the transaction quantity of the sending transactions of the auditing transaction user.
And 203, after auditing that the newly added transaction information is abnormal information, processing the abnormal information.
Step 202 can determine that the newly added transaction information is user exception information, contract exception information, transaction exception information, quantity exception information and the like by auditing the newly added transaction information in different dimensions, and generate exception data for different exception conditions, store the exception data in a local database and alarm, wherein the exception data can comprise address information of the abnormally added transaction information on a blockchain so as to facilitate management of the abnormally added transaction information by a supervisor.
For example, when it is determined that the daily transaction amount of a certain user is abnormal, abnormal data can be generated by the user and all the newly-added transaction information sent by the user, the abnormal data are stored in a local database, and the preset number of abnormal newly-added transaction information is randomly extracted from all the newly-added transaction information and sent to a supervisor for investigation by the supervisor.
The embodiment of the invention provides a specific implementation manner, and after setting the user white list, the contract white list and the transaction quantity threshold in the audit platform, the process shown in fig. 3 is executed.
Step 301, obtaining the block height on the block chain;
Step 302, judging whether the height of the block is larger than the height of the block stored locally; if yes, go to step 303; otherwise, turning to step 301;
step 303, obtaining newly added transaction information on the blockchain;
step 304, judging whether the newly added transaction information is abnormal information; if yes, go to step 305.
Specifically, multidimensional judgment can be performed on newly-added transaction information, and transaction user audit, transaction data audit and transaction quantity audit can be performed, wherein the transaction data audit can also be performed on deployment contracts and transmitted transactions.
Step 305, exception information processing.
According to the technical scheme, the auditing platform is arranged and connected with the blockchain, the auditing platform periodically acquires the blockchain block height, if the blockchain block height is determined to be larger than the locally stored blockchain block height, new transaction information, namely, newly-added transaction information, is stored in the blockchain, the auditing platform acquires the newly-added transaction information from the blockchain, audits different dimensions according to the newly-added transaction information, namely, audits the newly-added transaction information on the blockchain from three dimensions of transaction users, transaction data and transaction quantity, and processing is performed after the newly-added transaction information is audited to be abnormal transaction. And auditing the newly-added transaction information sent by the user on the blockchain through multiple dimensions, so that the transaction behavior of the user on the blockchain is effectively supervised, and the safety and the usability of the blockchain are ensured. Furthermore, the audit platform acquires the newly-added transaction information from the blockchain, audits the newly-added transaction information, only reads the blockchain data, does not relate to the normal transaction flow of the uplink, is decoupled from the on-chain transaction, therefore, does not occupy the storage resources and the computing resources of the blockchain, and does not increase the complexity of the on-chain system. Audit data is stored in a traditional database, and chain storage and merck tree storage are not involved, so that the influence of data volume increase on performance is reduced to the minimum.
Based on the same inventive concept, fig. 4 illustrates an exemplary structure of a blockchain transaction information auditing apparatus according to an embodiment of the present invention, where the apparatus may perform a flow of a blockchain transaction information auditing method.
The device comprises:
An obtaining unit 401, configured to obtain a block height on a blockchain, and if the block height on the blockchain is greater than a locally stored block height, obtain newly added transaction information on the blockchain;
The processing unit 402 is configured to perform transaction user audit, transaction data audit, and transaction quantity audit on the newly-added transaction information according to the newly-added transaction information; and processing the abnormal information after auditing that the newly added transaction information is the abnormal information.
Optionally, the processing unit 402 is specifically configured to:
Determining a transaction user sending the newly-added transaction information according to the newly-added transaction information;
Judging whether a preset user white list contains the transaction user or not;
If not, determining the newly added transaction information as user abnormal information.
Optionally, the newly added transaction information is a deployment contract;
the processing unit 402 is specifically configured to:
determining a contract characteristic value of the deployment contract according to the deployment contract;
judging whether a preset contract white list contains the deployment contract or not according to the contract characteristic value of the deployment contract, and if not, determining that the newly-added transaction information is contract abnormal information.
Optionally, the newly added transaction information is a sending transaction;
the processing unit 402 is specifically configured to:
Determining a contract characteristic value corresponding to a destination address in the sending transaction according to the sending transaction;
according to the contract characteristic value corresponding to the destination address, determining a contract corresponding to the destination address from a preset contract white list;
and judging whether to determine a transaction interface of the sending transaction according to the contract corresponding to the destination address and the sending transaction, and if not, determining the newly-added transaction information as transaction abnormal information.
Optionally, the newly added transaction information is a plurality of pieces;
the processing unit 402 is specifically configured to:
Determining a transaction user sending the newly-added transaction information according to the newly-added transaction information;
for any transaction user, acquiring the quantity of newly-added transaction information of the transaction user;
If the number of the newly-added transaction information of the transaction user is larger than a preset transaction number threshold, determining that the transaction user is a number of abnormal transaction users and the newly-added transaction information of the transaction user is a number of abnormal information.
Optionally, the processing unit 402 is further configured to:
After the acquisition unit 401 acquires the newly added transaction information on the blockchain, the newly added transaction information is stored locally.
Based on the same inventive concept, an embodiment of the present invention further provides a computing device, including:
A memory for storing program instructions;
And the processor is used for calling the program instructions stored in the memory and executing the blockchain transaction information auditing method according to the obtained program.
Based on the same inventive concept, the embodiment of the invention also provides a computer readable nonvolatile storage medium, which comprises computer readable instructions, wherein when the computer reads and executes the computer readable instructions, the computer executes the method for auditing the blockchain transaction information.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.