RedStone Oracles: Reliable On-Demand Data for Stacks Applications
by Caitlin Eckvahl on April 29, 2022
Oracles are a key part of making decentralized applications work (especially those of the DeFi variety) and are essential to connecting blockchains to the real world. Almost like an API, you can ask an oracle for the information you might need in your smart contract. As you can imagine, getting information reliable enough to put into a smart contract is the foundation of its reliability. Developers building on Bitcoin via Stacks can now integrate secure data feeds since RedStone has added support for the Stacks network!

By integrating with RedStone, Stacks applications will be able to pair smart contracts with real-world data including price information such as volatility, order books, trading volumes, and events in the physical world. Currently, RedStone supports price feeds for over 1000 assets such as tokens, stocks and commodities with update intervals even below a minute. This will ultimately allow developers to build out more well-rounded applications with more diverse use cases, all while benefitting from Bitcoin’s security.

RedStone works a bit differently from other oracles. Often, oracle protocols store data directly on-chain, meaning transactions fees and transaction speed can hamper oracle usability. RedStone instead applies a mechanism based on a meta-transaction pattern, verifying the information integrity on-chain through signature checking.

For the verification process, RedStone utilizes Arweave’s unique decentralized storage network to keep costs low and speed high. Such architecture saves on transaction fees wasted on keeping data constantly on the destination blockchain, as feeds are delivered only when needed (on-demand fetching). You can read the whole documentation here.

Smart contracts can use this kind of information to trigger on-chain actions. For DeFi applications, this means being able to pull accurate pricing data from various exchanges. For NFTs, this real world data could pave the way for dynamic NFTs such as an art piece that changes based on the weather. Oracles have a lot of uses and they are a great way for the digital world to know about the physical world.

RedStone’s data is accessible from any website, mobile application, or backend server. All data comes with a verifiable cryptographic signature allowing for blockchain grade integrity. You can access the data by an http-api or using RedStone’s npm library that comes with extra features. Below you’ll find a short tutorial on how you can start using RedStone data feeds in your applications.

How to use RedStone in your Stacks apps today

The redstone-verify contract is deployed on mainnet and testnet. Devs can use it as a library contract.
Verifying a RedStone message in Clarity will then be reduced to a single line of code!
(try! (contract-call? 'SPDBEG5X8XD50SPM1JJH0E5CTXGDV5NJTKAKKR5V.redstone-verify recover-signer timestamp entries signature))
A full tutorial will be released soon. You can find the full implementation, example consuming contracts, and utilities in the GitHub repository.

For integration details and questions regarding RedStone architecture you can head to their social channels on Discord and Twitter.
Caitlin is the Communications Lead at the Stacks Foundation where she provides PR and communications support to Stacks builders. Previously, she worked as a communications consultant at Wachsman where she worked with prominent crypto and blockchain companies including Stacks, Rally.io, Rarible, Qredo, Value Technology Foundation, Status.IM, Binance Charity, and others.