Skip to content

Critical: Silent Transaction Broadcast Failures in BlockstreamAPI - HTTP Payload Formatting Bug #202

@liosna

Description

@liosna

Problem Statement

Users of the bit library experience silent transaction broadcast failures where .send() appears successful but the transaction never reaches the network mempool. The transaction hash is returned to the user, but blockchain explorers show "Transaction Not Found."

Symptoms

Root Cause Analysis

Two concurrent issues in bit/network/services.py:

Issue 1: Malformed HTTP Request Payload

  • The BlockstreamAPI.broadcast_tx() and broadcast_tx_testnet() methods wrap transaction hex in a dictionary
  • Blockstream API specification requires raw hex string in request body
  • Server rejects malformed request with HTTP 400
  • Dispatcher interprets error as connection failure

Issue 2: Deprecated Service Provider Dependencies

  • Dispatcher falls back to non-functional services:
    • Smartbit: Service permanently shut down
    • Bitcore: API endpoints unreliable/unreachable
    • Blockchair: Requires API key not implemented in library
    • Blockchain.com: Produces unreliable response patterns
  • Result: Failed transaction attempts exhaust fallback list, return generic ConnectionError

Technical Details

# CURRENT (BROKEN) - Wraps hex in dictionary
r = requests.post(cls.MAIN_TX_PUSH_API, data={cls.TX_PUSH_PARAM: tx_hex}, timeout=DEFAULT_TIMEOUT)

# BLOCKSTREAM API SPEC REQUIREMENT - Raw hex string
# Reference: https://github.com/Blockstream/esplora/blob/master/API.md
# POST /tx endpoint expects: raw transaction hex as request body

Impact

  • Affects all users attempting to broadcast Bitcoin transactions via bit library
  • Silent failures (no exception raised) make debugging difficult
  • Users unaware whether issue is code or network related
  • Workaround: Use external tools to broadcast same transaction hex

Files Affected

  • bit/network/services.py (2 methods, 2 configuration lists)

Related Issues

Severity

Critical - Core functionality (transaction broadcasting) is broken for all users

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions