{% 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 %}
  1. MoonBite
  2. Developers

Developers · Open network

Build on MoonBite.
Read the chain over HTTP.

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.

  • No keys to read
  • Read-only: never moves funds
  • JSON with a status field
GET /api/consensus
# 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

Make your first request. No sign-up, no key.

Open a terminal and run each command. Every response is JSON with a status field.

  1. Read the chain state

    Get the height, tip hash, coins in circulation, tx count and mempool size.

    Request
    curl -s https://moonbite.org/api/blockchain/info
    Response · example
    {
      "status": "success",
      "height": 128,
      "tip_hash": "…",
      "total_money_coins": 1280,
      "tx_count": 129,
      "mempool_size": 0
    }
  2. List the newest blocks

    Page through blocks, newest first. limit takes 1–50; offset skips from the tip.

    Request
    curl -s "https://moonbite.org/api/explorer/blocks?limit=5&offset=0"
    Response · example
    {
      "status": "success",
      "blocks": [ { "height": 128,
        "hash": "…", "tx_count": 1,
        "confirmations": 1 } ],
      "total": 129
    }
  3. Look up a block or transaction

    Pass a height, a block hash or a txid as q. Height 0 is the genesis block, so this command always resolves.

    Request
    curl -s "https://moonbite.org/api/explorer/search?q=0"

Reference

API reference

Three groups of endpoints. Paths are relative to https://moonbite.org or to your own node.

REST API

Read-only endpoints

Every endpoint returns JSON with a status field. These are read-only: they never move funds or expose keys.

EndpointReturns
GET/api/blockchain/infoChain height, tip hash, coins in circulation, tx count and mempool size.
GET/api/explorer/blocksPaginated 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/transactionsThe most recent transactions across the mempool and latest blocks.
GET/api/consensusThe 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

Non-custodial order book and atomic-swap settlement

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.

EndpointAuthWhat it does
POST/api/exchange/orderNonePlace 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=NoneThe 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/initcancel_tokenRegister 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/fundedcancel_tokenReport 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>/swapNoneThe 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 operatorX-Verifier-TokenRuns 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.
POST /api/exchange/order · body
{ "side": "sell", "pair": "MBITE/LTC",
  "price": "0.0005", "amount": "100",
  "mbite_address": "moon1…",
  "quote_address": "ltc1…" }
POST …/swap/init · body
{ "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

Accept MBITE: payment observation, no custody

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.

EndpointAuthWhat it does
POST/api/merchant/invoicemerchant_id + X-Merchant-TokenRaise 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>NonePoll one invoice. Re-checks the chain for payment on every call and flips pending → paid / expired.
GET/api/merchant/invoices?merchant_id=X-Merchant-TokenA 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/pollmerchant_id + X-Merchant-TokenSweep 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

Enforce the rules yourself.

A full node validates every block and transaction against MoonBite's consensus rules and helps other peers stay in sync. Don't trust: verify.

  1. Get the node

    Read the node and downloads guide, then install the build for your platform.

  2. Create an address

    Ask your node's wallet for a fresh receiving address.

    Terminal
    moonbite-cli getnewaddress
  3. Check chain state over REST

    Query your own node instead of moonbite.org. The response has the same shape as in the quick start.

    Terminal
    curl -s http://127.0.0.1:5000/api/blockchain/info

Built to be read

Open source. Open data.

Litecoin lineage

Battle-tested core, familiar tooling and address formats (moon1… / M…).

No auth to read

Public read-only endpoints. Nothing here can spend coins or reveal a key.

Cross-origin reads

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.

{% endblock %}