• About
  • FAQ
  • Earn Bitcoin while Surfing the net
  • Buy & Sell Crypto on Paxful
Newsletter
Approx Foundation
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
Approx Foundation
No Result
View All Result
Home Bitcoin

confirmations – How to scan future transactions of specified amount on a blockchain address?

Moussa by Moussa
March 6, 2025
in Bitcoin
0
peer discovery – how to obtain the IP addresses of nodes for mining pools?
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


I think you could use ZeroMQ in a Python script to listen to the daemon for new transactions including your desired address. Then, when you see a transaction witn your address, you can filter by the output amount, maybe using an API to convert BTC to USDT. You’ll need a running Bitcoin full node and launch bitcoind with flag -zmqpubrawtx=tcp://127.0.0.1:28332. I think something like the following should work.

import zmq
import json
import subprocess
import requests


ZMQ_ADDRESS = "tcp://127.0.0.1:28332"  # Ensure bitcoind has been launched with flag `-zmqpubrawtx=tcp://127.0.0.1:28332`

# Target Bitcoin address to monitor
TARGET_ADDRESS = "your-bitcoin-address"

# Minimum and maximum USDT equivalent in BTC
MIN_USDT = 100
MAX_USDT = 115

# API to fetch BTC/USDT price
PRICE_API = "your-preferred-API"

def get_btc_price():
    """Fetch the latest BTC price in USD"""
    try:
        response = requests.get(PRICE_API).json()
        return float(response["bpi"]["USD"]["rate"].replace(",", ""))
    except Exception as e:
        print(f"Error fetching BTC price: {e}")
        return None

def decode_tx(raw_tx):
    """Decode a raw transaction using bitcoin-cli"""
    try:
        result = subprocess.run(["bitcoin-cli", "decoderawtransaction", raw_tx], capture_output=True, text=True)
        return json.loads(result.stdout) if result.stdout else None
    except Exception as e:
        print(f"Error decoding transaction: {e}")
        return None

def process_transaction(raw_tx):
    """Process and filter transactions"""
    btc_price = get_btc_price()
    if not btc_price:
        return

    tx_data = decode_tx(raw_tx)
    if not tx_data:
        return

    for vout in tx_data["vout"]:
        # Extract destination address
        if "addresses" in vout["scriptPubKey"]:
            for address in vout["scriptPubKey"]["addresses"]:
                if address == TARGET_ADDRESS:
                    amount_btc = vout["value"]
                    amount_usdt = amount_btc * btc_price
                    
                    if MIN_USDT <= amount_usdt <= MAX_USDT:
                        print(f"New Transaction Detected!")
                        print(f"TXID: {tx_data['txid']}")
                        print(f"Amount: {amount_btc} BTC (~{amount_usdt:.2f} USDT)")
                        print(f"From: Unknown (check inputs), To: {TARGET_ADDRESS}")

def listen_zmq():
    context = zmq.Context()
    socket = context.socket(zmq.SUB)
    socket.connect(ZMQ_ADDRESS)
    socket.setsockopt_string(zmq.SUBSCRIBE, "")  # Subscribe to all messages

    print("Listening for new transactions...")

    while True:
        try:
            # Receive raw transaction
            raw_tx = socket.recv_string()
            process_transaction(raw_tx)
        except Exception as e:
            print(f"Error receiving transaction: {e}")

if __name__ == "__main__":
    listen_zmq()



Source link

Related articles

MEXC Returns to TOKEN2049 Singapore as Platinum Sponsor with Interactive Experiences and Industry Conversations

MEXC Returns to TOKEN2049 Singapore as Platinum Sponsor with Interactive Experiences and Industry Conversations

September 25, 2026
Traders Manipulated $8.2M On Polymarket Bitcoin Bets: Study

New York Sues Polymarket, Alleges It Operated Illegally

September 25, 2026
Share76Tweet47

Related Posts

MEXC Returns to TOKEN2049 Singapore as Platinum Sponsor with Interactive Experiences and Industry Conversations

MEXC Returns to TOKEN2049 Singapore as Platinum Sponsor with Interactive Experiences and Industry Conversations

by Moussa
September 25, 2026
0

Mutsamudu, Comoros, September 25, 2026 – MEXC, a pioneer in 0-fee digital asset trading, will return to TOKEN2049 Singapore as...

Traders Manipulated $8.2M On Polymarket Bitcoin Bets: Study

New York Sues Polymarket, Alleges It Operated Illegally

by Moussa
September 25, 2026
0

New York Attorney General Letitia James and Governor Kathy Hochul on Thursday filed a lawsuit against crypto-based prediction market Polymarket,...

KelpDAO Takes Layerzero to Court Over a $292M Bridge Blowup

KelpDAO Takes Layerzero to Court Over a $292M Bridge Blowup

by Moussa
September 25, 2026
0

Key TakeawaysKelp says LayerZero’s bridge released 116,500 rsETH worth about $292 million on April 18.Aave faced $123.7M-$230.1M in estimated bad...

CFTC Reviews Kalshi After $5B in Ether Perp Trades

CFTC Reviews Kalshi After $5B in Ether Perp Trades

by Moussa
September 25, 2026
0

Join Our Telegram channel to stay up to date on breaking news coverage The Commodity Futures Trading Commission is reviewing...

Sellers Send Ripple XRP Below $100Bn Marketcap After Brief Milestone

Sellers Send Ripple XRP Below $100Bn Marketcap After Brief Milestone

by Moussa
September 25, 2026
0

XRP Ripple briefly pushed its market capitalization back above $100Bn on Tuesday, September 22, before profit-taking dragged the token below...

Load More

youssufi.com

sephina.com

[vc_row full_width="stretch_row" parallax="content-moving" vc_row_background="" background_repeat="no-repeat" background_position="center center" footer_scheme="dark" css=".vc_custom_1517813231908{padding-top: 60px !important;padding-bottom: 30px !important;background-color: #191818 !important;background-position: center;background-repeat: no-repeat !important;background-size: cover !important;}" footer_widget_title_color="#fcbf46" footer_button_bg="#fcb11e"][vc_column width="1/4"]

We bring you the latest in Crypto News

[/vc_column][vc_column width="1/4"][vc_wp_categories]
[/vc_column][vc_column width="1/4"][vc_wp_tagcloud taxonomy="post_tag"][/vc_column][vc_column width="1/4"]

Newsletter

[vc_raw_html]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1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MGNsYXNzJTNEJTIydG5wLXN1Ym1pdCUyMiUyMHR5cGUlM0QlMjJzdWJtaXQlMjIlMjB2YWx1ZSUzRCUyMlN1YnNjcmliZSUyMiUyMCUzRSUwQSUzQyUyRmRpdiUzRSUwQSUzQyUyRmZvcm0lM0UlMEElM0MlMkZkaXYlM0UlM0NiciUyRiUzRSUzQyUyRnAlM0U=[/vc_raw_html][/vc_column][/vc_row]
No Result
View All Result
  • Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News