CN-121996710-A - Blockchain data query method, device, computer equipment, storage medium and computer program product
Abstract
The present application relates to a blockchain data query method, apparatus, computer device, storage medium and computer program product. The method comprises the steps of starting a query thread aiming at a new block on a target block chain, carrying out data query processing on the new block through the query thread to obtain block chain data, carrying out analysis processing on the block chain data to obtain block chain analysis data, storing the block chain analysis data into a target database, and searching and feeding back query data of the target block chain from the target database under the condition of receiving a data query request aiming at the target block chain. According to the application, the newly added block chain data is inquired, and the block chain data is directly stored in the target database after being analyzed, so that the inquiry data can be directly fed back based on the block chain data stored in the database, and the corresponding data is not required to be searched from the block chain in real time, thereby effectively improving the inquiry efficiency of the block chain data under the high concurrency condition.
Inventors
- Lv Pengzhen
Assignees
- 腾讯科技(深圳)有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241107
Claims (15)
- 1. A method of blockchain data querying, the method comprising: under the condition of a new block on a target block chain, starting a query thread aiming at the new block; performing data query processing on the newly added block through the query thread to obtain block chain data; Analyzing the blockchain data to obtain blockchain analysis data; Storing the blockchain resolution data to a target database; in the event that a data query request is received for the target blockchain, query data for the target blockchain is looked up and fed back from the target database.
- 2. The method of claim 1, wherein in the event of a new chunk on a target blockchain, starting a query thread for the new chunk comprises: Under the condition of a new block on a target block chain, starting a plurality of container nodes aiming at a plurality of the new blocks; In each container node, a plurality of query threads for the newly added block are started.
- 3. The method according to claim 2, wherein the method further comprises: Performing a liveness detection process on each link point of the target blockchain, and identifying healthy nodes of the target blockchain from the chain nodes; allocating a corresponding primary node and backup node for each container node based on the identified healthy nodes; the step of performing data query processing on the newly added block through the query thread to obtain blockchain data includes: And carrying out data query processing on the newly added block at the main node and the standby node through the query thread to obtain block chain data.
- 4. The method of claim 3, wherein the performing, by the query thread, the data query processing on the newly added block at the primary node and the standby node, the obtaining blockchain data includes: Performing data query processing on the newly added block at the main node through the query thread, and acquiring respective real-time live report detection results of the main node and the standby node under the condition that the main node fails in query; And determining that the real-time live detection result in the standby node is a healthy target node, and carrying out data query processing on the newly-added block at the target node through the query thread to obtain block chain data.
- 5. The method according to claim 4, wherein the method further comprises: and under the condition that the main node is monitored to restore health based on the real-time live report detection result, switching the query object of the query thread from the target node to the main node.
- 6. The method of claim 1, wherein parsing the blockchain data to obtain blockchain parsed data comprises: And analyzing the blockchain data through analysis software, obtaining blockchain analysis data under the condition of successful analysis, and recording abnormal blocks with failed analysis into a record database under the condition of failed analysis.
- 7. The method of claim 6, wherein the parsing the blockchain data to obtain blockchain parsed data further comprises: Under the condition that a software upgrading request aiming at the analysis software is received, upgrading the analysis software based on the software upgrading request to obtain upgraded software; And analyzing the abnormal blocks of the record database by upgrading software to obtain block chain analysis data.
- 8. The method according to claim 1, wherein the method further comprises: Under the condition that a storage failure message aiming at the block chain analysis data is received, under the limit of a maximum retry time interval, generating a storage request corresponding to the block chain analysis data in a progressive retry time interval; And storing the blockchain resolution data to a target database through the storage request.
- 9. The method of claim 1, wherein storing the blockchain resolution data to a target database comprises: Sending the storage message of the block chain analysis data to a message middleware queue; pushing the storage message to a storage thread through the message middleware queue to store the blockchain resolution data to a target database.
- 10. The method according to claim 9, wherein the method further comprises: deleting the stored message in the message middleware queue upon receiving a storage acknowledgement message for the blockchain resolution data; And under the condition that the storage confirmation message of the blockchain analysis data is not received after the time-out, pushing the storage message in the message middleware queue to a storage thread again so as to store the blockchain analysis data to the target database through the storage thread.
- 11. The method according to any one of claims 1 to 10, wherein, in the case of receiving a data query request for the target blockchain, searching and feeding back query data of the target blockchain from the target database, the query data of the target blockchain includes: Searching query data of a target blockchain from the target database under the condition that a data query request aiming at the target blockchain submitted by a blockchain browser is received; and displaying a display interface corresponding to the query data in the blockchain browser.
- 12. A blockchain data querying device, the device comprising: The thread starting module is used for starting a query thread aiming at the newly added block under the condition of the newly added block on the target block chain; The block data query module is used for carrying out data query processing on the newly added block through the query thread to obtain block chain data; The block data analysis module is used for analyzing the block chain data to obtain block chain analysis data; the block data storage module is used for storing the block chain analysis data to a target database; And the query processing module is used for searching and feeding back the query data of the target blockchain from the target database under the condition that the data query request aiming at the target blockchain is received.
- 13. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 11 when the computer program is executed.
- 14. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 11.
- 15. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 11.
Description
Blockchain data query method, device, computer equipment, storage medium and computer program product Technical Field The present application relates to the field of computer technology, and in particular, to a blockchain data query method, a blockchain data query device, a computer device, a storage medium, and a computer program product. Background With the development of computer technology and internet technology, a blockchain technology appears, and the blockchain is a distributed account book technology and generally consists of consensus, resource interaction blocks, state data storage, cryptography identity security and other contents. Since the account book is stored in a distributed mode and the blocks are commonly known, the account book has the characteristics of non-falsification, traceability, common maintenance and the like. The content to be identified by the blockchain is a block, and the block is composed of individual resource transfers and metadata. Execution of these resource transfers relies on execution of intelligent contracts and methods therefor. Transactions, addresses, blocks, etc. information on the blockchain may generally be viewed through a blockchain browser. The principle of operation of a blockchain browser is by sending a query request to the blockchain network, and then parsing the returned data and presenting it to the user in an easy-to-understand manner. Such data typically includes information on block height, block hash, transaction details, address balance, etc. Because the data on the blockchain is data in a stack of key values, the key value data is inconvenient to search and analyze, and in a high concurrency scene, the direct query chain can bring about performance bottlenecks of nodes, so that the data query efficiency for the blockchain data is affected. Disclosure of Invention In view of the foregoing, it is desirable to provide a blockchain data querying method, device, computer readable storage medium and computer program product that can ensure the data querying efficiency of a blockchain browser in a high concurrency scenario. In a first aspect, the present application provides a blockchain data querying method, including: under the condition of a new block on a target block chain, starting a query thread aiming at the new block; performing data query processing on the newly added block through the query thread to obtain block chain data; Analyzing the blockchain data to obtain blockchain analysis data; Storing the blockchain resolution data to a target database; In the event that a data query request is received for the target blockchain, query data of the target blockchain is searched and fed back from the target database. In a second aspect, the present application also provides a blockchain data querying device, including: The thread starting module is used for starting a query thread aiming at the newly added block under the condition of the newly added block on the target block chain; The block data query module is used for carrying out data query processing on the newly added block through the query thread to obtain block chain data; The block data analysis module is used for analyzing the block chain data to obtain block chain analysis data; the block data storage module is used for storing the block chain analysis data to a target database; And the query processing module is used for searching and feeding back the query data of the target blockchain from the target database under the condition that the data query request aiming at the target blockchain is received. In a third aspect, the present application also provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program: under the condition of a new block on a target block chain, starting a query thread aiming at the new block; performing data query processing on the newly added block through the query thread to obtain block chain data; Analyzing the blockchain data to obtain blockchain analysis data; Storing the blockchain resolution data to a target database; In the event that a data query request is received for the target blockchain, query data of the target blockchain is searched and fed back from the target database. In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of: under the condition of a new block on a target block chain, starting a query thread aiming at the new block; performing data query processing on the newly added block through the query thread to obtain block chain data; Analyzing the blockchain data to obtain blockchain analysis data; Storing the blockchain resolution data to a target database; In the event that a data query request is received for the target blockchain, query data of the target blockchain is sear