当前位置: 首页 > 工具软件 > py-bitcoin > 使用案例 >

[6th of series6] Handling Bitcoin Unconfirmed Transactions

冷宏茂
2023-12-01

Abstract

Transactions are collected from the Mempool and stored at a specific block. This blog is trying to detect each block’s mempool, such that we will know what kind of transactions will be collected.


1. Detect New Bitcoin Blocks

This part is going to detect new Bitcoin blocks. The mechanism is as follows: we detect whether there is a new block created every 2 seconds. If yes, the terminal prints a signal like “find a new block!!!”; Otherwise, the terminal prints a signal like “updating unconfirmed transactions”.

The key implementation used the command bitcoin-cli getblockcount to get the height of blocks. The source code is named “new_blocks_detector.py”.

$ python new_blocks_detector.py
updating unconfirmed transactions
updating unconfirmed transactions
updating unconfirmed transactions
updating unconfirmed transa
 类似资料:

相关阅读

相关文章

相关问答