🛠️
Stacks Documentation
  • Start Here
  • đź§ Concepts
    • Stacks 101
      • What Is Stacks?
      • Bitcoin Connection
      • Proof of Transfer
      • Stacks Among Other Layers
      • Financial Incentive and Security Budget
    • Network Fundamentals
      • Network Basics
      • Mainnet and Testnets
      • Accounts
      • Authentication
      • Bitcoin Name System
      • SIPs
      • Technical Specifications
    • Block Production
      • Mining
      • Signing
      • Bitcoin Finality
      • Bitcoin Reorgs
      • Stacking
    • Transactions
      • How Transactions Work
      • Post Conditions
    • Clarity
      • Overview
      • Decidability
    • sBTC
      • Core Features
      • sBTC Operations
        • Deposit
        • Withdrawal
        • Deposit vs Withdrawal Times
      • Emily API
      • Peg Wallet UTXO
      • Clarity Contracts
        • sBTC Registry
        • sBTC Token
        • sBTC Deposit
        • sBTC Withdrawal
      • Auxiliary Features
        • Transaction Fee Sponsorship
        • Signer Wallet Rotation
      • Walkthroughs
        • Signer Process Walkthrough
        • sBTC Transaction Walkthrough
      • sBTC FAQ
    • Gaia
      • Configuration
      • Deploy Gaia Hub
      • Amazon EC2
      • Linux
      • Mac OS
  • 🛠️Guides & Tutorials
    • Developer Quickstart
    • Clarity Crash Course
    • Build a Borrowing & Lending Protocol
    • Bitcoin Integration
      • Sending Bitcoin with Leather Wallet
      • Verifying a Bitcoin Transaction
      • Parsing a Bitcoin Transaction
    • Create Tokens
      • Creating a NFT
      • Creating a Fungible Token
    • Build a Frontend
      • Post Conditions with Stacks.js
      • Authentication with Stacks.js
      • Sending Transactions with Stacks.js
    • Testing Smart Contracts
      • Fuzz Testing
    • Run a Node
      • Run a Node with Docker
      • Run a Node with Digital Ocean
      • Run a Node with a Hosted Provider
      • Run a Node with Quicknode
      • Run a Bitcoin Node
      • Run a Pruned Bitcoin Node
    • Run a Miner
      • Miner Prerequisites
      • Miner Costs and Fees
      • Mine Testnet Stacks Tokens
      • Mine Mainnet Stacks Tokens
      • Verify Miner
    • Run a Signer
      • Signer Quickstart
      • How to Read Signer Logs
      • How to Monitor a Signer
      • Best practices for running a Signer
      • OpSec Best Practices
    • sBTC
      • How to Run an sBTC Signer
      • Best practices for running an sBTC Signer
      • How to Use the sBTC Bridge
      • Earn sBTC Rewards
    • Stack STX
      • Solo Stack
      • Operate a Pool
      • Stack with a Pool
      • Increase Stacked Position
      • Stop Stacking
    • Oracles
    • Community Tutorials
  • 📚Reference
    • API
    • Clarity Types
    • Clarity Functions
    • Clarity Keywords
    • Stacks Node Configuration
    • Signer Configuration
    • Stacks Tooling
  • 🏗️Example Contracts
    • Audited Starter Contracts
    • Stacking
    • BNS
    • Multi Send
  • 🧡Press & Top Links
    • đź”¶2024
      • 🔸January 2024
      • 🔸February 2024
      • 🔸March 2024
      • 🔸April 2024
      • 🔸May 2024
      • 🔸June 2024
      • 🔸July 2024
      • 🔸August 2024
      • 🔸September 2024
      • 🔸October 2024
      • 🔸November 2024
      • 🔸December 2024
    • đź”¶2025
      • 🔸January 2025
      • 🔸February 2025
      • 🔸March 2025
      • 🔸April 2025
      • 🔸May 2025
  • 🧡Bitcoin Theses and Reports
    • đźź Bitcoin Theses
    • đź“™Bitcoin Reports
  • Contribute
Powered by GitBook
On this page
  • Price‑Feed Oracles on Stacks
  • Why you need a price‑feed oracle
  • Oracle Providers

Was this helpful?

  1. Guides & Tutorials

Oracles

PreviousStop StackingNextCommunity Tutorials

Last updated 21 days ago

Was this helpful?

Price‑Feed Oracles on Stacks

Smart contracts written in Clarity run in a deterministic sandbox: they can read data in the Stacks and Bitcoin chainstate, but nothing else. Whenever your dApp needs the latest BTC/USD, STX/BTC, or any other market price, you’ll rely on an oracle to bring that data on‑chain in a verifiable way.

This page lays out why price‑feed oracles matter on Stacks and link to the specific oracle provider docs for instructions on how to integrate them.


Why you need a price‑feed oracle

Here are some possible scenarios where you might need an oracle.

On‑chain need
Typical Stacks use case
What the oracle supplies

Liquidations & collateral ratios

Lending / borrowing protocols, margin trading

Signed price updated every N blocks

Stablecoin peg maintenance

BTC‑backed or exogenous‑collateral stablecoins

Reference BTC/USD (or other) price

AMM curve calculations

DEXs that tune fees or rebalance pools

Time‑weighted average price (TWAP)

Derivatives settlement

Options, futures, or perpetual swaps

Final settlement price at expiry

Rule of thumb: if your contract’s math depends on a real‑time market price, you need a price‑feed oracle.

Oracle Providers

There are two oracle providers that Stacks builders are currently using for their data needs: Pyth and DIA.

Pyth is a pull-based oracle and Trust Machines currently maintains the Pyth bridge. You can view docs on how to use Pyth and the associated Clarity contracts on Trust Machine's

DIA is the other oracle provider Stacks builders frequently use.

There is a documentation guide on how to use DIA oracles with Stacks on .

🛠️
GitHub repo for the bridge.
DIA's docs website