Skip to main content
A market order executes at the current market price. Unlike a limit order, you accept any available price by setting an infinite slippage price in the datum. Market orders use a single execution fee of 0.6 ADA.
Orders are placed on-chain and require a transaction. The execution engine processes them asynchronously — execution timing depends on batcher availability and market conditions.

How market orders differ from limit orders

Market orderLimit order
PriceAny ([1, denominator])Specified ratio
Execution fee0.6 ADA (1 × 0.6 ADA)1.8 ADA (3 × 0.6 ADA)
Beacon prefix0x010x00
Fills whenNext available batcher runMarket price reaches your price

Price field

Set the price field in the datum to accept any price:
price: [1, denominator]
The numerator = 1 signals infinite slippage — the order fills regardless of the current market price.
Buying a token with ADA at any price:
price: [1, inputAmount] // e.g. [1, 50_000_000] for a 50 ADA input

Execution fee

Market orders require 1 execution step, so the total fee is:
feePerExStep × 1 = 600_000 lovelace = 0.6 ADA

Transaction structure

Inputs

Any user UTxOs to cover:
  • Input asset amount (what you are selling)
  • Transaction fees
  • Order collateral (minimum 2 ADA)
  • Deposit ADA for outputs

Order output

Send to the script address constructed from the script hash and optionally your stake credentials. Output value:
AssetAmount
Input assetinputAmount
ADA (execution fee)0.6 ADA
ADA (deposit)depositAdaForOrder + depositAdaForReceive
ADA (collateral)Additional if total < 2 ADA
Example — Buy 50 ADA for tokens (market):
ComponentAmount
Input asset50 ADA
Execution fee0.6 ADA
UTxO deposit~1.5 ADA
Receiving deposit~1.5 ADA
Additional collateral0 ADA (total already > 2)
Total~53.6 ADA

Datum

Build the datum the same way as a limit order, with two differences:
  1. Set price to [1, denominator]
  2. The beacon prefix byte is 0x01 (market)
See datum building for field reference, address serialization, and the full beacon algorithm.

Transaction building flow

1

Select input UTxOs

Cover all costs: input amount + 0.6 ADA fee + deposits.
2

Extract user credentials

Payment and stake key hashes from your address.
3

Calculate order index

Position of the order output in the transaction.
4

Build datum

Set price: [1, inputAmount] and all other fields except beacon. See datum building.
5

Calculate beacon

Use the first input UTxO reference and order index with orderType = 'market'. Beacon prefix byte is 0x01. See beacon calculation.
6

Serialize and assemble

Serialize datum with the calculated beacon to CBOR. Calculate deposits, add collateral if needed, create the order output, and add a change output.

Important notes

The beacon calculation uses the first transaction input. Add the UTxO to transaction inputs before calculating the beacon.
  1. Order index must match the actual index of the order output in the transaction outputs array.
  2. Minimum collateral — total deposits must be at least 2 ADA.
  3. Stake credentials are optional but recommended.
  4. Asset format — ADA is ["", ""], tokens are [policyId, tokenName] in hex.
  5. Cancellation — market orders can be cancelled before execution. See order cancel.