# Bitcoin Address Validator

> Bitcoin Address Validator 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-20).

Validates a Bitcoin address and returns its type (P2PKH, P2SH, P2WPKH, P2WSH, P2TR), witness version, and scriptPubKey

## Facts

- Endpoint: GET https://diamond.btc-intel.workers.dev/api/x402/address_info?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/bitcoin-address-validator-7d457e88
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_dCFcQyF3aBTJBTKudH7cB

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-address-validator-7d457e88
```

Example prompt: Can you check if bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq is a valid Bitcoin address and tell me what type it is?

## When to prefer this

Use this endpoint when you need a quick, structured classification of a single Bitcoin address — not just a yes/no, but the full type, witness version, and scriptPubKey. Prefer this over manual regex checks or general blockchain explorers when you need machine-readable output for downstream logic (e.g., constructing transactions, enforcing address-type policies, or validating user input before sending funds).

## Known failure modes

- Missing 'addr' query parameter returns an error
- Malformed or garbage string returns valid=false with a reason explaining the failure
- Non-Bitcoin addresses (Ethereum, Litecoin, etc.) will return invalid
- Network errors from the Cloudflare Worker may return 5xx responses
- Very long strings exceeding 100 characters may be rejected

## How this service works

Validate and classify one Bitcoin address: valid or not (with the reason), type (P2PKH, P2SH, P2WPKH, P2WSH, P2TR), witness version and scriptPubKey.

## Output

Returns a JSON object with: the original address, a boolean 'valid' flag, the address type string (p2pkh, p2sh, p2wpkh, p2wsh, p2tr), the witness_version (integer, null for legacy), the scriptPubKey hex string, and a reason if the address is invalid.

## 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": [
      "addr"
     ],
     "properties": {
      "addr": {
       "type": "string",
       "maxLength": 100,
       "description": "A Bitcoin address to validate"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "type": "p2wpkh",
  "valid": true,
  "address": "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
  "product": "address_info",
  "script_pub_key": "0014751e76e8199196d454941c45d1b3a323f1433bd6",
  "witness_version": 0
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/bitcoin-address-validator-7d457e88/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)
