TL;DR
An oracle is a service that feeds external data (prices, events, random numbers) to on-chain smart contracts, enabling DeFi protocols to know real-world asset prices.
Smart contracts can only access data that’s on their blockchain. They can’t query a website or API. For a lending protocol to know if your SOL collateral is still worth enough, it needs the current SOL/USD price. Oracles bridge this gap by reading off-chain data (from exchanges, APIs) and publishing it on-chain in a format smart contracts can consume.
Pyth Network is Solana’s primary oracle, providing sub-second price updates from first-party data sources (exchanges and trading firms publish directly). Switchboard is another option offering customizable data feeds. Chainlink also operates on Solana. Pyth is used by most major Solana DeFi protocols for price feeds, liquidation triggers, and risk management.
If an oracle reports a wrong price, it can trigger false liquidations, enable arbitrage exploits, or cause protocols to make bad decisions. Oracle manipulation attacks have caused hundreds of millions in DeFi losses across chains. Protocols mitigate this using multiple oracle sources, price deviation checks, and time-weighted averages. When evaluating a DeFi protocol’s safety, check which oracle it uses and whether it has fallback mechanisms.