Skip to Content
⚠️ Alert: Sylan is under active development—only trust contract/wallet addresses announced on our official channels; we will never DM you, ask for funds, or run surprise airdrops/presales.
ProviderQuickstart

Publish an API

This page covers end‑to‑end setup using the monorepo (SDK + Express + CLI). You can adapt to any framework as long as you produce the same JSON.

1) Install

# From the sylan-provider repo root pnpm i pnpm -w build # Create a local config npx sylan-provider init # → creates sylan.config.json (edit it)

sylan.config.json fields:

{ "chainId": 80002, "rpcUrl": "https://rpc-amoy.polygon.technology", "consensusAddress": "0x81B78B79775C04F5c30DfBC17d9710EA5C3CB166", "registryAddress": "0xda70c416Ef9fbc86719AfD9aEDb0EE43263aCd97", "apiId": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "providerSignerKey": "0xPROVIDER_SIGNER_PRIVATE_KEY", "ttlMs": 0, "seqStrategy": "monotonic" }
  • apiId: bytes32 identifier of your listed API in AccessRegistry
  • providerSignerKey: the EOA private key corresponding to the provider signer on-chain
  • ttlMs: 0 = no TTL; otherwise a positive millisecond window for freshness
  • seqStrategy: monotonic (always increment) or hash-change (increment only when payload changes)

2) Wrap your endpoint (Express)

import { createServer } from '@sylan/provider-express' const { app, listen } = createServer({ apiId: '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef', consensus: '0x81B78B79775C04F5c30DfBC17d9710EA5C3CB166', chainId: 80002, signKey: '0xPROVIDER_SIGNER_PRIVATE_KEY', ttlMs: 60000, }) app.get('/weather', async (_req, res, next) => { // your payload — any JSON-serializable object const data = { city: 'Doha', tempC: 39, date: new Date().toISOString() } res.locals.data = data next() // hand off to Sylan middleware → hashes, signs, replies }) listen(3000)

Response shape (produced by the middleware)

{ "data": { /* your payload */ }, "snapshot": { "apiId": "0x…", "seqNo": "123", "providerTs": "1724700000000", "ttl": "60000", "contentHash": "0x…" }, "providerSig": "0x…", "pointerURI": null }

The middleware persists sequence numbers per apiId in ~/.sylan/seq.json (override via storageDir).

3) Serve with the CLI (optional)

# Reads sylan.config.json and runs the built‑in server on :3005 npx sylan-provider serve

4) Verify your on‑chain listing

Before going public, confirm your API is Active in AccessRegistry:

npx sylan-provider health # → prints { chainId, registry, apiId, active: true/false }

If inactive, finish your listing & activation in the dashboard, then retry.

Last updated on