{% extends "base.html" %} {% block body_class %}{% endblock %} {% block title %}MoonBite Developers — API, docs & run a node{% endblock %} {% block meta_description %}Build on MoonBite: a read-only REST API for blocks, transactions and search, plus everything you need to run your own node.{% endblock %} {% block head_extra %} {% endblock %} {% block content %}
Developers · Open network
A clean, read-only REST API for the chain: blocks, transactions and search, no keys required. Run a node, index the chain, or wire MBITE into your app.
# The coin's monetary rules, as JSON curl -s https://moonbite.org/api/consensus # Response (abridged, live values) { "block_time_sec": {{ consensus.block_time_sec|tojson }}, "current_reward_coins": {{ consensus.current_reward_coins|tojson }}, "halving_interval": {{ consensus.halving_interval|tojson }}, "height": {{ consensus.height|tojson }}, "max_supply_coins": {{ consensus.max_supply_coins|tojson }}, "status": "success", … }
Quick start
Open a terminal and run each command. Every response is JSON with a status field.
Get the height, tip hash, coins in circulation, tx count and mempool size.
curl -s https://moonbite.org/api/blockchain/info
{
"status": "success",
"height": 128,
"tip_hash": "…",
"total_money_coins": 1280,
"tx_count": 129,
"mempool_size": 0
}
Page through blocks, newest first. limit takes 1–50; offset skips from the tip.
curl -s "https://moonbite.org/api/explorer/blocks?limit=5&offset=0"
{
"status": "success",
"blocks": [ { "height": 128,
"hash": "…", "tx_count": 1,
"confirmations": 1 } ],
"total": 129
}
Pass a height, a block hash or a txid as q. Height 0 is the genesis block, so this command always resolves.
curl -s "https://moonbite.org/api/explorer/search?q=0"
Reference
Three groups of endpoints. Paths are relative to https://moonbite.org or to your own node.
REST API
Every endpoint returns JSON with a status field. These are read-only: they never move funds or expose keys.
| Endpoint | Returns |
|---|---|
| GET/api/blockchain/info | Chain height, tip hash, coins in circulation, tx count and mempool size. |
| GET/api/explorer/blocks | Paginated block list, newest first. Params: limit (1–50), offset. |
| GET/api/explorer/block/<id> | A single block by height or hash, including its transactions. |
| GET/api/explorer/tx/<txid> | A transaction by id, from the active chain or the mempool, with inputs/outputs. |
| GET/api/explorer/search?q= | Resolve a query to a block (height/hash) or a transaction (txid). |
| GET/api/transactions | The most recent transactions across the mempool and latest blocks. |
| GET/api/consensus | The coin's monetary rules (subsidy, halving interval, block time, max supply) plus the live reward and height. Every number on this site is rendered from it. |
Exchange API · Phase 2
The order book stores intents only: never coins, keys, or balances. Settlement is a cross-chain HTLC atomic swap between the two wallets; the server just coordinates the hand-off and, once enabled, verifies it on-chain. A trade only moves last_price after the verifier confirms both HTLC legs redeemed on-chain. There is no fabricated market data.
| Endpoint | Auth | What it does |
|---|---|---|
| POST/api/exchange/order | None | Place a buy/sell order. Returns a one-time secret cancel_token: the only credential that can cancel the order or drive its swap. The public MBITE address cannot. |
| GET/api/exchange/orders?pair= | None | The public order book for a pair: bids, asks, and last_price (null until an on-chain-verified trade settles). The cancel_token is never exposed on any read path. |
| POST/api/exchange/order/<id>/swap/init | cancel_token | Register the HTLC hand-off for a matched pair. Records only public swap parameters: hashlock, recipient/refund pubkeys, and timelocks (base must out-live quote). No key or preimage is ever accepted. |
| POST/api/exchange/order/<id>/swap/funded | cancel_token | Report an HTLC funding txid for one leg (base | quote). This is only a hint telling the verifier where to look; the fact is re-checked on-chain, never trusted on your word. Advances the state machine toward both_locked. |
| GET/api/exchange/order/<id>/swap | None | The public swap state for a matched order. The preimage appears only once it is already public on-chain.swap_init → base_funded → quote_funded → both_locked → quote_redeemed → base_redeemed → settled(or expired on refund/timeout) |
| POST/api/exchange/verify operator | X-Verifier-Token | Runs one read-only on-chain verification pass over pending swaps and settles any that fully redeemed. Off unless the operator sets VERIFIER_ENABLED, and gated by an X-Verifier-Token secret: intended for a cron/timer, not public traffic. The single event that lets last_price move. |
{ "side": "sell", "pair": "MBITE/LTC",
"price": "0.0005", "amount": "100",
"mbite_address": "moon1…",
"quote_address": "ltc1…" }
{ "cancel_token": "…",
"hashlock": "<sha256(preimage)>",
"base_recipient_pubkey": "02…",
"base_refund_pubkey": "02…",
"quote_recipient_pubkey": "02…",
"quote_refund_pubkey": "02…",
"base_locktime": 172800,
"quote_locktime": 86400 }
How the swap verifier works
The swap verifier assembles the HTLC redeemscript, derives its funding address, confirms both legs are funded to the agreed amount and depth, extracts the preimage from the public quote redemption, and confirms the base leg reused that same preimage. It builds, signs, and broadcasts nothing. See swap_verifier.py in the repo.
Merchant API
Raise an invoice against your own address; the server observes the chain for a matching inbound payment and marks it paid. Funds go wallet-to-wallet. The server never holds them.
| Endpoint | Auth | What it does |
|---|---|---|
| POST/api/merchant/invoice | merchant_id + X-Merchant-Token | Raise a payment request against a merchant address. Snapshots the address's prior receipts so only a new inbound payment settles this invoice. Returns a BIP21-style pay_uri. |
| GET/api/merchant/invoice/<id> | None | Poll one invoice. Re-checks the chain for payment on every call and flips pending → paid / expired. |
| GET/api/merchant/invoices?merchant_id= | X-Merchant-Token | A shop dashboard read: list a merchant's invoices, each freshly checked on-chain. Listing also advances any that have been paid or expired since last seen. |
| POST/api/merchant/invoices/poll | merchant_id + X-Merchant-Token | Sweep a merchant's pending invoices in one pass, auto-marking paid/expired ones, so a shop (or a timer) need not poll each invoice by hand. Idempotent; observes only. |
Run a node
A full node validates every block and transaction against MoonBite's consensus rules and helps other peers stay in sync. Don't trust: verify.
Read the node and downloads guide, then install the build for your platform.
Ask your node's wallet for a fresh receiving address.
moonbite-cli getnewaddress
Query your own node instead of moonbite.org. The response has the same shape as in the quick start.
curl -s http://127.0.0.1:5000/api/blockchain/info
Built to be read
Battle-tested core, familiar tooling and address formats (moon1… / M…).
Public read-only endpoints. Nothing here can spend coins or reveal a key.
Browser reads from other origins are allow-listed, never a wildcard. Call the API from your backend, or run your own node and add your origin to ALLOWED_ORIGINS.