send_raw_transaction
Broadcast signed Bitcoin transactions to the network. Use this tool to submit finalized transactions after verifying signatures and fee rates.
Instructions
Broadcast a signed raw transaction to the Bitcoin network.
WARNING: This sends a REAL transaction. Once broadcast, it cannot be reversed. Ensure the transaction is correctly signed and you understand the fee implications. In hosted API mode, the transaction is broadcast through the Satoshi API's node.
Args: hex_string: Signed raw transaction in hex format max_fee_rate: Maximum fee rate in BTC/kvB to prevent accidental overpayment (default 0.10)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hex_string | Yes | ||
| max_fee_rate | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/bitcoin_mcp/server.py:397-417 (handler)The 'send_raw_transaction' tool is implemented as a function in src/bitcoin_mcp/server.py. It takes a hex_string and an optional max_fee_rate, validates the input, and then uses the 'get_rpc().sendrawtransaction' method to broadcast the transaction.
def send_raw_transaction(hex_string: str, max_fee_rate: float = 0.10) -> str: """Broadcast a signed raw transaction to the Bitcoin network. WARNING: This sends a REAL transaction. Once broadcast, it cannot be reversed. Ensure the transaction is correctly signed and you understand the fee implications. In hosted API mode, the transaction is broadcast through the Satoshi API's node. Args: hex_string: Signed raw transaction in hex format max_fee_rate: Maximum fee rate in BTC/kvB to prevent accidental overpayment (default 0.10) """ if not re.fullmatch(r"[a-fA-F0-9]+", hex_string): return json.dumps({"error": "Invalid hex string: must contain only hex characters [0-9a-fA-F]", "broadcast": False}) if len(hex_string) > 2_000_000: return json.dumps({"error": "Hex string too long: maximum 2,000,000 characters (1MB transaction)", "broadcast": False}) try: txid = get_rpc().sendrawtransaction(hex_string, max_fee_rate) return json.dumps({"txid": txid, "broadcast": True}) except Exception as e: return json.dumps({"error": str(e), "broadcast": False})