#REST API
This page is the HTTP reference for developers building wallets, sites, or data clients for NACRE. It covers pearls, pools, transactions, and the test PRL faucet.
The first keyless launchpad on Pearl.
Rules below were checked against the indexer and chain-tools code. They describe a local or test deployment. There is no external audit yet, and mainnet figures are pending. NACRE is not described here as live on mainnet.
A pearl is a token launched on NACRE. A layer is one increment of its curve. The JSON field for the current layer is step (0 through 800). Harvest is the move from the curve to the on-chain market after layer 800. The JSON status for that phase is amm, and the event kind is graduate. A pool is the script-locked output that holds the pearl's PRL. It is keyless: the pool has no private key and can only move by satisfying its script.
Amounts on the wire are GrainStr: a decimal integer string of grain, with no thousands separator and no unit suffix. 1 PRL is 100,000,000 grain. In this page, prose uses separators (50 PRL, 5,000 PRL). Timestamps are Unix milliseconds unless a field says otherwise.
#Shared rules
The indexer prefix is /api/v1. Path parameters :id and :a that contain : must be passed through encodeURIComponent first. ab repeated to 64 hex digits plus :1 is sent as that hex text, then %3A1.
A token id is the reveal transaction's pool output, txid:vout. The protocol comment records vout 1. A txid is 64 lowercase hex characters.
Addresses are Pay-to-Taproot. The human-readable prefix is prl on mainnet, tprl on testnet, and rprl on regtest.
Every indexer error body is JSON:
{
"error": {
"code": "bad_request",
"message": "Invalid query: status: Invalid enum value",
"detail": []
}
}detail is omitted when the handler has nothing extra. Branch on code, not on message.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | Path, query, or body failed validation, or broadcast rejected the transaction before the node |
| 404 | not_found | Unknown token, image, transaction, or route |
| 409 | conflict | Reserved by the error enum. The indexer routes on this page do not return it |
| 422 | node_rejected | The Pearl node refused the broadcast, or the tip could not be read during broadcast |
| 429 | rate_limited | The shared indexer limit was exceeded |
| 500 | internal | Unhandled indexer failure. The message is Internal server error |
Successful JSON responses use Content-Type: application/json; charset=utf-8. Cached GET responses send ETag and Cache-Control. Repeat the request with If-None-Match to receive 304 and an empty body. The default JSON cache lifetime is 1 second (max-age=1). POST /api/v1/tx/broadcast and GET /healthz send Cache-Control: no-store.
The indexer applies one limit to every route except GET /healthz and OPTIONS: 300 requests per 60 seconds per client IP. The response headers are X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (Unix seconds), and, when limited, Retry-After (seconds, at least 1). The indexer reads the first address in X-Forwarded-For when that header is present.
The faucet is a different process. Its default listen address is 127.0.0.1:18787. It does not serve /api/v1/faucet.
#Indexer routes
| Method and path | Use |
|---|---|
GET /healthz | Indexer process and chain tip |
GET /api/v1/tokens | List pearls |
GET /api/v1/tokens/:id | One pearl |
GET /api/v1/tokens/:id/trades | Trades for one pearl |
GET /api/v1/tokens/:id/holders | Holders |
GET /api/v1/tokens/:id/candles | Price candles |
GET /api/v1/tokens/:id/curve | Curve table |
GET /api/v1/tokens/:id/image | Launch image bytes |
GET /api/v1/address/:a/utxos | UTXOs for an address |
GET /api/v1/address/:a/portfolio | PRL balance and pearls held |
GET /api/v1/address/:a/activity | Trades that include an address |
GET /api/v1/tx/:txid | Decoded transaction |
GET /api/v1/tx/:txid/raw | Raw transaction hex |
GET /api/v1/chain/tip | Chain tip and fee hint |
GET /api/v1/stats | Site counters |
POST /api/v1/tx/broadcast | Launch and transfer only |
The indexer does not mount /api/v1/market/:tokenId/orders. Do not send order-book create, list, or cancel calls to it.
#GET /healthz
Reports whether the indexer process is answering and can read the chain tip. It is not the faucet probe. A slow node fails this route, because the handler reads the tip before it responds.
Parameters: none.
GET /healthz HTTP/1.1
Host: indexer.example{
"ok": true,
"service": "indexer",
"network": "testnet",
"uptimeSec": 3600
}service is indexer. network is mainnet, testnet, or regtest. uptimeSec counts from process start.
| HTTP | error.code | When |
|---|---|---|
| 500 | internal | The tip query failed |
Rate limit: none. This path is excluded from the indexer counter.
#GET /api/v1/tokens
Lists pearls, optionally filtered by phase, name prefix, or creator.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
sort | query | string | no | new | new, trending, marketCap, volume24h, progress, or lastTrade |
status | query | string | no | omitted | curve while the pearl is on the bonding curve, or amm after harvest. There is no graduated value |
q | query | string | no | omitted | Prefix match on name, symbol, or id. At most 64 characters |
creator | query | address | no | omitted | P2TR address for the network you are querying |
cursor | query | string | no | omitted | Opaque cursor from the previous nextCursor |
limit | query | integer | no | 50 | 1 through 200 |
GET /api/v1/tokens?sort=new&status=curve&limit=1 HTTP/1.1
Host: indexer.example{
"items": [
{
"id": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef:1",
"genesisOutpoint": "fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210:0",
"name": "Pearl Cat",
"symbol": "PCAT",
"description": "Example pearl",
"image": "/api/v1/tokens/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef%3A1/image",
"creator": "tprl1examplecreator",
"status": "curve",
"ammState": null,
"ammReserveTokens": null,
"step": 120,
"confirmedStep": 118,
"totalLots": 1000,
"poolAddress": "tprl1examplepool",
"poolOutpoint": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:1",
"poolValue": "10000",
"nextPrice": "10000",
"marketCap": "10000000",
"holders": 2,
"volume24h": "0",
"progressBps": 1500,
"createdHeight": 10,
"createdAt": 1763740000000,
"graduatedAt": null
}
],
"nextCursor": null
}name is 1 to 32 characters. symbol matches ^[A-Z0-9]{2,10}$. description is optional and at most 280 characters. website, twitter, and telegram are optional and at most 200 characters. step includes the unconfirmed chain. confirmedStep counts confirmed blocks only. progressBps is step / 800 in basis points, from 0 to 10,000. poolValue, nextPrice, marketCap, and volume24h are grain strings. totalLots is the supply counted in layers (1,000 for the full 1,000,000,000 tokens). On the curve, ammState and ammReserveTokens are null. After harvest they are set, status is amm, and graduatedAt is the harvest time in milliseconds. nextCursor is null when there is no next page.
The numbers in the sample are shapes, not a live pearl.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | A query field failed validation |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/tokens/:id
Returns one pearl. step includes the unconfirmed chain. confirmedStep does not.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
id | path | outpoint | yes | txid:vout, URL-encoded |
GET /api/v1/tokens/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef%3A1 HTTP/1.1
Host: indexer.exampleThe body is one object with the same fields as items[0] in the list response.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | id is not an outpoint |
| 404 | not_found | No pearl with that id |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/tokens/:id/trades
Pages through launch, buy, sell, transfer, and harvest events for one pearl.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
id | path | outpoint | yes | URL-encoded | |
kind | query | string | no | omitted | Comma-separated launch, buy, sell, transfer, graduate. Unknown names return 400 |
cursor | query | string | no | omitted | Opaque |
limit | query | integer | no | 50 | 1 through 200 |
GET /api/v1/tokens/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef%3A1/trades?kind=buy,sell&limit=1 HTTP/1.1
Host: indexer.example{
"items": [
{
"txid": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"tokenId": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef:1",
"kind": "buy",
"phase": "curve",
"address": "tprl1examplebuyer",
"counterparty": null,
"tokens": 1000000,
"grains": "10000",
"feeGrains": "100",
"stepFrom": 0,
"stepTo": 1,
"status": "confirmed",
"seq": 1,
"height": 11,
"time": 1763740800000
}
],
"nextCursor": null
}tokens is the pearl amount as an integer count, not a layer count. One layer is 1,000,000 tokens. grains is principal: PRL the buyer adds to the pool, or PRL the pool pays out on a sell. Other kinds use "0". feeGrains is the platform fee, not the miner fee. phase is required on buy and sell. For phase amm, stepFrom and stepTo are null. seq is the queue number for that pool, or null when the trade did not go through the queue. status is queued, mempool, confirmed, or dropped.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | Bad id, kind, or limit |
| 404 | not_found | Unknown pearl |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/tokens/:id/holders
Pages through current holders of one pearl.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
id | path | outpoint | yes | URL-encoded | |
cursor | query | string | no | omitted | Opaque |
limit | query | integer | no | 50 | 1 through 200 |
GET /api/v1/tokens/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef%3A1/holders?limit=1 HTTP/1.1
Host: indexer.example{
"items": [
{
"tokenId": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef:1",
"address": "tprl1examplepool",
"tokens": 800000000,
"shareBps": 8000,
"tag": "pool"
}
],
"nextCursor": null
}tokens is the integer pearl count. shareBps is that holder's share of supply in basis points, from 0 to 10,000. tag is creator, pool, market, or null.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | Bad id or limit |
| 404 | not_found | Unknown pearl |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/tokens/:id/candles
Returns price and volume buckets in ascending order by bucket start. Prices are in grains per 1,000,000 tokens, excluding the platform fee.
- Second candles (
1s,5s,15s, and30s) use the time the indexer first sees the trade in the mempool, falling back to its accounting time if no mempool timestamp is available. - A second candle has
pending: truewhile it contains at least one unconfirmed trade (queuedormempool). Once all its trades confirm,pendingbecomesfalse. When a trade is dropped, the next read rebuilds the series without it. - Second candles cover a rolling 2-hour window. A bucket with no trades carries forward the previous close when one is available. In that bucket, all four prices equal that close,
nandtokensare0,vis"0", andpendingisfalse. - Intervals of
1mand longer use the trade's accounting time and omitpending. Only second candles are sent as candle events on the WebSocket feed.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
id | path | outpoint | yes | URL-encoded | |
interval | query | string | no | 5m | 1s, 5s, 15s, 30s, 1m, 5m, 15m, 1h, 4h, or 1d |
from | query | integer | no | omitted | Nonnegative Unix milliseconds. Second intervals clamp the lower bound to the start of the 2-hour window and align it down to a bucket start |
to | query | integer | no | omitted | Nonnegative Unix milliseconds. Must be at least from if both are set. Second intervals clamp the upper bound to the indexer's current time and align it down to the last included bucket start |
limit | query | integer | no | 300 | 1 through 1,000. Keeps the most recent buckets in the requested range |
A five-minute candle omits pending:
GET /api/v1/tokens/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef%3A1/candles?interval=5m&limit=1 HTTP/1.1
Host: indexer.example[
{
"t": 1763740500000,
"o": "10000",
"h": "10000",
"l": "10000",
"c": "10000",
"v": "10000",
"tokens": 1000000,
"n": 1
}
]A one-second request made within the example's 2-hour window returns an unconfirmed trade and the empty bucket after it:
GET /api/v1/tokens/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef%3A1/candles?interval=1s&from=1763741094000&to=1763741095000 HTTP/1.1
Host: indexer.example[
{
"t": 1763741094000,
"o": "10000",
"h": "12000",
"l": "10000",
"c": "12000",
"v": "50000",
"tokens": 1000000,
"n": 1,
"pending": true
},
{
"t": 1763741095000,
"o": "12000",
"h": "12000",
"l": "12000",
"c": "12000",
"v": "0",
"tokens": 0,
"n": 0,
"pending": false
}
]The response body is a JSON array of candle objects.
| Field | Type | Meaning |
|---|---|---|
t | integer | Bucket start in Unix milliseconds |
o, h, l, c | GrainStr | Open, high, low, and close |
v | GrainStr | Volume in grains |
tokens | integer | Number of tokens traded. A token counts each time it trades |
n | integer | Number of trades |
pending | boolean | Present on second candles. Indicates whether the bucket contains an unconfirmed trade |
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | Invalid id, interval, time bounds, or limit |
| 404 | not_found | Unknown pearl |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/tokens/:id/curve
Returns the curve fee, the allowed layer sizes, the pool reserve at every layer, and the principal for buying one layer from each layer.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
id | path | outpoint | yes | URL-encoded |
GET /api/v1/tokens/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef%3A1/curve HTTP/1.1
Host: indexer.example{
"tokenId": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef:1",
"tradeFeeBps": 100,
"allowedStepLots": [1, 2, 5, 10, 20, 50],
"poolReserve": ["10000"],
"price": ["10000"],
"step": 0
}tradeFeeBps is an integer from 1 to 10,000. 100 bps is 1%. allowedStepLots lists how many layers one curve trade may move. The live curve response has 801 poolReserve strings (step 0 through 800) and 800 price strings. price[s] is the principal, in grain, to buy one layer from layer s. The sample above is shortened. step is the pearl's current layer.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | Bad id |
| 404 | not_found | Unknown pearl |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/tokens/:id/image
Returns the raw image bytes embedded in the launch inscription. The maximum size is 30,000 bytes, set by TOKEN_META_LIMITS.imageMaxBytes.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
id | path | outpoint | yes | URL-encoded |
GET /api/v1/tokens/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef%3A1/image HTTP/1.1
Host: indexer.exampleHTTP/1.1 200 OK
Content-Type: image/png
Cache-Control: public, max-age=31536000, immutableThe image bytes follow the headers. Supported media types are image/png, image/jpeg, image/webp, and image/gif. Send the response's ETag in If-None-Match on a later request to receive 304 if the image is unchanged.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | Invalid id, unsupported media type, empty image, or image larger than 30,000 bytes |
| 404 | not_found | No image for that pearl |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes. The image route does not have a separate counter.
#GET /api/v1/address/:a/utxos
Lists plain and pearl UTXOs for one address, including unconfirmed outputs. A payment spends only rows with kind plain and spentBy null. A token row carries a pearl. Do not spend it as plain PRL.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
a | path | address | yes | P2TR address. Encode it if your client encodes every path segment |
GET /api/v1/address/tprl1examplebuyer/utxos HTTP/1.1
Host: indexer.example[
{
"txid": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
"vout": 1,
"value": "500000000",
"scriptPubKey": "5120aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"address": "tprl1examplebuyer",
"height": 11,
"kind": "plain",
"tokenId": null,
"tokens": null,
"spentBy": null
},
{
"txid": "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
"vout": 4,
"value": "1000",
"scriptPubKey": "5120bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"address": "tprl1examplebuyer",
"height": null,
"kind": "token",
"tokenId": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef:1",
"tokens": 1000000,
"spentBy": null
}
]value is grain. height is null while the output is unconfirmed. tokens is null on a plain output and the pearl count on a token output. spentBy is the spending txid when a pending or queued transaction already uses the output.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | a is not a P2TR address |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/address/:a/portfolio
Returns confirmed and unconfirmed plain PRL, plus each pearl the address holds. Plain balances leave out the grain that sits on pearl UTXOs.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
a | path | address | yes | P2TR address |
GET /api/v1/address/tprl1examplebuyer/portfolio HTTP/1.1
Host: indexer.example{
"address": "tprl1examplebuyer",
"confirmed": "500000000",
"unconfirmed": "0",
"tokens": [
{
"token": {
"id": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef:1",
"name": "Pearl Cat",
"symbol": "PCAT",
"status": "curve"
},
"tokens": 1000000,
"valueGrains": "10000"
}
]
}confirmed and unconfirmed are grain strings. Each tokens[] entry embeds a full Token object (the sample shows only the identifying fields) plus tokens (count) and valueGrains (grain string, floor of count times nextPrice divided by 1,000,000).
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | a is not a P2TR address |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/address/:a/activity
Pages through protocol trades that include this address.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
a | path | address | yes | P2TR address | |
kind | query | string | no | omitted | Same comma-separated kinds as token trades |
cursor | query | string | no | omitted | Opaque |
limit | query | integer | no | 50 | 1 through 200 |
GET /api/v1/address/tprl1examplebuyer/activity?limit=1 HTTP/1.1
Host: indexer.exampleThe body is a page of Trade objects, the same shape as GET /api/v1/tokens/:id/trades.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | Bad address, kind, or limit |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/tx/:txid
Returns one transaction's status and the protocol events the indexer decoded from it.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
txid | path | txid | yes | 64 hex characters |
GET /api/v1/tx/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb HTTP/1.1
Host: indexer.example{
"txid": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"status": "confirmed",
"height": 11,
"time": 1763740800000,
"vsize": 1214,
"minerFee": "3642",
"events": [
{
"kind": "buy",
"phase": "curve",
"txid": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"tokenId": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef:1",
"address": "tprl1examplebuyer",
"tokens": 1000000,
"grains": "10000",
"fee": "100",
"poolOutpoint": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:1",
"poolValue": "20000",
"stepFrom": 0,
"stepTo": 1
}
]
}minerFee is grain. Event fee is the platform fee in grain. A curve buy or sell includes stepFrom and stepTo. An amm buy or sell sets those to null and adds stateFrom and stateTo. A launch event carries creator, meta, imageMime, poolOutpoint, launchFee, and tradeFeeBps. A transfer event carries from, to, and tokens. A graduate event carries address and poolValue.
vsize in the sample is an illustration of the field, not a promise about every buy.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | txid is not 64 hex characters |
| 404 | not_found | The indexer has no such transaction |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/tx/:txid/raw
Returns the raw transaction, including the witness, as lowercase hex. The wallet SDK calls this when it must rebuild a launch reveal, a pool transaction, or the transaction that created a pearl UTXO, and that transaction is not already in memory. Mempool transactions are included. The node must be running with a transaction index.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
txid | path | txid | yes | 64 hex characters |
GET /api/v1/tx/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/raw HTTP/1.1
Host: indexer.example{
"rawTx": "02000000000101"
}Before it returns, the indexer strips the witness, hashes the remainder, and checks that the result equals the path txid. A mismatch is 404. The sample hex is only a shape.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | txid is not 64 hex characters |
| 404 | not_found | The node does not know the transaction, or the returned bytes hash to a different txid |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/chain/tip
Returns the current tip, the mempool size, and the suggested miner fee.
Parameters: none.
GET /api/v1/chain/tip HTTP/1.1
Host: indexer.example{
"network": "testnet",
"height": 11,
"hash": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"time": 1763740800000,
"mempoolTxs": 1,
"feeRate": 2
}feeRate is grain per virtual byte. hash is the tip block hash.
| HTTP | error.code | When |
|---|---|---|
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | The tip could not be read |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes.
#GET /api/v1/stats
Returns site-wide counters.
Parameters: none.
GET /api/v1/stats HTTP/1.1
Host: indexer.example{
"tokens": 1,
"graduated": 0,
"trades24h": 1,
"volume24h": "10000",
"tvl": "10000",
"traders24h": 1
}graduated counts pearls whose status is amm (harvested). volume24h and tvl are grain strings. tvl is PRL locked in pools. The sample is a shape, not a measured deployment.
| HTTP | error.code | When |
|---|---|---|
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes. Stats does not have its own lower limit in the indexer.
#POST /api/v1/tx/broadcast
Submits a launch (commit or reveal) or a pearl transfer. Curve buys, curve sells, harvest (graduate), and post-harvest market buys and sells are rejected here. Submit those to the queue at /seq/v1.
The indexer reads the next block height as tip height plus 1. It forwards the transaction only when every input has nSequence equal to 0xffffffff, or when nLockTime is strictly less than that next height. Anything else is 400 and is not sent to the node. This check exists because Pearl node v1.5.7 does not apply absolute lock time inside the mempool, so a non-final transaction can sit there and never be mined.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
rawTx | body | hex string | yes | Even-length hex. The decoder accepts witness and legacy transactions |
POST /api/v1/tx/broadcast HTTP/1.1
Host: indexer.example
Content-Type: application/json
{"rawTx":"02000000000101"}{
"txid": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | detail.reason is non_final_tx (also lockTime, nextHeight, nonFinalInputIndex, and sequence), or invalid_raw_tx, or the hex is too short, or the decoded events include buy, sell, or graduate |
| 422 | node_rejected | The node rejected the transaction, or the tip read failed |
| 429 | rate_limited | Shared indexer limit |
| 500 | internal | Unhandled failure |
Rate limit: 300 requests per 60 seconds per IP, shared with the other indexer routes. Broadcast does not have a separate 30-per-minute bucket in the indexer.
#Faucet
The faucet hands out test PRL on regtest and testnet. chain-tools refuses to start when PAD_NETWORK is mainnet, so this process does not pay mainnet PRL. Default bind is 127.0.0.1:18787. Amounts are grain strings. The address you submit must be a P2TR address on the faucet's network: rprl on regtest, tprl on testnet.
GET /healthz on this process returns {"ok":true} and does not call the node. Node trouble shows up on GET /faucet/v1/status instead.
Send Origin from a browser. The faucet echoes that origin. It never sends *. A request whose origin is not allowed still gets a body, but without Access-Control-Allow-Origin, so the browser drops it. OPTIONS returns 204 when the origin is allowed and 403 with no CORS header when it is not.
| Item | Value |
|---|---|
FAUCET_CORS_ORIGINS | Comma-separated origins, or the keyword local |
| One origin | https://host[:port] with no path |
local | localhost, 127.0.0.1, and [::1], any port, http or https |
| Unset, not production | Same as local |
Unset, NODE_ENV=production | SITE_URL, plus https:// plus SITE_DOMAIN. Entries that contain __ are dropped. If both are missing, no browser origin is allowed |
| Methods | GET, POST, HEAD, OPTIONS |
| Request header | Content-Type |
| Preflight cache | Access-Control-Max-Age: 600 |
| Vary | Origin |
Requests with no Origin (a script on the same machine) are unchanged. X-Forwarded-For is ignored unless FAUCET_TRUST_PROXY=1. Behind a proxy, set that flag or the challenge and the IP limit use the proxy address.
Claim in this order:
GET /faucet/v1/status?address=<address>and readdrip,balance, and that address'seligibleandretryAt.- When
eligibleis true,GET /faucet/v1/challengeand keepid,prompt, andexpiresAt. promptlooks like17 + 42. Each addend is an integer from 10 to 99. Sum them and send the sum as a decimal string, for example59.- Within 120 seconds,
POST /faucet/v1/claimfrom the same IP, withContent-Type: application/json.answermust be a JSON string, not a JSON number. - Show the returned
txidas unconfirmed. The next status call for that address haseligiblefalse.
The challenge is bound to the IP. A new challenge from the same IP deletes the previous one. A wrong answer, an expired challenge, or a different IP deletes the challenge. Request another one. Every POST /faucet/v1/claim counts toward the IP limit, including a body the parser rejects.
#GET /healthz
Process liveness check for chain-tools.
Parameters: none.
GET /healthz HTTP/1.1
Host: 127.0.0.1:18787{
"ok": true
}| HTTP | error.code | When |
|---|---|---|
| 500 | internal | The process failed outside the faucet handlers |
Rate limit: none on this path.
#GET /faucet/v1/status
Returns faucet balances and, when an address is passed, whether that address may claim now.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
address | query | address | no | omitted | When omitted, the response field address is null. When present, it must match PAD_NETWORK |
GET /faucet/v1/status?address=rprl1example HTTP/1.1
Host: 127.0.0.1:18787{
"network": "regtest",
"faucetAddress": "rprl1faucet",
"balance": "100000000000",
"todaySent": "5000000000",
"dailyCap": "500000000000",
"drip": "5000000000",
"cooldownMs": 86400000,
"address": {
"address": "rprl1example",
"eligible": false,
"retryAt": 1763740800000
}
}| Field | Unit | Meaning |
|---|---|---|
balance | grain | Confirmed plain UTXOs the faucet can spend. Excludes pearl outputs, unconfirmed outputs, and spent outputs |
todaySent | grain | Grain already counted for the current UTC day |
dailyCap | grain | Cap for that UTC day. Default 500000000000 (5,000 PRL) |
drip | grain | One claim. Default 5000000000 (50 PRL) |
cooldownMs | milliseconds | Per address. Default 86,400,000 (24 hours) |
address.eligible | boolean | Whether that address may claim now |
address.retryAt | Unix milliseconds | Next claim time while cooling down. Null when the address may claim |
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | The address is malformed or belongs to another network |
| 503 | internal | The node could not be reached while reading the faucet balance |
| 500 | internal | Any other handler failure |
GET /faucet/v1/status does not count toward the claim IP limit.
Rate limit: not part of the 10-claim window. A browser origin that is not allowed still receives this JSON, without a CORS allow header.
#GET /faucet/v1/challenge
Issues one addition problem bound to the connection IP. There is no body.
Parameters: none.
GET /faucet/v1/challenge HTTP/1.1
Host: 127.0.0.1:18787{
"id": "0123456789abcdef0123456789abcdef",
"prompt": "17 + 42",
"expiresAt": 1763740920000
}| Field | Meaning |
|---|---|
id | 32 hex characters from 16 random bytes. Send it back as challengeId |
prompt | "<a> + <b>" with a and b each from 10 to 99 |
expiresAt | Unix milliseconds. The challenge lasts 120 seconds |
| HTTP | error.code | When |
|---|---|---|
| 500 | internal | The handler failed |
GET /faucet/v1/challenge does not count toward the claim IP limit.
Rate limit: not part of the 10-claim window.
#POST /faucet/v1/claim
Pays one drip after the challenge is solved from the same IP.
| Name | In | Type | Required | Default | Rules |
|---|---|---|---|---|---|
address | body | address | yes | P2TR address on PAD_NETWORK | |
challengeId | body | string | yes | Length 16 through 128 | |
answer | body | string | yes | Matches ^[0-9]{1,6}$. The decimal sum, as a JSON string |
POST /faucet/v1/claim HTTP/1.1
Host: 127.0.0.1:18787
Content-Type: application/json
{"address":"rprl1example","challengeId":"0123456789abcdef0123456789abcdef","answer":"59"}{
"txid": "5555555555555555555555555555555555555555555555555555555555555555",
"address": "rprl1example",
"amount": "5000000000"
}amount equals the current drip, in grain. txid is the transaction submitted to the node. Show it as unconfirmed until it is in a block.
| HTTP | error.code | When |
|---|---|---|
| 400 | bad_request | Bad address, wrong network, body shape, or a challenge that is wrong, expired, or from another IP. Request a new challenge after a failed check |
| 404 | not_found | The path is not a faucet route. Do not retry it as a claim |
| 409 | conflict | The faucet balance cannot cover the drip, or coinbase outputs are not yet spendable. Do not hammer the route |
| 429 | rate_limited | The address is still cooling down, the UTC daily cap is spent, or this IP has posted too many claims. Cooldown responses include detail.retryAt (Unix milliseconds) and Retry-After (seconds, at least 1). A spent daily cap has no retryAt. Wait for the next UTC day |
| 502 | node_rejected | The node rejected the transaction. The address cooldown is not consumed. Request a new challenge and try again |
| 503 | internal | The node was unreachable |
| 500 | internal | Any other handler failure. Do not treat the body as a claim |
Rate limit: 10 POST requests per 600,000 milliseconds (10 minutes) per IP, by default. Change it with FAUCET_IP_LIMIT and FAUCET_IP_WINDOW_MS. Change the drip, cap, and cooldown with FAUCET_DRIP_GRAINS, FAUCET_DAILY_CAP_GRAINS, and FAUCET_COOLDOWN_MS. The drip cannot be below 1,000 grain, and the daily cap cannot be below the drip.
message on a faucet error is a short human string. It is not a stable contract. Branch on error.code.
#Next
Pool trades and harvest use the queue reference. Live updates use the indexer WebSocket reference.