개발자를 위한 문서 / 애플리케이션 API

익스플로러 API

노드가 일부러 되지 않는 아카이브입니다. 전체 히스토리를 보유하고, 이 체인에서 호출 트레이스를 가진 유일한 표면이며, 가장 강한 의미에서 읽기 전용입니다. 모든 POST는 405입니다.

이것이 존재하는 이유

노드는 짧은 히스토리 창 - 대략 2분치 블록 - 을 보관하며, 그 바깥의 질의는 오류가 아니라 null로 답합니다. 의도한 맞바꿈입니다. 현재를 빠르게 제공하고 과거는 그 일을 위해 만들어진 것에 넘깁니다. 이 서비스가 바로 그것입니다. 시퀀서가 진행하면서 모든 로그를 Postgres에 복사하고, 이 API가 그 인덱스를 읽습니다.

그래서 두 질문은 여기서만 답을 얻습니다.

  • 노드의 창보다 오래된 것은 무엇이든. 오늘 아침의 트랜잭션, 지난주의 블록, 어떤 토큰의 전체 전송 히스토리입니다.
  • 호출 트레이스. 노드는 debug 네임스페이스를 전혀 노출하지 않으므로, GET /tx/{hash}가 이 체인에서 트랜잭션의 내부 호출을 볼 수 있는 유일한 곳입니다.
이것은 인덱스이지 두 번째 노드가 아닙니다

어떤 라우트의 어떤 필드는 요청이 처리되는 동안 노드에서 실시간으로 읽습니다. 잔액, 네임 서비스 레코드, 컨트랙트 탐침, 인덱스가 아직 따라잡지 못한 블록의 미니블록들입니다. 노드에 닿을 수 없을 때 그것들은 null이나 부재로 돌아오고 나머지 답은 인덱스에서 제공되므로, 부분적인 답은 정상이며 오류를 일으키지 않습니다.

베이스 URL과 CORS

엔드포인트Value
공개https://explorer.picklechain.xyz/api/네임 서비스와 툴킷 사이트도 /api/에 마운트합니다
직접 운영하는 스택http://127.0.0.1:4010서비스 자신의 포트. 배포되는 compose 파일에서는 컨테이너 네트워크 밖으로 공개되지 않습니다
CORS허용 목록OPTIONS는 GET과 OPTIONS를 허용하며 204로 답합니다. 목록에 없는 Origin은 403으로 거절됩니다

체인

블록, 미니블록, 트랜잭션, 그리고 수수료 분배.

Params
none
반환
a flat object of counters

Chain-wide counters: block and transaction totals, wallets, gas used, the cadence figures the node reports, the mini-block head, index lag and the spool's own health.

별칭 경로. GET /

알아 둘 점. Recomputed once a second by a background thread and served from a cache for six tenths of a second, so two calls in the same instant give the same answer. It also carries a rate counter this reference does not quote: the site publishes no throughput figure, and the number is local anyway.

Params
none
반환
{stats, charts, blocks, txs, topAccounts}

The explorer's front page in one call: the cached stats, 48 chart points, the 8 most recent blocks that carried transactions, 12 transactions and the 8 busiest accounts.

알아 둘 점. Use this instead of five calls. Its parts are the other routes' defaults and nothing about it is configurable.

Params
limit (default 48, clamped to 200)
반환
[{number, timestamp, txCount, gasUsed}]

A bare array, oldest first.

알아 둘 점. It prefers blocks that carried transactions and falls back to all blocks only when fewer than four match, so the series is not evenly spaced in time and must not be read as one.

Params
limit, offset, active=1
반환
[{number, hash, timestamp, gasUsed, txCount, miniCount}]

A bare array, newest first. `active=1` returns only blocks that carried transactions.

알아 둘 점. No total is returned, so there is nothing to page against except asking until you get a short answer.

Params
limit, offset over the block's transactions
반환
one block with its transactions and mini-blocks

The number is parsed permissively: decimal and 0x both work.

알아 둘 점. `limit` defaults to 50 here rather than 25, and the mini-blocks fall back to a live read against the node when the index has none for the block. 404 when unknown.

Params
limit, offset
반환
{total, minis: [...]}

Mini-blocks, newest first. One of the few routes that does return a total.

알아 둘 점. Timestamps are `timestamp_us`: MICROSECONDS, not seconds, and a decimal number rather than a hex quantity.

Params
limit, offset over the transactions
반환
one mini-block

By decimal number or by hash.

