On-chain options and perpetuals protocol that originated as Lyra on Optimism, then migrated to its own OP-Stack appchain (Derive Chain) and rebranded to Derive in 2024. LYRA holders migrated 1:1 to DRV in early 2025; the v1/v2 contract suite still ships under derivexyz on GitHub.
- 01European-style call/put options on ETH/BTC
- 02perps on the same cross-margin account as options
- 03MMV-style market-maker vaults
- 04off-exchange custody + on-chain settlement
- 05structured product issuers
- pnpm add ethers viem
- pip install derive-client
| Variable | Scope | Description |
|---|---|---|
| DERIVE_API_URL | Client | REST base — `https://api.lyra.finance` (mainnet) or `https://api-demo.lyra.finance` (testnet). |
| DERIVE_WS_URL | Client | WebSocket — `wss://api.lyra.finance/ws` (mainnet) / `wss://api-demo.lyra.finance/ws` (testnet). |
| DERIVE_SESSION_KEY | Server | Session-key private key registered to the wallet via `RegisterSessionKey`. Sign orders with this, never the main wallet key. |
| DERIVE_OWNER_ADDRESS | Server | Address of the Derive smart-contract wallet (subaccount) that owns the position. |
Use the Derive (Lyra v2) REST + WS API. Register a session key to your subaccount via `Matching.registerSessionKey(owner, sessionKey, expiry)`, then sign each order EIP-712 (`SignedTradeOrder`) with that key and POST to `/private/order`. Orders specify `instrument_name` like `ETH-20260626-3000-C` (asset-expiry-strike-type), `direction` (buy/sell), `limit_price`, `amount`. Subscribe to `wss://api.lyra.finance/ws` channels `orderbook.{instrument}` for book and `subaccount.{id}` for private fills. On-chain you can also call `Matching.deposit/withdraw` to move USDC between Ethereum L1 and Derive Chain via the canonical bridge.
- ⚑Quoting and margining use a Black-Scholes mark with an internally-fitted volatility surface — far-OTM strikes can move sharply when the surface is re-parametrised, especially around expiries. Always query the live mark from `/public/get_ticker` rather than computing client-side.
- ⚑Options expire to USDC at the Chainlink oracle TWAP at the listed UTC expiry; positions cannot be modified after settlement. Build expiry handling into your UI or you will surface stale positions.
- ⚑LYRA -> DRV migration occurred in May 2024 with token launch in Jan 2025; integrations referencing the old `LyraRegistry` v1 markets on Optimism are deprecated — point new code at Derive Chain (`chainId 957`).
- ⚑Session keys have an `expiry` and a per-key whitelist; once expired the matching engine rejects orders with `INVALID_SIGNATURE`. Rotate proactively.
- ⚑Withdrawals from Derive Chain to Ethereum use the OP-Stack 7-day challenge window unless routed through Socket fast-bridge.
- ⚑Deribit-style portfolio margin means a hedged short can require less collateral than its naked premium — never size from notional alone.