What you’ll be doing in this guide
This tutorial shows you how to:- Integrate RedStone’s data feeds into your application on Sei
- Get real-time price data for the SEI token with RedStone’s SDK and data packages
- Understand RedStone’s “data-on-demand” architecture
- Implement data fetching and verification
Prerequisites
Before you start this tutorial, make sure that you have:Technical requirements
- Solidity knowledge: A basic understanding of smart contract development in Solidity
- JavaScript and Node.js: To fetch data off-chain with the RedStone SDK
- Development environment: Remix IDE, Hardhat, or a similar Solidity development setup
- Sei network access: An RPC endpoint and access to Sei Mainnet
Required dependencies
- RedStone SDK (
@redstone-finance/sdk) - RedStone EVM Connector (
@redstone-finance/evm-connector)
Install
Sei network configuration
Make sure that your development environment is configured for Sei:- Mainnet RPC:
https://evm-rpc.sei-apis.com - Chain ID: 1329 (Sei Mainnet)
RedStone architecture overview
RedStone uses a “data-on-demand” model:- Data providers: Collect data from multiple sources and sign data packages
- Data packages: Signed data structures that contain price information and metadata
- Gateway network: Distributes data packages to consumers
- Smart contracts: Verify signatures and extract data on-chain
Steps to fetch SEI price data
This JavaScript code fetches SEI price data with RedStone’s SDK:Data package structure
A RedStone data package contains:- dataPoints: An array of price data points
- timestampMilliseconds: When the data was signed
- signature: The cryptographic signature from the data provider
- dataPackageId: The identifier of the specific data feed (for example, “SEI”)