Docs
Technical documentation, guidelines, and protocol specifications for Medialane.
Protocol Specification
The Medialane protocol consists of two onchain contracts on Starknet mainnet and an off-chain indexer/API layer. This document describes the contracts, their interfaces, and the event model used by the indexer.
Contracts (Starknet Mainnet)
Marketplace Contract
0x059deafbbafbf7051c315cf75a94b03c5547892bc0c6dfa36d7ac7290d4cc33a
Handles order creation, fulfillment, cancellation, and royalty distribution for all listings and offers.
Collection Registry Contract
0x05e73b7be06d82beeb390a0e0d655f2c9e7cf519658e04f05d9c690ccc41da03
Factory for deploying IP NFT collections. Assigns a unique onchain collection ID to every deployed collection.
POP Protocol Factory
see NEXT_PUBLIC env — deployed per environment
Factory contract for creating POP (Proof of Participation) events. Each event deploys a soulbound NFT contract. Manages provider registration and event lifecycle.
Collection Drop Factory
see NEXT_PUBLIC env — deployed per environment
Factory for launching timed NFT drop events. Enforces supply caps, mint windows, allowlists, per-wallet limits, and mint prices onchain.
NFT Standard
Medialane collections implement SNIP-2, the Starknet equivalent of ERC-721. Each token has a unique token_id (u256) and a token_uri returning a ByteArray pointing to IPFS metadata.
The metadata JSON conforms to the OpenSea/ERC-721 metadata standard with Medialane-specific extensions for licensing attributes (see below).
Metadata Schema
{
"name": "My IP Asset",
"description": "A description of the work.",
"image": "ipfs://bafybei...",
"attributes": [
{ "trait_type": "IP Type", "value": "Visual Art" },
{ "trait_type": "License", "value": "CC BY-NC-SA 4.0" },
{ "trait_type": "Commercial Use", "value": "Not Allowed" },
{ "trait_type": "Derivatives", "value": "Allowed with Attribution" },
{ "trait_type": "AI Training", "value": "Not Allowed" },
{ "trait_type": "Geographic Scope", "value": "Worldwide" },
{ "trait_type": "Royalty %", "value": "10" }
]
}SNIP-12 Typed Data (Order Signing)
All marketplace intents (listings, offers, fulfillments, cancellations) use SNIP-12 typed data for off-chain signing. The domain separator is:
{
"name": "Medialane",
"version": "1",
"revision": "1",
"chainId": "SN_MAIN"
}The indexer validates submitted signatures onchain before recording orders. Fulfilled and cancelled orders are reconciled from onchain events emitted by the marketplace contract.
Marketplace Events
The marketplace contract emits the following events, indexed by the Medialane mirror:
OrderCreatedEmitted when a listing or offer intent is submitted. Contains order_hash only — full params fetched via get_order_details().
OrderFulfilledEmitted when a buyer executes a listing or a creator accepts an offer.
OrderCancelledEmitted when an order is cancelled by the maker.
Collection Registry Events
CollectionCreatedEmitted when a new collection is deployed through the factory. Data contains collection_id (u256 low/high), owner address, and name/symbol/base_uri ByteArrays. The actual ERC-721 contract address (ip_nft) is resolved by calling get_collection(collection_id)on the registry.
Indexer Architecture
The Medialane off-chain layer consists of three components running as a single Bun process:
- Mirror — polls the Starknet RPC for new blocks, processes events, and writes to PostgreSQL
- Orchestrator — an in-memory worker that processes metadata fetch jobs (IPFS resolution, stats updates)
- API — a Hono REST server exposing all platform data to frontends and third-party integrations
The indexer polls every ~6 seconds. Block lag is typically 1–3 blocks. New collections and order events appear in the API within one indexer tick of the transaction being confirmed.