Skip to main content

Quickstart

Integrate Noeracle into a Soroban consumer transaction in under 10 lines of TypeScript.

Requirements

v0 runs against Stellar testnet protocol 23. Older tools fail with cryptic errors — pin these versions before you start:

  • stellar-cli ≥ 26.x. Homebrew's 22.x fails uploads with xdr processing error: xdr value invalid. Install with cargo install stellar-cli --locked, then run stellar config migrate once if upgrading from an older CLI.
  • @stellar/stellar-sdk ≥ 14.4.x. 13.x fails parsing testnet tx info with TypeError: Bad union switch: 4.
  • soroban-sdk = "26.0.0" in your consumer's Cargo.toml.
  • Rust target wasm32v1-none (not wasm32-unknown-unknown). rustup target add wasm32v1-none. Build with cargo build --target wasm32v1-none --release.
  • Node ≥ 18.

Supported feeds (testnet)

AssetOn-chain tag (hex)AssetOn-chain tag (hex)
BTC/USD0x4254435553440000BNB/USD0x424E425553440000
ETH/USD0x4554485553440000TRX/USD0x5452585553440000
XLM/USD0x584C4D5553440000HYPE/USD0x4859504555534400
USDC/USD0x5553444355534400DOGE/USD0x444F474555534400
SOL/USD0x534F4C5553440000ZEC/USD0x5A45435553440000
XRP/USD0x5852505553440000LINK/USD0x4C494E4B55534400
ADA/USD0x4144415553440000BCH/USD0x4243485553440000
LTC/USD0x4C54435553440000

Each feed aggregates 4–5 exchange sources; every attestation carries its own sources count. Live list: curl https://api.noeracle.org/v1/latest | jq '.assets | keys'. FX, NAV, and TWAP feeds arrive in v2 — see the roadmap.

Install

npm install @noeracle/sdk @stellar/stellar-sdk

Fetch a fresh price, bundle it into your transaction

import { Noeracle } from "@noeracle/sdk";
import { TransactionBuilder, Networks } from "@stellar/stellar-sdk";

const ORACLE = "CAYIP67UDVX5UPXGN3XDAWVIEFBAVG6G7LUESEOU3NUQKTWN55W34YBG";

const oracle = new Noeracle({ network: "testnet" });
const fresh = await oracle.fetchLatest(["BTC/USD"]);

const tx = new TransactionBuilder(account, { fee, networkPassphrase: Networks.TESTNET })
.addOperation(fresh.toUpdateOp(ORACLE))
.addOperation(myContract.call("open_position" /* , ... */))
.setTimeout(30)
.build();

await server.sendTransaction(tx);

Try it live

The component below calls oracle.fetchLatest(["BTC/USD"]) against the live attestation service at api.noeracle.org — exactly the call your code will make.

BTC/USD

What just happened

  1. The SDK fetched a price attestation signed within the last ~500 ms from api.noeracle.org. If the snapshot is older than 2 seconds (configurable via freshnessLimitSeconds), fetchLatest throws StalePriceError before your tx is built.
  2. fresh.toUpdateOp(ORACLE) built a Soroban operation that calls update_batch_ed25519_args on the Noeracle contract.
  3. The Noeracle contract verifies the publisher Ed25519 signature, confirms pubkey is a registered publisher, enforces a 60-second on-chain staleness backstop and a monotonic round, and writes the verified price to temporary storage.
  4. Your application operation runs in the same transaction. Read the just-verified price by calling the contract's get_price.

Next

  • Integration patterns — the in-contract verification pattern, the best-effort cache pattern, and the SSE subscribe pattern.
  • SDK reference — the full TypeScript API.
  • Examples — runnable end-to-end code.