Skip to main content
Chainlink is the world’s most widely adopted decentralized oracle network, enabling smart contracts to securely access off-chain data, APIs, and traditional payment systems. Chainlink Data Streams is a pull-based oracle solution that delivers high-frequency, low-latency market data directly to smart contracts.

What This Guide Teaches You

This tutorial will walk you through integrating Chainlink Data Streams on Sei Network to:
  1. Fetch real-time price data using the Chainlink Data Streams SDK
  2. Deploy a smart contract that can verify and decode price reports on-chain
  3. Combine off-chain and on-chain components to create a complete oracle solution
  4. Verify SEI/USDT price feeds as a practical example
By the end of this guide, you’ll have a working implementation that fetches price data off-chain and verifies it on-chain using Chainlink’s data streams SDK.

Prerequisites

Before starting this tutorial, ensure you have:

Technical Requirements

  • Node.js (v18 or higher) and npm installed
  • Basic knowledge of TypeScript/JavaScript
  • Solidity development experience (basic to intermediate)
  • Familiarity with smart contract deployment tools like Remix or Hardhat

Sei Network Setup

Testnet :
  • Sei testnet RPC: https://evm-rpc-testnet.sei-apis.com
  • Chain ID: 1328
Mainnet :
  • SEI mainnet RPC: https://evm-rpc.sei-apis.com
  • Chain ID: 1329
You need to contact Chainlink for getting access to API credentials of Data Streams.
  • API credentials: Contact Chainlink to get access to Data Streams on Sei Mainnet/testnet
  • API Key and User Secret for testnet access
  • Feed IDs: We’ll use SEI/USDT feed ID 0x0003dba2d8553dfd7afe35c2bfe217ef5106d7805e5272c04a08940ddb868117
  • VerifierProxy contract address: 0x60fAa7faC949aF392DFc858F5d97E3EEfa07E9EB — the same address is used on Sei mainnet and Sei testnet. See Chainlink’s Stream Addresses page for the current list.

Step-by-Step Tutorial

Step 1: Project Setup

Create a new directory and initialize your project:
Install the required dependencies:
Create a .env file in your project root:

Step 2: Fetching Price Data with TypeScript

Create a file called singleStream.ts with the following code:
This script:
  • Creates a Data Streams client with your API credentials
  • Fetches the latest report for a given feed ID
  • Decodes the raw report into readable price data
  • Displays both raw and formatted data for debugging

Step 3: Smart Contract Deployment

Create and deploy the verification contract on Sei Network. Copy this Solidity code into Remix IDE:
Deployment steps in Remix:
  1. Switch to Sei Testnet in MetaMask
  2. Deploy with Sei testnet VerifierProxy address: 0x60fAa7faC949aF392DFc858F5d97E3EEfa07E9EB
  3. Save the contract address for testing

Step 4: Complete Integration Script

Create verifyOnChain.ts to combine off-chain fetching with on-chain verification:

How to Run and Test

1. Test Off-chain Data Fetching

Run the single stream script to verify off-chain fetching and decoding:
Expected output:

2. Test Smart Contract Deployment

  1. Copy the raw report blob from Step 1 output (the long hex string starting with 0x00090d9e...)
  2. Call verifyReport() and paste the entire blob as the unverifiedReport parameter
  3. Call getLastPrice() - you should see the decoded price (e.g., 180009506586149300)

3. Test Complete Integration

Step 3a: Setup Integration Script Add your private key to .env:
Update verifyOnChain.ts with your deployed contract address: Replace YOUR_DEPLOYED_CONTRACT_ADDRESS in the script with your actual contract address. Step 3b: Run Integration Test
Expected Output:

Resources