RedStone Quick Guide
  • Guide
    • 让我们一起更好了解RedStone
    • Selected materials for learning RedStone
    • How to earn RSG points in a correct way
    • Places to Check data & facts on RedStone
    • Let's try to know how to run a RedStone Node
    • Getting Started with RedStone X
    • Getting Started with Redstone Core
    • Getting Started with Redstone Classic
    • 2 quick ways to check your RSG points
    • 两种快速查询RSG积分的方法
    • RedStone再质押报告核心观点导读
  • Articles
    • Liquid Staking Unveiled: A Simple Guide:TL;DR for RedStone's LstFi report
    • TL;DR for RedStone's great 2023 Market Overview on Stablecoins
    • The Emergence of Real World Assets in DeFi
    • Introducing RedStone's New Tokenomics Model for Data Sharing
    • RedStone's other parts:aggregation & safety and others
    • The Pillars of RedStone's Data Ecosystem
    • RedStone - A Short intro to the New Era of Oracles for Modern DeFi
    • RedStone: Innovating DeFi Data Flow Through Modular Design
    • TL;DR for RedStone Miners Ambassador Program
    • An interesting short Case Study:RedStone Integrates with Venus Protocol
    • An interesting short Case Study-2:RedStone Integrates with Lido
    • An interesting short Case Study-3:RedStone Integrates with Fuel to Unlock New DeFi Capabilities
    • An interesting short Case Study-4:RedStone Integrates withFortifies Premia Blue
    • An interesting short Case Study-5:RedStone Integrates Angle
    • An interesting short Case Study-6:CIAN Transforms Automation with RedStone Oracles Integration
    • An interesting short Case Study 7:RedStone Oracles ✖️ Avalanche Evergreen & Spruce Testnet
    • An interesting short Case Study-8:RedStone Oracles & Vesta Finance's
    • An interesting short Case Study-9:RedStone Oracles X Voltz
    • An interesting short Case Study-10:RedStone Oracles X Mento
    • An interesting short Case Study-11:RedStone Oracles X Yield Yak
    • RedStone X StakeWise Case Study: A Simplified Overview
    • Why did Google report wrong pice-A simplified explanation for non-tech readers
    • RedStone X Ton: An interesting short Case Study-12
    • RedStone X Manta: An interesting Short Case Study 14
    • A quick case study for how Oracle Projects(RedStone) integrates with DeFi projects
    • TL:DR for RedStone's Restaking Reports
    • A tale of two RedStones-Coexist Confirmed
    • RedStone X zkLink:A quick case study
    • RedStone X Ether.fi: A case to explore
Powered by GitBook
On this page
  • Deferred Execution Mechanism
  • Deferred Execution
  1. Guide

Getting Started with RedStone X

In the fast-moving world of decentralized finance (DeFi), front-running is a persistent threat. RedStone X provides an innovative solution through its deferred execution pattern, enabling highly efficient and secure DeFi projects.

Deferred Execution Mechanism

RedStone X separates transaction execution into two steps:

  1. Initiating the Transaction Users first record their intent to interact with the protocol on-chain, without specifying details like price. This prevents front-runners from manipulating oracle prices.

  2. Deferred Price-Based Execution In the next block, any entity can submit the price data to the blockchain. The price is verified programmatically based on protocol rules. This price is then used to finalize the transaction. Benefits This deferred execution approach offers two major advantages:

  • Robust front-running protection, securing user funds and preventing arbitrage.

  • Transactions leveraging verified, tamper-proof price data, ensuring fairness. Implementing

Deferred Execution

To leverage RedStone X's benefits, follow these steps:

  1. For price-sensitive transactions, have your contracts separate request and execution phases.For example, in a native to stablecoin swap, the request would record key data like amount and user, and notify keepers:

    function initiateSwap() external payable {
      bytes32 requestHash = calculateRequestHash(
        msg.value, 
        msg.sender,
        block.number
    
      );
      swapRequests[requestHash] = true;
      emit NewOracleDataRequest(msg.value, msg.sender, block.number);
    }
  2. Deploy a Keeper Service A dedicated keeper service retrieves price info and triggers execution. This automation ensures smooth deferred execution. With RedStone X's deferred execution model, developers can build secure and efficient DeFi systems, shielded from front-running exploits. By separating request from execution based on verified data, RedStone X unlocks a new era of resilient DeFi.

PreviousLet's try to know how to run a RedStone NodeNextGetting Started with Redstone Core

Last updated 1 year ago

For the full code example and more insights, visit the .

official RedStone X documentation