Halcyon docs

Halcyon is an options protocol for Solana and EVM chains. Writers lock collateral and sell options; market makers compete to buy them. Prices are agreed off-chain over a fast quote channel, and the trade is minted and settled on-chain in one transaction.

The SDK is in early development. Expect breaking changes between minor versions.

Packages

PackageWhat it does
@halcyon/sdkShared types, quote channel client, REST client
@halcyon/solanaSolana program client
@halcyon/evmEVM contract client
@halcyon/cliThe halcyon command-line tool
@halcyon/signersCloud KMS signers for server-side keys

Getting started

Install the SDK and the client for your chain:

npm install @halcyon/sdk @halcyon/solana

Create a client. An API key is required, even for read-only calls.

import { Halcyon } from "@halcyon/sdk";
import { solana } from "@halcyon/solana";

const hx = await Halcyon.create({
  apiKey: process.env.HALCYON_KEY,
  chain: solana({ rpc: "https://api.mainnet-beta.solana.com" }),
  wallet,
});

// list supported assets
const assets = await hx.assets.list();

Core concepts

  • Collateral offer — posted by the writer. Says what is locked and on which terms.
  • Bid — posted by a market maker in reply. Names a premium the maker will pay.
  • Position — the on-chain option created when an offer and a bid are matched.
  • Deterministic IDs — offers and positions get a 32-byte ID hashed from their contents, so both sides can refer to the same thing before it exists on-chain.
  • Two keys — a chain key signs transactions; a session key signs quote messages so your main wallet stays cold.

Settlement modes

ModeAt expiryGood for
PhysicalThe underlying asset changes hands at the strikeCovered calls on assets you're happy to sell
CashOnly the in-the-money value is paid in stablecoinKeeping your position while earning premium
DeferredMaker settles from a credit line within a grace windowInstitutional makers with prime accounts

Escrow

All protocol payments move through an on-chain escrow account tied to your wallet. Deposit before you trade; withdraw anything that isn't locked in an open position at any time.

await hx.escrow.deposit({ asset: "USDC", amount: "5000" });
await hx.escrow.authorize(sessionKey.publicKey);

Quote lifecycle

  1. Writer posts a collateral offer on the quote channel.
  2. Makers reply with signed bids within the quote window (default 10s).
  3. Writer accepts the best bid; the SDK builds the match transaction.
  4. The position is minted and premium is paid to the writer in the same transaction.
  5. At expiry, anyone can call settle() to close the position.
const offer = await hx.rfq.offer({
  side: "call", asset: "SOL", strike: 240, expiry: "14d", size: 25,
});
const best = await offer.bestBid({ timeoutMs: 10_000 });
const position = await best.accept();

Build a quoter

Market makers listen for offers and answer with bids. A minimal quoter:

hx.rfq.onOffer(async (offer) => {
  const price = myPricingModel(offer);   // your own model
  if (price) await offer.bid({ premium: price });
});

The quote channel connects lazily on the first listener and reconnects on its own.

CLI

npm install -g @halcyon/cli

halcyon escrow deposit USDC 5000
halcyon offer call SOL --strike 240 --expiry 14d --size 25
halcyon positions list
halcyon quote --bs --vol 0.65      # built-in Black-Scholes quoter
halcyon escrow withdraw USDC 1000

SDK reference

NamespaceMain methods
hx.assetslist(), get(symbol)
hx.escrowdeposit(), withdraw(), balance(), authorize()
hx.rfqoffer(), onOffer(), close()
hx.positionslist(), get(id), settle(id)
hx.eventssubscribe(filter) for indexed protocol events