Docs

Validate a mempool payload

Public API

Use this endpoint before submitting an encoded payload to the mempool.


POST
/v0/midnight/mempool/validate

It checks whether the router would accept the payload for indexing; it does not prove a later on-chain transaction will succeed. data.issues is empty when the payload passes. When issues are returned, each rule appears once for the whole payload, not once per offer. details is normally null; min_offer_assets_usd retains the first failing offer's loan_token and min_assets, and adds the configured usd_threshold.

Issue names you may see:

Payload format

  • payload_version: payload uses an unsupported version.
  • payload_frame: payload is not valid hex or is missing required framing bytes.
  • payload_gzip_length: declared compressed length does not match the payload bytes.
  • payload_suffix_too_large: trailing attribution or suffix bytes exceed the allowed size.
  • payload_decompression: compressed bytes cannot be decompressed or exceed size limits.
  • payload_abi_decode: decompressed bytes are not a valid offer list.
  • empty_payload: payload contains no offers.
  • max_offers_per_tree: payload contains more offers than the chain allows.
  • duplicate_offer_hash: the same offer appears more than once.

Chain and market support

  • unsupported_chain: chain_id is not supported.
  • market_chain_mismatch: an offer embeds a chain id or Midnight deployment address that does not match the requested chain.
  • maturity: market maturity is outside the allowed maturity windows.
  • loan_token: loan token is not supported on this chain or has no configured minimum.
  • collateral_token: a collateral token is the zero address; any other token is accepted.
  • oracle: a collateral oracle is the zero address.
  • loan_collateral: the loan token is used as collateral on a chain that does not admit it, without the chain's fixed-price oracle, without the required LLTV, or without another collateral alongside it.
  • rcf_threshold: market RCF threshold does not match its loan token and highest non-loan collateral LLTV, or the market has no non-loan collateral.
  • collateral_lltv: collateral loan-to-value tier is not enabled.
  • max_lif: liquidation incentive setting is not enabled.
  • max_collaterals: an offer uses too many collateral entries.

Offer terms

  • amount_missing: neither max_units nor max_assets is set.
  • amount_conflict: both max_units and max_assets are set; choose one.
  • min_offer_assets_usd: offer size is below the configured loan-token minimum; details provides the raw-asset floor.
  • min_tick: price tick is below the allowed range.
  • max_tick: price tick is above the allowed range.
  • tick_spacing: price tick is not on the allowed tick grid.
  • min_duration: offer start/expiry window is too short.
  • ratifier: ratifier contract is not accepted for the chain.

Batch consistency

  • mixed_maker: offers in one payload use different makers.
  • mixed_ratifier: offers in one payload use different ratifiers.
  • group_identity: group id does not match the offers in that group.
  • group_consistency: offers sharing a group have conflicting terms or overlapping active windows.

Callbacks

  • non_empty_callback: callbacks with custom address or data are not accepted.
  • blue_callback: a non-empty callback is only accepted on a buy offer whose callback data is the exact ABI-encoded Blue MarketParams with the same loan token as the offer. Validation does not check that the callback is registered: register it to the maker through the chain's factory published by /v0/midnight/mempool/rules at or before the offer's creation block, or the offer is rejected after indexing.
  • vault_v2_callback: Applies only when ratifier == maker == callback.address (the Midnight adapter), alongside the chain's other callback rule. Sells must use the adapter as receiver_if_maker_is_seller with empty callback data. Buys must use abi.encode(address(0), "") for idle assets or abi.encode(fundingAdapter, abi.encode(MarketParams)); the funding adapter cannot be zero or the adapter itself, and MarketParams.loanToken must equal the offer's loan token. Ratifier data must be abi.encode(subRatifier, data) with subRatifier in the published sub_ratifiers. Vault, asset, and funding-adapter registration is checked after indexing.
  • buy_empty_callback: buy offers with empty callbacks are not accepted.
  • sell_empty_callback: sell offers with empty callbacks are not accepted.

Query Parameters

timestamp?string

Optional ISO-8601 UTC timestamp. Uses the policy snapshot active at the latest 15:00 UTC boundary at or before this timestamp; omitted uses the current time.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v0/midnight/mempool/validate" \  -H "Content-Type: application/json" \  -d '{    "chain_id": 1,    "payload": "0x01000000..."  }'
{  "data": {    "issues": [      {        "rule": "min_offer_assets_usd",        "details": {          "loan_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",          "min_assets": "100014791",          "usd_threshold": "100"        }      },      {        "rule": "tick_spacing",        "details": null      }    ]  }}
{  "error": {    "code": "VALIDATION_ERROR",    "message": "Limit must be greater than 0.",    "details": [      {        "field": "limit",        "issue": "Limit must be greater than 0."      }    ],    "request_id": "req-123"  }}
{  "error": {    "code": "VALIDATION_ERROR",    "message": "Limit must be greater than 0.",    "details": [      {        "field": "limit",        "issue": "Limit must be greater than 0."      }    ],    "request_id": "req-123"  }}
{  "error": {    "code": "VALIDATION_ERROR",    "message": "Limit must be greater than 0.",    "details": [      {        "field": "limit",        "issue": "Limit must be greater than 0."      }    ],    "request_id": "req-123"  }}