Skip to main content

Introduction

This quickstart walks you through your first request to the Bitcoin Data API. Under the hood it’s the Moralis Universal API — every endpoint is the same one EVM and Solana developers already use, just with bitcoin as the chain. You’ll fetch BTC balances and a page of wallet history, then call the xpub utility. The interesting part: the wallet endpoints accept either an address or an xpub as input, so you can drop the API into whichever shape your app already has.

Prerequisites

Step 1: Set up your project

Step 2: Fetch a BTC balance — by address

Create a file called balance-by-address.js:
Run it:
You should see the native BTC balance for the address.

Step 3: Fetch the same kind of balance — by xpub

The same endpoint accepts an xpub. Create balance-by-xpub.js:
The API derives every address from the xpub and aggregates balances for you. No client-side derivation, no extra libraries.

Step 4: Pull wallet transaction history

Use the returned cursor to paginate.

Step 5: Get the current BTC price (with sparkline)

Step 6: Enumerate the addresses derived from an xpub

If your UI needs to display every address controlled by an xpub (not just query against it), call the utility endpoint:
You’ll get every derived address with its transfer count.

What’s next


Bitcoin API Overview