decode_raw_transaction
Decode raw Bitcoin transaction hex strings to view transaction details without requiring input lookups.
Instructions
Decode a raw transaction hex without looking up inputs.
Args: hex_string: Raw transaction in hex format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hex_string | Yes |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/bitcoin_mcp/server.py:368-379 (handler)The implementation of the decode_raw_transaction tool, which uses the RPC connection to decode a provided hex string.
def decode_raw_transaction(hex_string: str) -> str: """Decode a raw transaction hex without looking up inputs. Args: hex_string: Raw transaction in hex format """ 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]"}) if len(hex_string) > 2_000_000: return json.dumps({"error": "Hex string too long: maximum 2,000,000 characters (1MB transaction)"}) result = get_rpc().decoderawtransaction(hex_string) return json.dumps(result)