Guide · Wallets

How to build a crypto wallet — non-custodial, on one API

Ship a wallet where users keep their own keys. Generate an HD wallet, derive addresses from the extended public key, track balances and transactions across 20+ chains, and move funds by signing offline — all without running a node or ever holding a private key on your servers.

What "building a wallet" actually takes

A wallet is more than a keypair. It needs fresh addresses on demand, live balances, transaction history, and a safe way to send — across every chain you support, surviving reorgs and re-syncs.

CryptoAPIs gives you that layer non-custodially: you hold the keys, we index the chain. You derive addresses from your extended public key (xPub), read balances and history over one API, and build transactions the user signs offline. Keys are generated and used only in your app or on the device.

Non-custodial by construction: the API only ever receives your public key and reads public on-chain data. Signing happens off the wire, with a key we never see.

Build it in four steps

Generate keys and sync the xPub

Create the HD wallet in your app (any BIP-32/39/44 library) and take its extended public key (xPub). Because an HD wallet can hold many addresses and transactions, CryptoAPIs indexes it up front — so sync the xPub once first, and it's then kept up to date for fast lookups. Only the public key is sent.

# Sync the xPub once so it's indexed and tracked (public key only)
curl -X POST \
  https://rest.cryptoapis.io/hd-wallets/manage/bitcoin/mainnet/{xPub}/sync \
  -H "x-api-key: YOUR_API_KEY"

Derive receiving addresses

Once synced, derive receiving addresses from the xPub so each user or deposit gets a fresh, tracked address — still using only the public key.

# Derive the next receiving address from the wallet's xPub (public key only)
curl -X POST \
  https://rest.cryptoapis.io/hd-wallets/utxo/bitcoin/mainnet/{xPub}/addresses/derive-and-sync \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{ "data": { "item": { "addressFormat": "p2wpkh", "derivation": "receiving" } } }'

Track balances and transactions

Read the wallet's aggregated balance and per-address history over the API, and subscribe to webhooks (see Create Subscriptions) for incoming payments so the wallet updates in real time — no node, no indexer.

# Aggregated wallet balance + synced address count
curl https://rest.cryptoapis.io/hd-wallets/utxo/bitcoin/mainnet/{xPub}/details \
  -H "x-api-key: YOUR_API_KEY"
# List transactions across every address in the wallet, newest first
curl https://rest.cryptoapis.io/hd-wallets/utxo/bitcoin/mainnet/{xPub}/transactions \
  -H "x-api-key: YOUR_API_KEY"

Send funds by signing offline

To move funds, prepare an unsigned transaction directly from the HD wallet (the API selects inputs across the wallet's derived addresses and calculates fee and change), sign it offline with the user's key — for example with our open-source @cryptoapis-io/offline-signer — then broadcast the signed result.

1
Prepare
POST /hd-wallets/…/transactions/prepare
API builds the unsigned transaction
2
Sign offline
@cryptoapis-io/offline-signer
Your key signs it locally — never sent
3
Broadcast
POST /broadcast-transactions/…
Submit the signed transaction on-chain

Coins and tokens, one model

The same HD-wallet flow covers native coins and tokens (ERC-20, TRC-20 and more): derive, track and sweep with the matching endpoints. Build once, support Bitcoin, Ethereum, stablecoins and 20+ chains behind a single integration — see Wallet as a Service.

Just accepting payments? If you only need to receive crypto to an address you already control (not a full wallet), the shorter path is How to accept crypto payments — same non-custodial, sign-offline approach.

Frequently asked questions

How do I build a crypto wallet with an API?

Generate an HD wallet in your app, derive receiving addresses from its xPub, and use CryptoAPIs to track balances and transactions and to prepare transactions for offline signing — across 20+ blockchains, with no node to run.

Is a wallet built on CryptoAPIs custodial?

No. Keys are generated and held in your app or on the user's device; CryptoAPIs only ever sees the extended public key and public on-chain data. Every send is signed offline, so it's fully non-custodial.

What is an HD wallet and xPub?

A hierarchical deterministic (HD) wallet derives many addresses from one seed. Its extended public key (xPub/yPub/zPub) can derive receiving addresses without exposing any private key — which is what lets CryptoAPIs track a wallet non-custodially.

Which blockchains are supported for wallets?

Bitcoin, Ethereum, BSC, Polygon, XRP, Litecoin, Dogecoin and 20+ others, all through the same unified API and HD-wallet model.

Start building your wallet

Derive addresses, track balances and sign offline across 20+ chains — non-custodial, on a free tier.