What You’ll Be Doing in This Guide
In this tutorial, you’ll learn how to:- Integrate RedStone’s data feeds into your application on the SEI network
- Retrieve real-time SEI token price data using RedStone’s SDK and data packages
- Understand RedStone’s unique “data-on-demand” architecture
- Implement fetching and data verification
Prerequisites
Before starting this tutorial, ensure you have:Technical Requirements
- Solidity Knowledge: Basic understanding of Solidity smart contract development
- JavaScript/Node.js: For off-chain data fetching using RedStone SDK
- Development Environment: Remix IDE, Hardhat, or similar Solidity development setup
- SEI Network Access: RPC endpoint and mainnet access for SEI
Required Dependencies
- RedStone SDK (
@redstone-finance/sdk) - RedStone EVM Connector (
@redstone-finance/evm-connector)
Install
SEI Network Configuration
Make sure your development environment is configured for SEI:- Mainnet RPC:
https://evm-rpc.sei-apis.com - Chain ID: 1329 (mainnet)
RedStone Architecture Overview
RedStone uses a unique “data-on-demand” model:- Data Providers: Collect data from multiple sources and sign data packages
- Data Packages: Signed data structures containing 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
Let’s implement the JavaScript code to fetch SEI price data using RedStone’s SDK:Data Package Structure
A RedStone data package contains:- dataPoints: Array of price data points
- timestampMilliseconds: When the data was signed
- signature: Cryptographic signature from the data provider
- dataPackageId: Identifier for the specific data feed (e.g., “SEI”)