Run your own oracle price feed
What is a blockchain oracle?
A blockchain oracle is a service that brings offchain data, such as an asset price, onto a blockchain so smart contracts can use it; protocols also call it a price oracle or price feed.
Chains, DeFi protocols and oracle networks run their own when trades and liquidations on their contracts need a current price on each chain they’re deployed to.
Goldsky Compose runs the oracle as a task that reads your sources on a schedule and writes the value to each chain separately, logging every call; the sources, the pricing logic and the contracts stay yours.
Who uses a blockchain oracle?
Chains, DeFi protocols and oracle networks that publish their own prices to contracts on several chains.
How an oracle price gets from your sources to each chain
The diagram follows one price update, from your offchain sources to the contracts that read it, and shows who does each step. Your setup may differ.
Pick the sources the price comes from
An oracle is only as good as the sources behind it, so they’re the first decision.
Choose sources your protocol’s users would accept and decide how to combine them, such as taking the median. With a single source, one bad print reaches every contract that reads the price.
Deploy the oracle contract on each chain
Each chain needs its own contract that stores the price for other contracts to read.
The contract should accept updates only from your publisher’s address and expose the price through the interface your consumers already read. A contract anyone can update is a price anyone can set.
Fetch the latest price
Handled by Goldsky ComposeThe value onchain has to be refreshed from the sources on a set cadence.
Each run reads every source, discards responses that fail your checks and computes the value. If too few sources respond, the run should fail where you can see it, not publish a value your rules wouldn’t accept.
Goldsky Compose starts the task from a cron trigger and reads each source with
Call external APIs from a task (opens in a new tab)ctx.fetch, which retries failed reads and records each request and response on the run.Push the value to each chain
Handled by Goldsky ComposeContracts on every chain you’re deployed to need the same price at about the same time.
Each chain’s write has to succeed or fail on its own, so congestion on one chain doesn’t hold back the rest. A chain that missed an update gets the next one, and its consumers see the older price until then.
One task can send a
Send transactions from a task (opens in a new tab)writeContractto each chain at once from the same publisher wallet and collect the results withPromise.allSettled, so one chain’s failure doesn’t block the others.Stop publishing when the data is wrong
Handled by Goldsky ComposeA bad price can set off liquidations, so operators need a way to stop updates without shipping new code.
Agree who can halt the feed, how they do it and what consumers see meanwhile. An oracle with no stop switch keeps publishing a bad value until someone deploys a fix.
The NAV oracle guide shows one pattern: the source returns a
Add a publishing kill switch (opens in a new tab)ripcordflag, and while it’s set the task skips the write and returns normally, so no retries fire.Let contracts read the price
Lending markets, exchanges and other contracts read the stored price when they settle a trade or check a loan.
Consumers should check when the price was last updated and refuse values older than they accept. Without that check, a stalled feed lets trades settle on an old price.
Keep a record of every published value
Handled by Goldsky ComposeAnyone relying on the price may want to check where a given value came from.
Each published value should trace back to the source responses and the calculation behind it. If it doesn’t, a disputed liquidation turns into an argument about what the sources said at the time.
With Goldsky, every
How fetch calls are recorded (opens in a new tab)ctx.fetchcall, its URL and its response are captured in the task run’s event log, next to the transaction that published the value.
What you control
- Your team
- Pick the sources the price comes from
- Deploy the oracle contract on each chain
Security and deployment
- SOC 2 Type IIIndependently audited security controls.
- Dedicated infrastructureSingle-tenant options for production workloads.
- Data residencyCloud, on-premises or co-located.
More use cases that run protocol automation
- Smart contract automation and keepersRun recurring or event-driven contract calls a protocol needs to keep working.
- Onchain circuit breakersPause a token, market or payout when a rule is breached.
- Cross-chain automationAct on one chain when an event happens on another.
- Onchain interest rate, funding rate and volatility feedsPublish interest rates, funding rates and volatility benchmarks to contracts.
- VRF and verifiable randomness for smart contractsDeliver signed random values to contracts for prize draws, lottery allocations and random selection, checkable by anyone.
Use cases built the same way
- Continuous proof of reservesCompare onchain supply with reported reserves on a schedule, then publish the ratio or alert on a gap.
- Publish tokenized fund NAVs and marks onchainPublish a tokenized fund’s NAV to every chain the fund is on, on a schedule.
- Tokenized private credit marksPublish valuations of private credit vaults and loans onchain.
- Index values published onchainPublish benchmark index values onchain for funds and products that track them.
Run a blockchain oracle with Goldsky
We’ll map it to your systems and show you what Goldsky runs, so your team builds the product, not the pipelines underneath it.