> For the complete documentation index, see [llms.txt](https://docs-processing.crypto-chief.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-processing.crypto-chief.com/managing-wallets/external-wallets.md).

# Register and use an external wallet

Register a `master`, `transit` or `static` address whose private key stays with your project. When an operation needs a signature from this address, CryptoChief sends the transaction to your signer. Wallets created through [Generate wallet](https://docs-processing.crypto-chief.com/managing-wallets/generate-wallet.md) use `internal` custody, including those created before external registration was available.

**Headers for calls to the processing API**

| Name             | Value                                                                                                               |
| ---------------- | ------------------------------------------------------------------------------------------------------------------- |
| `Content-Type`   | `application/json`                                                                                                  |
| `Merchant`       | Merchant ID of the project that owns the wallet                                                                     |
| `X-CC-Timestamp` | Current Unix time in seconds                                                                                        |
| `X-CC-Nonce`     | New random nonce for each request or retry                                                                          |
| `X-CC-Signature` | HMAC-SHA256 over the [signed request](https://docs-processing.crypto-chief.com/getting-started/signing-requests.md) |

## 1. Request a challenge

<mark style="color:green;">`POST`</mark> `https://api-processing.crypto-chief.com/v1/wallets/external/challenge`

**Body**

```json
{
  "chain_family": "EVM",
  "address": "0x4afb4ce0215c53784861d7abd44f741e17db306b",
  "wallet_type": "master",
  "signing_callback_url": "https://merchant.example/wallet-signing",
  "label": "Treasury"
}
```

| Name                    | Required | Description                                                                                                                                                                                       |
| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `chain_family`          | Yes      | Family from the table below. Use the separate testnet family where listed.                                                                                                                        |
| `address`               | Yes      | Public address controlled by the signing key.                                                                                                                                                     |
| `wallet_type`           | Yes      | Wallet role. Accepts `master`, `transit` or `static`.                                                                                                                                             |
| `signing_callback_url`  | Yes      | Public HTTPS endpoint that receives signing requests, up to 2,048 bytes. It must respond directly. Omit URL credentials and fragments.                                                            |
| `master_wallet_address` | No       | For transit and static wallets, the master in this project and family that receives sweeps. If omitted, CryptoChief selects the oldest unfrozen master. Registration requires an eligible master. |
| `callback_url`          | No       | Static wallets only. Public HTTPS URL for deposit notifications, up to 255 bytes.                                                                                                                 |
| `label`                 | No       | Display name, up to 255 characters.                                                                                                                                                               |

When you register or change a callback, the API rejects a hostname if any of its DNS records point to a private or reserved IP. You can register a hostname before its DNS records exist. Signing requests are delivered only after it resolves exclusively to public addresses.

**Response · 200**

| Field          | Description                                               |
| -------------- | --------------------------------------------------------- |
| `challenge_id` | UUID to send with the ownership proof in step 2.          |
| `message_hex`  | Hex-encoded bytes to verify and sign with the wallet key. |
| `expires_at`   | UTC expiry, five minutes after issue.                     |

Decode `message_hex`. Check the prefix `CryptoChief external wallet registration v1\n` (final byte `0A`) and the JSON that follows it. Match the project, wallet address, family, role, callback URLs, master and label if supplied, challenge ID and expiry to your request. Sign the original bytes.

| Families                                                  | Supported address                             | Ownership proof |
| --------------------------------------------------------- | --------------------------------------------- | --------------- |
| `EVM`, `TRON`                                             | EVM account or TRON Base58Check               | secp256k1       |
| `XRP_LEDGER`, `XRP_LEDGER_TESTNET`                        | Classic address with a secp256k1 key          | secp256k1       |
| `BTC_UTXO`, `LITECOIN_UTXO` and their `_TESTNET` families | Native SegWit v0 P2WPKH                       | secp256k1       |
| `BTC_CASH_UTXO` and `_TESTNET`                            | CashAddr P2PKH                                | secp256k1       |
| `DOGECOIN_UTXO` and `_TESTNET`                            | Base58Check P2PKH                             | secp256k1       |
| `SOLANA`                                                  | Base58 Ed25519 public key                     | Ed25519         |
| `TON`                                                     | V4R2 wallet, workchain 0, subwallet 698983191 | Ed25519         |

For an external XRP wallet, register `XRP_LEDGER` for mainnet or `XRP_LEDGER_TESTNET` for testnet. Select the same network when initiating the payout or sweep. Existing internal XRP wallets registered under the shared family remain available to their project. The same external classic address on two networks requires a separate registration for each network.

For **secp256k1**, sign SHA-256 of the decoded challenge with ECDSA. Use a 33-byte compressed public key and a 64-byte signature formed by concatenating 32-byte big-endian `r` and `s`. Use low-S form. Ethereum's `personal_sign` adds a prefix and produces a different proof.

For **Ed25519**, sign the decoded challenge directly with standard Ed25519 and use the 32-byte public key and 64-byte signature. In both cases send hex without a prefix.

## 2. Register the wallet

<mark style="color:green;">`POST`</mark> `https://api-processing.crypto-chief.com/v1/wallets/external/register`

**Body**

```json
{
  "challenge_id": "<UUID from step 1>",
  "public_key_hex": "<hex public key>",
  "signature_hex": "<hex ownership proof>"
}
```

**Response**

{% tabs %}
{% tab title="201" %}

```json
{
  "address": "0x4afb4ce0215c53784861d7abd44f741e17db306b",
  "chain_family": "EVM",
  "wallet_type": "master",
  "custody_type": "external",
  "signing_callback_url": "https://merchant.example/wallet-signing",
  "label": "Treasury"
}
```

{% endtab %}

{% tab title="409" %}

```json
{
  "error": "SERVICE_ERROR",
  "msg": "wallet already registered",
  "ok": false
}
```

{% endtab %}
{% endtabs %}

Registration consumes the challenge. An invalid proof returns 403. An expired or used challenge, or an address already registered for that family, returns 409. If the response is lost, check the project wallet list before requesting a new challenge. [List of wallets](https://docs-processing.crypto-chief.com/managing-wallets/list-of-wallets.md)

## 3. Receive a signing request

CryptoChief sends `wallet.signature.requested` to the registered `signing_callback_url`. Allow the same outbound IP addresses as payment webhooks. A retry can arrive from any address in the pool. [Webhook IP addresses](https://docs-processing.crypto-chief.com/webhooks/general-information.md#webhook-source-ip-addresses)

**Headers sent to your signer**

| Name                      | Value                                                                            |
| ------------------------- | -------------------------------------------------------------------------------- |
| `Content-Type`            | `application/json`                                                               |
| `X-CryptoChief-Signature` | Standard Base64 encoding of an Ed25519 signature over the exact HTTP body bytes. |

Verify the signature against the raw body before decoding the JSON. The **production Ed25519 public key** in standard Base64 is `s+dKJ8ty38hIXDXvGfjuL4ZvACru9SYEtCyVVlJXh28=`. Decode it to 32 bytes. The key identifies the processing installation and applies to both mainnet and testnet requests from production. For a separate installation, obtain its public key from the operator.

**Body** — EIP-1559 transfer of 1 wei on Sepolia

```json
{
  "event": "wallet.signature.requested",
  "request_id": "c6de2658aa3347fb87cab2dcb37fa16b",
  "project_id": 42,
  "network": "ETH_SEPOLIA",
  "expires_at": "2026-11-20T10:00:20Z",
  "request": {
    "chain_family": "EVM",
    "address": "0x4Afb4cE0215C53784861D7ABd44F741e17DB306b",
    "tx": {
      "chain_id": "0xaa36a7", "nonce": "0x7",
      "from": "0x4afb4ce0215c53784861d7abd44f741e17db306b",
      "to": "0x7915cb3c211b683d54eb8e457e1c9f01f72a4253",
      "value": "0x1", "data": "0x", "gas": "0x5208",
      "max_fee_per_gas": "0x77359400", "max_priority_fee_per_gas": "0x3b9aca00"
    }
  }
}
```

1. Check the event and expiry. Match the numeric `project_id`, `network`, `request.chain_family` and wallet address to your configuration. Obtain your numeric project ID during setup.
2. Decode `request.tx`. Check the sender, each recipient, asset, amount and fee against your instructions. Use the transaction data listed below. If an instruction or asset cannot be verified, withhold the signature.
3. Acknowledge delivery with HTTP 2xx. [Return the signature](#id-4.-return-the-signature) before `expires_at`. The signing window is up to 20 seconds and can be shorter if the originating operation expires sooner.
4. Cache the result by `request_id`. CryptoChief can redeliver the same request until completion or expiry. Return the same result for that ID.

**Transaction data to inspect**

| Family              | What to inspect before signing                                                                                                                                                                                                                                                                 |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| EVM                 | Compare addresses as 20 bytes. For a native transfer, `tx.to` is the recipient and `tx.value` is the amount in wei. For an ERC-20 `transfer(address,uint256)`, `tx.to` is the token contract. Decode the recipient and amount in base units from `tx.data`. Check the chain ID and fee fields. |
| TRON                | Decode `tx.raw_data_hex` to inspect the transfer or contract call. A digest alone cannot identify the recipient or amount.                                                                                                                                                                     |
| XRP Ledger          | Decode `tx.tx_blob_hex`. For a payment, check the destination, destination tag if present, and amount. An issued currency is identified by both currency and issuer.                                                                                                                           |
| Solana              | Decode `tx.message_base64` and check each instruction. For an SPL transfer, verify the token accounts and mint against your order.                                                                                                                                                             |
| TON                 | Decode `request.inspection_context.source_payload_hex` as the signing cell in BOC format. Inspect its outgoing messages and verify the root cell hash equals `request.tx.digest_hex`.                                                                                                          |
| BTC, BCH, LTC, DOGE | Read `source_payload_hex` (unsigned transaction), `previous_transactions` (funding transactions) and `input_index` from `request.inspection_context`. Check the outputs, change and fee. Recompute `tx.sighash_hex` for that input using `tx.hash_type`.                                       |

For UTXO transactions, each input has its own `request_id` and zero-based `input_index`. Up to eight requests can arrive concurrently. All inputs share a deadline. Submit one result for each request ID.

### UTXO signing networks

Use the signed `network` value when configuring your signer’s allowlist. These are the standard processing profiles.

| Processing network     | Signed `network` |
| ---------------------- | ---------------- |
| `BTC_MAINNET`          | `BTC_UTXO`       |
| `BTC_TESTNET_4`        | `BTC_TESTNET_4`  |
| `LITECOIN_MAINNET`     | `LITECOIN_UTXO`  |
| `BITCOIN_CASH_MAINNET` | `BTC_CASH_UTXO`  |
| `DOGECOIN_MAINNET`     | `DOGECOIN_UTXO`  |

Installations that enable Litecoin, Bitcoin Cash or Dogecoin testnet can use `LITECOIN_UTXO_TESTNET`, `BTC_CASH_UTXO_TESTNET` or `DOGECOIN_UTXO_TESTNET` respectively. Confirm the enabled profiles with your operator before accepting requests.

## 4. Return the signature

<mark style="color:green;">`POST`</mark> `https://api-processing.crypto-chief.com/v1/wallets/signatures/complete`

**Body**

```json
{
  "request_id": "c6de2658aa3347fb87cab2dcb37fa16b",
  "result": {
    "signed_tx": { "signed_tx_hex": "<0x-prefixed signed EVM transaction>" }
  }
}
```

| Family                                 | Content of `result`                                                                                                                                                                                                                                                              |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| EVM                                    | `{"signed_tx":{"signed_tx_hex":"0x…"}}`. Return the serialized signed legacy EIP-155 or type 2 EIP-1559 transaction. Preserve all requested fields.                                                                                                                              |
| TRON                                   | `{"signature":{"signature_hex":"…"}}`. A 65-byte secp256k1 signature over SHA-256 of decoded `tx.raw_data_hex`, or over the decoded `tx.digest_hex` when supplied directly. Encode 32-byte `r`, 32-byte low `s`, then one recovery byte (`0` or `1`, also accepts `27` or `28`). |
| BTC, BCH, LTC, DOGE and their testnets | `{"signature":{"signature_hex":"…"}}`. Low-S DER signature over the 32-byte `tx.sighash_hex`, with no hash-type byte appended.                                                                                                                                                   |
| XRP Ledger and testnet                 | `{"signature":{"signature_hex":"…"}}`. Low-S DER signature over the first 32 bytes of SHA-512 of `53545800` (hex) followed by the decoded `tx.tx_blob_hex`.                                                                                                                      |
| TON                                    | `{"signature":{"signature_hex":"…"}}`. Ed25519 over the 32 bytes of `tx.digest_hex`.                                                                                                                                                                                             |
| Solana                                 | `{"signature":{"signature_hex":"…"}}`. Ed25519 over the bytes decoded from `tx.message_base64`.                                                                                                                                                                                  |

**Response**

| HTTP | Meaning                                                                                                                                   |
| ---- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | `{"status":"accepted"}`. The original operation resumes. An identical retry before expiry also succeeds while the authorization is valid. |
| 404  | The request is unknown, expired or belongs to another project.                                                                            |
| 409  | A different valid result was already accepted, or a freeze or signing URL change revoked the authorization.                               |
| 422  | The signature failed verification. Correct it and retry before expiry.                                                                    |

If the response is lost, retry the same result with fresh merchant authentication. For a transfer started with [Sign Transaction](https://docs-processing.crypto-chief.com/blockchain-data/sign-transaction.md), broadcast the resulting transaction using [Execute Transaction](https://docs-processing.crypto-chief.com/blockchain-data/execute-transaction.md).

## Change the signing URL

<mark style="color:green;">`POST`</mark> `https://api-processing.crypto-chief.com/v1/wallets/external/signing-callback/challenge`

Send `chain_family`, `address` and the new `signing_callback_url` using the wallet owner's merchant credentials. HTTP 200 returns `challenge_id`, `message_hex` and `expires_at`.

Decode `message_hex`. Verify the prefix `CryptoChief external wallet signing callback change v1\n`, ending in byte `0A`. In the JSON that follows, check `project_id`, `chain_family`, `address`, `previous_signing_callback_url`, the new `signing_callback_url`, `callback_version`, `challenge_id` and `expires_at`. Sign the decoded bytes with the registered wallet key using the ownership proof format in step 1.

<mark style="color:green;">`POST`</mark> `https://api-processing.crypto-chief.com/v1/wallets/external/signing-callback/confirm`

Send `challenge_id` and `signature_hex`. HTTP 200 returns `chain_family`, `address` and the new `signing_callback_url`. You can complete the change while the previous endpoint is offline.

Each challenge lasts five minutes. If two changes are approved for the same callback version, the first one committed takes effect. A stale, expired or used challenge returns 409. An invalid ownership proof returns 403. Request a new transaction signature after a URL change. Restoring a prior URL does not reactivate requests issued to it earlier. The deposit notification URL of a static wallet is managed separately. [Update a static wallet's deposit callback](https://docs-processing.crypto-chief.com/managing-wallets/set-callback-url.md)
