One REST endpoint and signed webhooks for Kaspa — Node.js and Python examples inside.
Kaspa is a proof-of-work Layer 1 with one-second block times and BlockDAG (GHOSTDAG) consensus. It is fast, settled in seconds, and very developer-friendly — once you have access to a node. Running your own kaspad node, keeping it in sync, indexing transactions, and turning that into a clean payment flow is real work that distracts you from shipping product.
Crypto APIs now supports Kaspa mainnet behind a single REST API, with signed webhooks for incoming, outgoing, and confirmed transactions. No node, no indexer, no infra to babysit.
This post is a copy-paste quickstart for the two flows most teams actually need on day one: tracking an incoming Kaspa payment, and a minimal wallet backend that lists balances and recent activity for a user.
Why skip the node
A self-hosted Kaspa stack means a kaspad node, a separate indexer for address and transaction lookups, a queue for reorg-safe confirmations, an HTTPS service to expose data to your app, and an on-call rotation when blocks slow down or peers misbehave. With Crypto APIs you call one HTTPS endpoint and you're done. Free tier is enough to start; you upgrade when traffic grows.
What you get on Kaspa via Crypto APIs:
- Address details and balances
- Transaction history per address
- Latest block and block-by-height lookups
- Fee recommendations
- Broadcast of pre-signed raw transactions
- Signed webhooks for new confirmed and unconfirmed coin transactions
All endpoints are documented at developers.cryptoapis.io.
Flow 1: track an incoming Kaspa payment with a webhook
When a user is paying you in KAS, you do not want to poll. Subscribe a webhook to the receiving address once and Crypto APIs will POST to your callback URL when a transaction confirms. The payload is signed via your callbackSecretKey, so you can verify it came from Crypto APIs and not a spoofer.
Before going live, register and verify your callback domain in the Crypto APIs dashboard (see Callbacks in the docs). Otherwise the subscription will not deliver.
Node.js example to subscribe an address to "new confirmed coin transactions":
import fetch from 'node-fetch';
const API_KEY = process.env.CRYPTOAPIS_KEY;
const HOST = 'https://rest.cryptoapis.io';
const URL = `${HOST}/blockchain-events/kaspa/mainnet/address-coins-transactions-confirmed`;
async function subscribeIncoming(address, callbackUrl) {
const res = await fetch(URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': API_KEY },
body: JSON.stringify({
context: 'order-1234',
data: {
item: {
address,
allowDuplicates: false,
callbackSecretKey: 'whsec_replace_me',
callbackUrl
}
}
})
});
return res.json();
}
subscribeIncoming(
'kaspa:qr...your-address...',
'https://api.example.com/webhooks/kaspa'
).then(console.log);
When a payment to that address gets confirmed in a block, your endpoint receives a JSON body with eventType: ADDRESS_COINS_TRANSACTION_CONFIRMED plus the address, txid, amount and confirmation count. Verify the signature with the callbackSecretKey you set, mark the order as paid, and you're done. No polling, no missed transactions on reorgs.
Flow 2: a minimal wallet backend in Python
For a wallet UI you typically need balance and recent transactions for an address. Two endpoints, no node.
import os, requests
API_KEY = os.environ['CRYPTOAPIS_KEY']
HOST = 'https://rest.cryptoapis.io'
HEADERS = {'x-api-key': API_KEY}
def get_balance(address, network='mainnet'):
url = f"{HOST}/addresses-latest/kaspa/{network}/{address}/balance"
r = requests.get(url, headers=HEADERS)
r.raise_for_status()
return r.json()['data']['item']
def list_txs(address, network='mainnet', limit=20):
url = f"{HOST}/addresses-latest/kaspa/{network}/{address}/transactions"
r = requests.get(url, headers=HEADERS, params={'limit': limit})
r.raise_for_status()
return r.json()['data']['items']
addr = 'kaspa:qr...your-address...'
print(get_balance(addr))
for tx in list_txs(addr):
print(tx.get('transactionId'), tx.get('minedInBlockHeight'))
That is enough to render a Kaspa wallet screen. Add fee recommendations and broadcast endpoints when you start sending KAS, and webhooks when you want push instead of pull.
What about sending KAS?
Signing transactions stays in your control — keys never leave your environment, which is how it should be. Crypto APIs gives you the inputs you need and a broadcast endpoint to relay your signed raw transaction to the Kaspa network. You keep custody and security; we handle the network plumbing.
Get started
Grab a free API key at cryptoapis.io, browse the full Kaspa reference at developers.cryptoapis.io, and you have Kaspa indexing and webhooks running in well under an hour. We are actively prioritising the next round of Kaspa endpoints based on developer feedback — if there is something you need that is not there yet, tell us.
Originally published at cryptoapis.io.
Top comments (0)