Skip to content

Repository files navigation

Emberline on Flare

Emberline is a collateralized prediction-market platform for Flare Coston2. It supports continuous public LMSR markets, confidential fixed-cap pools, native Flare resolution, encrypted private recovery, and permissionless failure refunds.

Architecture

  • contracts/: Solidity market engine, test collateral, deployment scripts, unit tests, fuzz tests, and invariants
  • verifiers/: generated UltraHonk Solidity verifiers and proof compatibility tests
  • circuits/: Noir placement and private redemption circuits
  • client/: shared ABIs, LMSR math, commitments, EVM hashes, formatting, and committee logic
  • services/: event indexer, encrypted committee members, batch coordinator, and private redemption relay
  • web/: Next.js application ported from the original Emberline interface

The full design is in docs/specs/2026-08-14-flare-platform.md, the oracle source decision is in docs/oracle-sources.md, and the implementation checklist is in docs/plans/2026-08-14-flare-platform-plan.md.

Requirements

  • Node.js 22 or newer
  • Foundry with Solidity 0.8.28 support
  • Nargo 1.0.0-beta.22
  • Barretenberg 5.0.0-rc.2

Install and verify

npm install
./scripts/install-contract-deps.sh
npm run circuits:build
npm test
npm run verifiers:test
npm run typecheck
npm run build

Configure

Copy the example environment files and fill in deployed Coston2 addresses and private service credentials:

cp .env.example .env
cp services/.env.example services/.env
cp web/.env.example web/.env.local

Never put funded keys or committee secrets in variables prefixed with NEXT_PUBLIC_.

Deploy to Coston2

The scripts reject any chain other than chain ID 114. The deployer needs C2FLR for gas.

set -a
source .env
set +a

forge script --root verifiers verifiers/script/Deploy.s.sol:DeployPlaceOrder --rpc-url coston2 --broadcast \
  --sender "$DEPLOYER_ADDRESS" --keystore .secrets/keystores/coston2-deployer \
  --password-file .secrets/passwords/coston2-deployer
forge script --root verifiers verifiers/script/Deploy.s.sol:DeployRedeem --rpc-url coston2 --broadcast \
  --sender "$DEPLOYER_ADDRESS" --keystore .secrets/keystores/coston2-deployer \
  --password-file .secrets/passwords/coston2-deployer

# Add both verifier addresses and the three committee addresses to .env first.
forge script --root contracts contracts/script/Deploy.s.sol:Deploy --rpc-url coston2 --broadcast \
  --sender "$DEPLOYER_ADDRESS" --keystore .secrets/keystores/coston2-deployer \
  --password-file .secrets/passwords/coston2-deployer

If COLLATERAL_ADDRESS is empty, the core deployment creates TestUSDC and mints test collateral to the deployer. Put the final addresses and deployment block in the web and services environments.

Run the platform

Start one committee service for each member with distinct ports, tokens, encryption keys, state keys, signing keys, and member indexes. Each signing key must match that member's constructor address. The coordinator holds only its gas-funded relayer key and never receives committee signing keys. Then start the coordinator-facing indexer and the gas-funded redemption relay.

npm run committee:key --workspace services -- 1 ./state/keys/committee-1.json
npm run committee --workspace services
npm run indexer --workspace services
npm run relay --workspace services
npm run dev

The committee batch command accepts a numeric private market ID after its lock time:

npm run committee:batch --workspace services -- 42

The web application proxies committee and relay credentials on the server. Browser code never receives those bearer tokens.

Releases

Packages

Contributors

Languages