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

What this guide teaches you

This tutorial shows you how to integrate Chainlink Data Streams on Sei to:
  1. Fetch real-time price data with 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 will have a working implementation that uses the Chainlink Data Streams SDK. It fetches price data off-chain and verifies it on-chain.

Prerequisites

Before you start this tutorial, make sure that you have:

Technical requirements

  • Node.js (v18 or higher) and npm installed
  • Basic knowledge of TypeScript or JavaScript
  • Solidity development experience (basic to intermediate)
  • Familiarity with tools to deploy smart contracts, such as Remix or Hardhat

Sei network setup

Sei Testnet:
  • Sei Testnet RPC: https://evm-rpc-testnet.sei-apis.com
  • Chain ID: 1328
Sei Mainnet:
  • Sei Mainnet RPC: https://evm-rpc.sei-apis.com
  • Chain ID: 1329
Contact Chainlink to get access to the API credentials for Data Streams.
  • API credentials: Contact Chainlink to get access to Data Streams on Sei Mainnet or Sei Testnet
  • API Key and User Secret for testnet access
  • Feed IDs: This guide uses the SEI/USDT feed ID 0x0003dba2d8553dfd7afe35c2bfe217ef5106d7805e5272c04a08940ddb868117
  • VerifierProxy contract address: 0x60fAa7faC949aF392DFc858F5d97E3EEfa07E9EB. Sei Mainnet and Sei Testnet use the same address. For the current list, see Chainlink’s Stream Addresses page.

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 named singleStream.ts with this 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 the raw and the formatted data for debugging

Step 3: Smart contract deployment

Create and deploy the verification contract on Sei. Copy this Solidity code into Remix IDE:
Deployment steps in Remix:
  1. Switch to Sei Testnet in MetaMask
  2. Deploy the contract with the VerifierProxy address for Sei Testnet: 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 test off-chain fetching and decoding:
Expected output:

2. Test smart contract deployment

  1. Copy the raw report blob from the Step 1 output (the long hex string that starts with 0x00090d9e...)
  2. Call verifyReport() with the entire blob as the unverifiedReport parameter
  3. Call getLastPrice(). You should see the decoded price (for example, 180009506586149300)

3. Test complete integration

Step 3a: Set up the integration script Add your private key to .env:
In verifyOnChain.ts, replace YOUR_DEPLOYED_CONTRACT_ADDRESS with the address of your deployed contract. Step 3b: Run the integration test
Expected output:

Resources