What is a DeFi oracle and what does it do?
A DeFi oracle feeds outside data into smart contracts so apps can use prices and events. It gathers and writes that data on-chain for lending apps.

On this page
A smart contract is a blockchain program that acts on data it receives. Many DeFi apps use them for loans and trades.
Why do smart contracts need oracles?
Blockchains cannot access off-chain data on their own. Nodes repeat the same code and must agree, so a contract cannot call a website. An oracle puts outside data into a transaction all nodes can see.
How does a DeFi oracle work?
An oracle network connects a blockchain to outside systems. Node operators pull data from sources such as exchange feeds. The network combines the reports and publishes one result on-chain.
- Collect sources: Node operators pull prices and events from outside sources.
- Aggregate reports: The network combines values to reduce one bad source.
- Publish on-chain: The oracle writes the final data into a transaction.
What are DeFi oracles used for?
DeFi apps use oracles when a contract needs an outside fact. Lending markets check price feeds before loans and liquidations. Stablecoins and derivatives also use them for pegs and settlement.
What risks do DeFi oracles create?
An oracle can fail if its sources are wrong, slow, or manipulated. A bad price can make lending contracts liquidate healthy positions or allow bad loans. It can also drain funds or break a stablecoin's peg.
How is an oracle different from an API?
An API returns data to a program running off-chain, and that response does not become part of a blockchain's state. A DeFi oracle takes data from APIs and other sources and writes it on-chain for smart contracts to read.
An API uses a key and a provider's servers. An oracle adds consensus and payment so nodes can agree on the value.
Frequently asked questions
Not always. Some run on one company's servers; others use many independent nodes.
Yes. Attackers can compromise sources or manipulate a weak price feed.
No. They also supply rates, event outcomes, reserve proofs, and cross-chain messages. A price feed is a stream of asset prices that an oracle updates for smart contracts.