알아 둘 점. When the index does not have it, the service asks the node - and the answer then ALSO carries `stateDiffHash`, `sequencerSig` and `receipts`, which the indexed answer does not. The shape depends on where it was found.

/txs

GET
Params
limit, offset
반환
a bare array, newest first

Transaction summaries.

알아 둘 점. No total.

Params
none
반환
the full transaction

The richest object in the API: input data, the decoded method for known selectors, logs with labelled addresses, CALL TRACES, token transfers and NFT transfers.

알아 둘 점. The traces are the reason this route exists. The node exposes no debug namespace at all, so there is nowhere else on this chain to get them. 404 when unknown.

Params
none
반환
{deployed, router, split, burn, launches, arcadeSkims, deferred, claimed, pendingEthWei, ...}

Everything the fee split has done and everything still waiting, read from the log spool rather than over RPC.

알아 둘 점. `{"deployed": false}` and NOTHING ELSE when the fee layer is not in the manifest - that is an ordinary state, not an error, because that layer is deployed by hand. The ether side and the token side are kept as separate figures and never summed.

계정

누가 거래했는지, 그리고 한 주소에 대해 알려진 전부.

Params
limit, offset
반환
{total, accounts: [...]}

Accounts ordered by how much they have transacted.

알아 둘 점. The ordering is by transaction count, not by balance.

Params
limit, offset over the transaction lists
반환
the largest payload in the service

Balance, nonce, counts, whether it is a contract, its creator and what it created, token and NFT holdings with metadata, the name-service record, and recent transactions and transfers.

알아 둘 점. `bytecode` is TRUNCATED to 400 hex characters with an ellipsis appended; `bytecodeSize` is the real length. The whole answer is cached for a few seconds under a key that includes the paging, so two different pages are two different cache entries.

토큰, NFT, 이름

레지스트리와 합쳐진 메타데이터, 그리고 JSON이 아닌 하나의 라우트.

Params
none
반환
a list of at most 40 tokens

PKL pinned first, then by transfer count. Each entry merges a live probe of the contract with the operator's registry entry.

알아 둘 점. Forty is a hard cap and there is no paging past it. An address that probes as an NFT is skipped even if the registry calls it a token.

Params
none
반환
{nfts: [...]}

At most 40 collections, verified ones first, then by how many have been minted.

알아 둘 점. The collection list is DISCOVERED from transfer logs rather than registered, so a collection nobody has traded is absent.

Params
limit, clamped to 48
반환
the collection, its items and its 30 most recent transfers

Collection metadata merged from the chain and the registry.

알아 둘 점. Items are fetched one at a time up to the clamp, and off-chain metadata is resolved by a BACKGROUND thread - so the first request for a cold collection returns items whose metadata is still missing, and a second request a moment later returns more. Held for fifteen seconds in a cache of its own.

Params
none
반환
one item plus `collectionMeta`

One token of a collection.

알아 둘 점. The token id must be all digits, or the path does not match this route at all and you get the 404 for an unknown route.

Params
none
반환
{name, label, available, reserved, owner, resolved, expires, price, twitter, website, description}

A name-service lookup, read live from the registry contract.

알아 둘 점. A trailing suffix is stripped, and the label must be 3 to 32 characters. A name outside that range, and any lookup at all when the name service is not configured, is a 404 - which is indistinguishable from a name that does not exist.

Params
none
반환
raw image bytes

The only non-JSON, non-stream route. The content type is inferred from the stored file's extension.

알아 둘 점. 404 as JSON when there is no logo, so a client must check the status before treating the body as an image.

실시간, 그리고 GET이 아닌 두 동사

이벤트 스트림, 사전 요청, 그리고 405.

Params
none
반환
text/event-stream, one stats frame per update

Server-sent events carrying the same object /stats returns, pushed when it changes.

알아 둘 점. Bounded to 32 concurrent streams - the 33rd gets 503 - and the server CLOSES every stream after five minutes. A client that does not reconnect simply stops receiving, with no error.

any

OPTIONS
Params
none
반환
204

The preflight. Allowed methods are GET and OPTIONS, allowed header is Content-Type.

알아 둘 점. 403 when an Origin is present and not on the allowlist, rather than a 204 without the allow header.

any

POST
Params
none
반환
405

This API is read-only and answers 405 to every POST, in JSON and with the CORS headers.

알아 둘 점. It had one write route: a token-metadata edit signed by the contract's owner. It is gone, along with the form that called it, because an explorer that takes visitor-supplied identity for an asset is an impersonation surface.

