↑ ↓ navigate↵ open

HTTP API

Endpoints, response fields, status codes, pagination, connection limits and metrics.

On this page · 9
  1. 01Conventions
  2. 02Chain
  3. 03Accounts
  4. 04Transactions
  5. 05Faucet
  6. 06Pagination
  7. 07Limits
  8. 08Status codes
  9. 09Metrics

Conventions

Testnet
https://testnet.leansvm.xyz
Testnet, plain HTTP
http://testnet.leansvm.xyz:80 (for the leansvm CLI)
Own node
http://127.0.0.1:8650 (--rpc default)
Protocol
HTTP/1.1, JSON responses
Amounts
integer units (10^9 per token)
Hashes, ids, addresses
lowercase hex
CORS
Allow-Origin *, GET POST OPTIONS, max-age 86400
Connection
close after each response
Errors
{"error": "<message>"}
Preflight
OPTIONS → 204

Paths on this page are relative to the base URL. The public testnet is at https://testnet.leansvm.xyz; port 80 of the same host serves it over plain HTTP for the leansvm CLI, which does not speak TLS. A node you run yourself serves the same API over plain HTTP on the address given to leansvm-node run --rpc, 127.0.0.1:8650 by default.

Chain

GET/status

chain_id, slot, height, finalized_slot, finalized_hash, base_fee, total_supply, burned, mempool, mempool_min_priority_fee. The last field is the priority fee per byte a new transaction from an account with nothing waiting needs to enter a full mempool.

GET/block/<height or hash>

height, slot, hash, parent, proposer, txs, tx_bytes, base_fee, fees, transactions (array).

GET/blocks?before=H&limit=N

{"blocks": [...], "next": H | null}, newest first. Pass next as before for the following page. A 64-character argument to /block/ is read as a hash, anything else as a height.

Accounts

GET/account/<address>

address, balance, nonce, next_nonce, key_bound, min_priority_fee. next_nonce counts transactions still in the mempool; it is the nonce the next transaction must use. min_priority_fee is the priority fee per byte the account’s next transaction needs to enter a full mempool, which never evicts the account’s own transactions (0 while there is room).

GET/account/<address>/txs?before=H.I&limit=N

{"txs": [...], "next": "H.I" | null}: transactions the account sent or received, newest first. H.I is block height and index within the block.

Transactions

POST/tx

Body: one binary transaction in the v3 wire format, at most 16 KB. 202 {"id"} when admitted to the mempool, 400 {"error"} otherwise.

GET/tx/<id>

404 if unknown. Otherwise one of:
statusFields
appliedid, height, slot, index, sender, recipient, amount, nonce, max_fee_per_byte, priority_fee_per_byte, fee, size
pendingid, sender, recipient, amount, nonce, max_fee_per_byte, priority_fee_per_byte, size
rejectedreason: TxError name, e.g. FeeTooLow
droppedreason: evicted, replaced or expired

Lookup order: mempool → remembered statuses (one snapshot interval) → chain index (permanent) → 404. The mempool is not persisted, so a transaction pending before a restart returns 404 afterwards.

shell
curl -s https://testnet.leansvm.xyz/status
curl -s https://testnet.leansvm.xyz/account/<address>
curl -s https://testnet.leansvm.xyz/tx/<id>
curl -s --data-binary @tx.bin https://testnet.leansvm.xyz/tx      # raw v3 transaction

Faucet

The testnet runs a faucet (leansvm-faucet) on the same host. It pays a fixed amount to any address that asks, once per address and once per client within a cooldown, and stops for the rest of the hour after a set number of payouts. The faucet page uses these two requests.

GET/faucet

address, balance, amount (units per payout), cooldown_secs, per_hour.

POST/faucet/<address>

No body. 202 {id, amount} with the id of the transfer; 429 {error, retry_after} (seconds) when the address or the client was paid within the cooldown or the hourly limit is reached; 503 when the node refused the transfer.
shell
curl -s -X POST https://testnet.leansvm.xyz/faucet/<address>

Pagination

limit defaults to 20 and is clamped to 1–100. next is the cursor for the following page, or null at the end. History queries are served from the index on the HTTP threads and never reach the main thread.

Limits

LimitValueResponse
Request headers8 KiB400 headers too large
Request body16 KiB413 body too large
Time to send a request10 s408 request timed out
Connections64503 too many connections
Connections per address16429 too many connections from this address
Requests per addressburst 100, refill 50 / s429 too many requests
Queue to the main thread1,024503 the node is busy; try again
Main thread answer10 s503 the node did not answer
Response write5 sconnection closed

Loopback addresses (127.0.0.0/8, ::1, also IPv4-mapped) are exempt from the per-address limits; a reverse proxy on the same machine must apply its own. The main thread stops answering when the next slot is due, so request load cannot delay block production.

Status codes

CodeWhen
200JSON result
202POST /tx admitted: {"id": "<hex>"}
204OPTIONS preflight
400malformed request (headers, Content-Length, hex, limit, before, height) or a refused transaction; see mempool errors
404not found, unknown transaction, unknown block
408request not received within 10 s
413body over 16 KiB
429per-address connection or rate limit
503connection limit, main thread busy or not answering, shutting down, index error

Metrics

GET/metrics

Prometheus text format 0.0.4. Every name is prefixed with leansvm_.
TypeMetrics
gaugeslot, height, finalized_slot, base_fee, burned_units, mempool_transactions, mempool_min_priority_fee, accounts, tx_statuses, slot_seconds, slot_seconds_max, block_build_seconds, index_seconds, snapshot_seconds, startup_seconds, replayed_blocks, replayed_txs, clock_offset_slots
counterblocks_finalized_total, txs_admitted_total, txs_refused_total, txs_applied_total, txs_rejected_total, txs_evicted_total, txs_replaced_total, txs_expired_total, snapshots_written_total, snapshot_failures_total