Skip to main content
Glama

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
NameRequiredDescriptionDefault
hex_stringYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Bortlesboat/bitcoin-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server