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 withxdr processing error: xdr value invalid. Install withcargo install stellar-cli --locked, then runstellar config migrateonce if upgrading from an older CLI.@stellar/stellar-sdk≥ 14.4.x. 13.x fails parsing testnet tx info withTypeError: Bad union switch: 4.soroban-sdk = "26.0.0"in your consumer'sCargo.toml.- Rust target
wasm32v1-none(notwasm32-unknown-unknown).rustup target add wasm32v1-none. Build withcargo build --target wasm32v1-none --release. - Node ≥ 18.
Supported feeds (testnet)
| Asset | On-chain tag (hex) | Asset | On-chain tag (hex) |
|---|---|---|---|
BTC/USD | 0x4254435553440000 | BNB/USD | 0x424E425553440000 |
ETH/USD | 0x4554485553440000 | TRX/USD | 0x5452585553440000 |
XLM/USD | 0x584C4D5553440000 | HYPE/USD | 0x4859504555534400 |
USDC/USD | 0x5553444355534400 | DOGE/USD | 0x444F474555534400 |
SOL/USD | 0x534F4C5553440000 | ZEC/USD | 0x5A45435553440000 |
XRP/USD | 0x5852505553440000 | LINK/USD | 0x4C494E4B55534400 |
ADA/USD | 0x4144415553440000 | BCH/USD | 0x4243485553440000 |
LTC/USD | 0x4C54435553440000 |
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
- 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 viafreshnessLimitSeconds),fetchLatestthrowsStalePriceErrorbefore your tx is built. fresh.toUpdateOp(ORACLE)built a Soroban operation that callsupdate_batch_ed25519_argson the Noeracle contract.- The Noeracle contract verifies the publisher Ed25519 signature, confirms
pubkeyis a registered publisher, enforces a 60-second on-chain staleness backstop and a monotonic round, and writes the verified price to temporary storage. - 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.