# Technical Tutorial: 3 Ways to Integrate RedStone into Blockchain Projects 🛠️  

By [amazoon7.eth](https://paragraph.com/@amazoon7) · 2025-01-21

---

introduction

Oracles like RedStone bridge real-world data to smart contracts. In this tutorial, we’ll explore three core methods to integrate RedStone into your projects: Simple API, Advanced SDK, and Direct Smart Contract Integration.

\---

\### 1. Using RedStone’s Simple API

Best for: Decentralized apps (dApps) needing quick data access.

Benefits: No complex coding, cost-effective, beginner-friendly.

Steps:

1\. Get an API Key:

*   Visit the \[RedStone Developer Portal\]([https://app.redstone.finance/](https://app.redstone.finance/)) to generate your API key.
    

2\. Fetch Data:

*   Use the endpoint below to retrieve token price data (e.g., ETH):
    
    curl "[https://api.redstone.finance/prices?symbol=ETH&provider=redstone](https://api.redstone.finance/prices?symbol=ETH&provider=redstone)"
    

3\. Process the Response:

*   The JSON response includes price, update timestamp, and data source:
    
    {
    
    "ETH": {
    
    "value": 2500,
    
    "timestamp": 1678901234,
    
    "source": "binance"
    
    }
    

}

\---

2\. Using RedStone’s Advanced SDK

Best for: Projects requiring customized data or on-chain processing.

Benefits: High flexibility, multi-purpose data support, seamless framework integration.

Steps:

1\. Install the SDK:

*   Use npm or yarn:
    
    npm install @redstone-finance/sdk
    

2\. Fetch Data in Code:

*   JavaScript example to retrieve ETH price:
    
    import { requestData } from "@redstone-finance/sdk";
    

const data = await requestData({

     dataServiceId: "redstone-main-demo",  
    
     uniqueSigners: \["0x..."\], // Validator addresses  
    
     dataFeeds: \["ETH"\]  
    

});

console.log(data.ETH); // Output: { value: 2500, ... }

3\. Inject Data into Smart Contracts:

*   Use the updateDataFeeds method in your contract to push data on-chain.
    

\---

3\. Direct Integration with Smart Contracts

Best for: Advanced DeFi protocols prioritizing security and full control.

Benefits: Full decentralization, reduced reliance on external infrastructure.

Steps:

1\. Import RedStone’s Interface:

*   Use the redstone-oracles library in your smart contract:
    
    // SPDX-License-Identifier: MIT
    

pragma solidity ^0.8.0;

import "@redstone-finance/contracts/contracts/PriceFeed.sol";

contract MyContract {

       PriceFeed public priceFeed;  
    
       constructor(address \_priceFeedAddress) {  
    
           priceFeed = PriceFeed(\_priceFeedAddress);  
    
       }  
    
       function getETHPrice() public view returns (uint256) {  
    
           return priceFeed.getLatestPrice("ETH");  
    
       }  
    

}

2\. Deploy the Contract:

*   Input RedStone’s PriceFeed contract address for your target chain (e.g., Ethereum or Polygon).
    

3\. Validate Data:

*   Data is automatically verified by RedStone’s decentralized validators.
    

\---

Summary: Which Method to Choose?

\- API: Ideal for MVPs or small-scale projects.

\- SDK: Perfect for dApps with custom requirements.

\- Smart Contracts: Optimal for security-sensitive protocols like lending or staking.

\---

Additional Resources:

\- \[RedStone Technical Docs\]([https://docs.redstone.finance/](https://docs.redstone.finance/))

\- \[Integration Video Tutorial\]([https://youtube.com/redstone](https://youtube.com/redstone))

With RedStone, bring real-world data on-chain cheaper and faster! 🚀

Additional Resources:

*   [RedStone Technical Docs](https://docs.redstone.finance/)
    
*   [Integration Video Tutorial](https://youtube.com/redstone)
    

![](https://storage.googleapis.com/papyrus_images/5093326c00da9dd264784cf7f694005bd842fffed6abf136d063cdb39fa5c93a.webp)

---

*Originally published on [amazoon7.eth](https://paragraph.com/@amazoon7/technical-tutorial-3-ways-to-integrate-redstone-into-blockchain-projects)*
