This repository was archived by the owner on Sep 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
REST API Specifications #19
Copy link
Copy link
Open
Description
Info
Endpoint:
get /info/
Response
{
version: number,
mode: "full" | "light",
height: number, // indexed height
additionalIndexes: { // only return this if mode == "light"
contracts: string[],
contractTemplates: string[],
tokenIds: string[]
} | null
}Block Info and Statistics
Endpoints
GET /blocks/
GET /blocks/{headerId:HexString}/
GET /blocks/at/{height:int}/
URL queries
skip: int
take: int
Boxes
Endpoints
GET /boxes/{spent|unspent|all}/{boxId:HexString}/
GET /boxes/{spent|unspent|all}/tokens/{tokenId:HexString}/
GET /boxes/{spent|unspent|all}/addresses/{address:string}/
GET /boxes/{spent|unspent|all}/contracts/{contract:HexString}/
GET /boxes/{spent|unspent|all}/contracts/templates/{template:HexString}/
URL queries
skip: int
take: int
tokenId: HexString | "empty"
R4: HexString | "empty"
R5: HexString | "empty"
R6: HexString | "empty"
R7: HexString | "empty"
R8: HexString | "empty"
R9: HexString | "empty"
confirmed: boolean
- If
confirmedis omitted or equal tonull, then confirmed and unconfirmed boxes must be merged. Which means that new unconfirmed boxes must be added to returning array and confirmed boxes that are being spent in the mempool must be removed from the returning array. - If a default ordering is needed for
takeandskip, I suggest usingcreationHeightandboxId, ascreationHeightsolely is not unique.
Custom query endpoint
dApp constantly need to query for multiple contracts/addresses/templates/tokens, to potentially reduce the amount of roundtrips, I propose a custom query endpoint as described below.
Endpoint
POST /boxes/query/
Body
{
spent: boolean | null,
addresses: string[] | null,
contracts: HexString[] | null,
templates: HexString[] | null,
contractHashes: HexString[] | null,
templateHashes: HexString[] | null,
tokens: HexString[] | null,
registers: {
R4: HexString | "empty" | null,
R5: HexString | "empty" | null,
R6: HexString | "empty" | null,
R7: HexString | "empty" | null,
R8: HexString | "empty" | null,
R9: HexString | "empty" | null
} | null,
skip: number | null,
take: number | null
}addresses,contracts,templates,contractHashes, andtemplateHashesare exclusive.- At least one of
addresses,contracts,templates,contractHashes,templateHashes, ortokensneeds to be defined for the query to be considered valid.
Response
Array<{
boxId: HexString,
transactionId: HexString,
index: number,
ergoTree: HexString,
creationHeight: number,
value: string,
assets: { tokenId: HexString, amount: string }[]
additionalRegisters: {
R4?: HexString,
R5?: HexString,
R6?: HexString,
R7?: HexString,
R8?: HexString,
R9?: HexString,
},
state: {
confirmed: boolean,
spent: boolean,
}
}>- JavaScript doesn't work well with JSON and long numbers, so
box.valueandbox.assets.amountsmust be typed asstring, for improved compatibility.
Tokens
Endpoints
GET /tokens/{tokenId}/ // parsed token metadata
GET /tokens/{tokenId}/minting-box/
Node Relay Endpoints
The following endpoint will serve as proxy endpoint for the node behind running uexplorer instance.
Endpoints
GET /node/headers/last/{count:int}/ // --> node's GET /blocks/lastHeaders/{count}/ endpoint
GET /node/info/ // --> node's GET /info/ endpoint
POST /node/transaction/ // --> node's POST /transactions/ endpoint
POST /node/transaction/check/ // --> node's POST /transactions/check/ endpoint
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels