# Bitcoin addresses

Which Bitcoin addresses Maxy pays, which it takes payment from, and how to check one before you quote. It is for the screen where the user types, pastes or scans a Bitcoin address.

## Receiving BTC

| Address type | Looks like | Buying with an EVM coin | Buying with SOL |
| --- | --- | --- | --- |
| Native SegWit, P2WPKH | `bc1q…`, 42 characters | Yes | Yes |
| Native SegWit, P2WSH | `bc1q…`, 62 characters | Yes | Yes |
| Taproot, P2TR | `bc1p…` | No | Yes, live; the sandbox takes `bc1q…` only |
| Nested SegWit, P2SH | `3…` | No | No |
| Legacy, P2PKH | `1…` | No | No |

An EVM buy refuses any other address before the wallet is asked to sign. The order binds the receiving address: the intent the user signs carries the hash of its output script, and the settler pays the solver only for a payment to that script.

## Paying BTC

| Order | Pays from |
| --- | --- |
| Selling BTC for an EVM coin | Any Bitcoin wallet, paying one output of the exact amount to the deposit address. The SDK's `swap.payDeposit` pays from P2WPKH (`bc1q…`) or P2SH-P2WPKH (`3…`) |
| Selling BTC for SOL | P2WPKH (`bc1q…`) or Taproot (`bc1p…`), through a Bitcoin signer |

A deposit address belongs to the solver that locked the payout for this order. It is decoded from the script the settler stores. A payment that misses the amount or the window is returned under the [mispaid-sell policy](https://maxy.co/docs/mispaid-sells#the-mispaid-sell-policy).

## Check an address

`GET /addresses/validate?chain=bitcoin&address=…` says whether an address is well formed and whether a buy with an EVM coin would pay it. It reads nothing from a chain. The samples use the setup from [Get a quote](https://maxy.co/docs/buy-btc#get-a-quote).

```sh
curl -s -G -H "x-maxy-key: $MAXY_API_KEY" "$BASE/addresses/validate" -d chain=bitcoin -d address=bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq
```

```ts
const address = userInput.trim().replace(/^bitcoin:/i, '').split('?')[0]; // what the user pasted or scanned
const check = await fetch(`${BASE}/addresses/validate?${new URLSearchParams({ chain: 'bitcoin', address })}`, { headers: { 'x-maxy-key': KEY } }).then((r) => r.json());
if (!check.payable) console.log(check.reason); // show it next to the field
```

```python
address = user_input.strip().removeprefix("bitcoin:").split("?")[0]  # what the user pasted or scanned
check = requests.get(f"{BASE}/addresses/validate", headers={"x-maxy-key": KEY}, params={"chain": "bitcoin", "address": address}).json()
if not check["payable"]:
    print(check["reason"])  # show it next to the field
```

What the call answered for each kind of address, in the sandbox:

| `address` | `valid` | `type` | `network` | `payable` | `reason` |
| --- | --- | --- | --- | --- | --- |
| `bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq` | `true` | `p2wpkh` | `mainnet` | `true` | `null` |
| `bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3` | `true` | `p2wsh` | `mainnet` | `true` | `null` |
| `bc1p5d7rjq7g6rdk2yhzks9smlaqtedr4dekq08ge8ztwac72sfr9rusxg3297` | `true` | `p2tr` | `mainnet` | `false` | "Receive BTC on a native SegWit address (bc1q...). Taproot and legacy addresses are not paid by this route." |
| `3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy` | `true` | `p2sh` | `mainnet` | `false` | The same |
| `1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2` | `true` | `p2pkh` | `mainnet` | `false` | The same |
| `tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx` | `true` | `p2wpkh` | `testnet` | `false` | "Not a Bitcoin mainnet address: Testnet and regtest addresses are not accepted; use a Bitcoin mainnet address." |
| `bc1qnotanaddress` | `false` | `null` | `null` | `false` | "Bitcoin address has an invalid character." |

| Field | Meaning |
| --- | --- |
| `valid` | Well formed for Bitcoin and its network |
| `type` | `p2wpkh`, `p2wsh`, `p2tr`, `p2pkh` or `p2sh`; `null` when not valid |
| `network` | `mainnet`, `testnet` (which also covers signet) or `regtest` |
| `payable` | A buy with an EVM coin would pay it |
| `reason` | Why not, as a sentence you can show; `null` when payable |

`payable` is the EVM buy's own check. A Taproot address reads `payable: false`, though a SOL buy pays it live: for a SOL buy, accept `valid: true` with `type` `p2wpkh`, `p2wsh` or `p2tr` on `mainnet`. A malformed address is not an error: the answer is `200` with `valid: false`. A missing `chain` or `address` answers `400 invalid_input`. The same call checks an EVM or Solana address with `chain=base`, `chain=8453` or `chain=solana`.

## Networks

Maxy pays mainnet only. A `tb1…` address is valid, reads `network: "testnet"`, and is never payable. In the sandbox too, the recipient must be a mainnet address, while the sandbox's own deposit addresses are testnet ones (`tb1q…`), so no real wallet can pay them.

## On the screen

- Strip a `bitcoin:` prefix and anything after `?` (a BIP-21 link), and trim spaces, before you check.
- Check on paste, not on every keystroke.
- Show `reason` next to the field, in words.
- Read the address back on the confirm screen in short form, such as `bc1qar0s…5mdq`.

The check covers form and network only, not who owns the address. Maxy screens the addresses in every order, and you may add your own checks ([Security and compliance](https://maxy.co/docs/security-and-compliance#compliance)). Wording for the confirm screen: [Signature screen](https://maxy.co/docs/signature-screen).

---
Source: https://maxy.co/docs/bitcoin-addresses (Maxy Docs › Supported systems › Details)