한도, 페이징, 캐시

한도Value
Request rate300 per minute per client addressthen 429; the window is wall-clock and resets on the minute
Client identitythe rightmost trusted X-Forwarded-For entryindexed from the right by the number of trusted proxy hops, because the leftmost entry is whatever the client wrote
Request body600,000 bytesthere is nothing to POST, but the cap exists
List paginglimit <= 100, offset >= 0a non-numeric limit silently becomes the default rather than erroring
Live streams32 concurrent, 300 seconds each503 above the first, silent close at the second
Answer cacheabout 3 secondson /address, /tokens, /nfts and the NFT routes; the stats cache is shorter

요청 한도는 클라이언트 주소별이며, 익스플로러 자신의 페이지와 공유됩니다

분당 삼백 요청은 사람에게는 넉넉하고 백필에는 빠듯합니다. 창은 벽시계 기준입니다. 미끄러지는 대신 매분 초기화되므로, 분이 바뀌는 지점의 폭주는 두 창 분량을 순식간에 다 쓰고 나머지 시간 동안 429로 답할 수 있습니다. 이 서비스에는 retry-after 헤더가 없습니다 - 직접 백오프하십시오.

세는 기준이 되는 신원은 전달된 클라이언트 주소이며, 사슬의 오른쪽 끝에서 읽습니다. 가장 왼쪽 항목은 호출자가 쓴 것이기 때문입니다. 덧붙이지 않는 프록시 뒤에서는 모든 호출자가 한 버킷으로 뭉개지고 인터넷 전체가 하나의 예산을 나눠 씁니다.

페이징은 limit과 offset이며 백으로 잘립니다. 숫자가 아닌 limit은 오류가 아니라 기본값이 되고, 음수는 1이 됩니다 - 그래서 잘못된 요청은 항의가 아니라 그럴듯한 답을 받습니다. 대부분의 목록 라우트는 총계를 돌려주지 않으며, /minis와 /accounts가 예외입니다.

답은 잠깐 캐시됩니다

/address, /tokens, /nfts와 NFT 라우트들은 경로와 페이징으로 키잉된 짧은 수명의 캐시에 담기고, /stats는 백그라운드 스레드가 다시 계산해 더 짧은 캐시에서 제공됩니다. 같은 순간의 똑같은 두 요청은 똑같은 답을 주는데, 그것은 페이지에는 괜찮고 확인 루프에는 틀립니다. 영수증은 이것이 아니라 노드에 폴링하십시오.

신선도와 지연

/stats는 인덱스가 얼마나 최신인지 말해 주는 숫자들을 실어 나릅니다. latestBlock과 대비되는 indexedBlock, 그 차이인 indexLag, 그리고 구체화된 뷰를 위한 derivedLag입니다. 토큰 잔액과 NFT 소유권은 별도의 워커가 만들며, 그것이 나온 트랜잭션보다 뒤처질 수 있습니다.

bash
# Is the archive current? Compare the two, do not trust either alone.
curl -s "$EXPLORER_API/stats" | jq '{latestBlock, indexedBlock, indexLag, derivedLag}'

# One transaction, whole, traces included. This is the route with no substitute.
curl -s "$EXPLORER_API/tx/$HASH" | jq '{success, decoded, traces: (.traces|length), tokenTransfers}'

# Page an address's history by offset - and see the note below before relying on it.
curl -s "$EXPLORER_API/address/$ADDR?limit=100&offset=0" | jq '.transactions | length'

offset 페이징은 자라는 목록 밑에서 밀립니다

여기의 모든 목록은 새것이 먼저이고, 새 행은 머리에 도착합니다. 그래서 첫 페이지 직후에 가져온 두 번째 페이지는 첫 페이지와 겹치고, 걷는 동안 행이 통째로 건너뛰어질 수도 있습니다. 완전해야 하는 백필이라면 블록 번호로 페이징하며 아래로 내려가거나 한 번에 한 블록씩 가져오십시오. offset은 사용자 인터페이스를 위한 것이지 임포터를 위한 것이 아닙니다.

무엇을 키잉하기 전에 알아 둘 비대칭이 하나 더 있습니다. 이 체인은 logIndex를 블록이 아니라 트랜잭션마다 매기므로 (blockNumber, logIndex) 쌍은 유일하지 않습니다. 만드는 모든 키에 트랜잭션 해시를 포함하십시오.