LightbeamDocs

Start

How Lightbeam works

The order book, the router and the Kumbaya pool, and how they fit together.

The order book

Each market is a pair of tokens, such as LEAF against a dollar token, or a meme coin against ETH. Its order book holds every resting buy and sell order on chain. A new order that meets the other side fills at once; the rest of it waits on the book until someone trades against it or you cancel it.

  • Price priority, then time. The best price fills first. Orders at the same price fill in the order they arrived.
  • Four significant digits. Prices sit on a grid of four significant digits, such as 1.234 or 0.0005678. The order form shows the exact price your order goes in at.
  • Makers and takers. An order that rests on the book is a maker and pays the 0.2% maker fee when it fills. An order that fills against the book straight away is a taker and pays 0.5%.
  • One market per pair. Every market is quoted in ETH or a dollar token, and ETH's own market is quoted in dollars, so no pair of tokens has two markets.

MegaETH confirms transactions in milliseconds, which is what lets a full order book work on chain.

The router

Every trade you make on the website goes through Lightbeam's router contract. In one transaction it does three things:

1. Your tradePlaces your order on the book, or routes your swap between the book and Kumbaya.
2. ArbitrageIf the book's price has drifted from Kumbaya's, it trades the gap back. Any profit goes to you.
3. StopsFires any stop orders your trade's price crossed. The gas they pay goes to you.

If the arbitrage or the stops fail, your trade still goes through. See Arbitrage and Stop orders for the details.

Kumbaya

Kumbaya is MegaETH's largest automated market maker. Most tokens on Lightbeam also have a Kumbaya pool, and the two venues back each other up: swaps take the cheaper one, and arbitrage keeps the book's price close to the pool's. A thin book on Lightbeam still gives fair prices because the pool's liquidity stands behind it.

Where the data comes from

Price charts (5-minute, hourly and daily candles), 24-hour stats, the trade feed and your own history are all written by the contracts as trades happen. The website reads them from MegaETH. Nothing is computed on a server, so anyone can check any figure on chain.

Your funds

You keep your tokens in your own wallet. When you place an order, the contract holds only what that order needs, and you can cancel to get it back at any time, unless you chose to lock a liquidity position. Read Contracts and security for what the contract owner can and cannot do.