# Bitcoin Script Decode

> Bitcoin Script Decode is a paid API for AI agents from diamond.btc-intel.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-11-21).

Decodes a raw Bitcoin script (hex) into its assembly representation, type, and associated address

## Facts

- Endpoint: GET https://diamond.btc-intel.workers.dev/api/x402/script_decode?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-21
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/bitcoin-script-decode-72901249
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_7gxHibtkM3enXxUhdLpix

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability bitcoin-script-decode-72901249
```

Example prompt: Can you decode this Bitcoin script hex for me — 0014751e76e8199196d454941c45d1b3a323f1433bd6 — and tell me what type it is and what address it corresponds to?

## When to prefer this

Use this endpoint when you have a raw Bitcoin script in hex format and need to convert it into human-readable ASM, determine the script type (P2PKH, P2WPKH, P2SH, etc.), or derive the associated Bitcoin address. It is ideal for wallet developers, blockchain analysts, and transaction auditors who encounter raw scriptPubKey or scriptSig data and need quick, pay-per-call decoding without setting up an account or running a full Bitcoin node.

## Known failure modes

- Invalid or malformed hex string returns an error response
- Script hex exceeding 20000 characters is rejected by input validation
- Unrecognized or non-standard script types may not produce a decoded address
- Missing required 'script' query parameter returns a bad request error
- Network or worker-side errors may return 5xx responses

## How this service works

Decode a Bitcoin script from hex (scriptPubKey, redeem or witness script): type, asm, descriptor, address, and the P2SH and P2WSH addresses that wrap it (Bitcoin Core decodescript).

## Output

Returns a JSON object containing the decoded script in ASM notation, the detected script type (e.g. witness_v0_keyhash), a short type label (e.g. p2wpkh), the derived Bitcoin address, and a UTC timestamp indicating when the response was generated.

## Request schema (JSON Schema)

```json
{
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "script"
     ],
     "properties": {
      "script": {
       "type": "string",
       "maxLength": 20000,
       "description": "A Bitcoin script as hex"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "asm": "0 751e76e8199196d454941c45d1b3a323f1433bd6",
  "type": "witness_v0_keyhash",
  "as_of": "2026-11-07T18:00:00Z",
  "address": "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
  "product": "script_decode",
  "type_short": "p2wpkh"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/bitcoin-script-decode-72901249/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from diamond.btc-intel.workers.dev](https://www.zero.xyz/host/diamond.btc-intel.workers.dev/llms.txt)
