Merkle Feeds
Merkle feeds are the most efficient way to get complex financial instruments updated on-demand on Starknet.
Merkle Feeds
Merkle feeds provide a secure and efficient “pull oracle” model for accessing option prices and other financial data on Starknet.
The Pragma Consumer SDK is a powerful tool that allows developers to interact with Pragma’s Merkle Feed system. This SDK enables you to fetch option prices and their associated Merkle proofs, which you can then use with the Pragma Oracle contract to access on-chain data.
What is a Merkle Feed?
A Merkle Feed is an efficient way to publish and verify large amounts of data on-chain while minimizing gas costs.
In Pragma’s case, we publish a Merkle root on-chain that represents a tree of option prices for a specific blockchain height. Users can then use our SDK to retrieve prices off-chain and verify their correctness on-chain, creating a secure and efficient “pull oracle” model.
How It Works
Data Sourcing
The merkle trees are built with data from Deribit, the leading platform for options trading.
On-chain Publishing
Merkle root is published on-chain every block, ensuring data freshness.
Off-chain Retrieval
Merkle proofs with associated data can be retrieved through REST and WebSocket endpoints or through a Rust crate we provide.
On-demand Updates
Data is updated on-demand on-chain upon successful verification of the merkle proof.
Key Features
Easy Integration
Easy-to-use Rust SDK for seamless integration
Network Support
Supports both mainnet and testnet environments
Flexible Retrieval
Flexible block selection for data retrieval
Real-time Data
Access to real-time option pricing data
Usage
To start using the Pragma Consumer SDK in your Rust project:
1. Add the SDK to your Cargo.toml
2. Initialize the Consumer in your code
3. Fetch Merkle Feed data
4. Use the result to update the data on-chain
Next steps
Was this page helpful?