Rango Docs
API SwaggerWidget PlaygroundAppWebsite
  • 👋Welcome to Rango
  • 🏠Introduction
  • 💁How It Works
  • ✅Integrations
  • ⚖️Rango vs. Competitors
  • 🔐Security
  • 🛣️Roadmap
  • 🦎Tokenomics
  • 💰Airdrop
  • ❓FAQ
  • 🐞Bug Bounty
  • API Integration
    • 🔡Terminology
    • 🚄API Key & Rate Limits
    • 🤝Choosing the Right API
    • 🦄Basic API - Single Step
      • 🛝API Flow
      • ⚙️API Reference
        • Get Blockchains & Tokens
        • Get Quote
        • Create Transaction (Swap)
        • Check Transaction Status
        • Check Approve Transaction Status
        • Get Address Assets & Balances
        • Get Token Balance
        • Report Transaction Failure
        • Get Direct Tokens
        • Get Custom Token
        • Message Passing
      • 🎓Tutorial
        • 🍰SDK Example
      • 💰Monetization
      • 🎹Sample Transactions
      • ✅Integration Checklist
    • 🦎Main API - Multi Step
      • 🛝API Flow
      • ⚙️API Reference
        • Get Blockchains & Tokens
        • Get Best Route
        • Get All Possible Routes
        • Confirm Route
        • Create Transaction
        • Check Transaction Status
        • Check Approve Transaction Status
        • Report Transaction Failure
        • Get Custom Token
        • Get Address Token Balance
      • 🎓Tutorial
        • 🍰SDK Example
      • 💰Monetization
      • 🎹Sample Transactions
  • ℹ️API Troubleshooting
  • Technical Docs
    • 🍔Swap Aggregation
    • 💰Monetization
    • ⛽Fee Structure
    • ⛽Network Fees and Gas Estimates
    • ⌛Stuck Transactions
  • Widget Integration
    • 🧩Overview
    • 🎇Quick Start
    • ⚙️Customization
    • 💰Monetization
    • 🛣️React Router
    • 🎵Events
    • 💳External Wallets
  • Smart Contracts
    • 👩‍💼Architecture
    • 🔎Audit Reports
    • 🏗️Deployment Addresses
    • 📩Message Passing
  • Ask for Integration
    • 🙋‍♂️DEXs & DEX Aggregators
    • 📱Rango Mobile SDK
  • Useful Links
    • Twitter
    • Discord Server
    • TG Announcements
    • TG Group
  • Terms of Use
  • Privacy policy
Powered by GitBook
On this page

Was this helpful?

  1. Technical Docs

Network Fees and Gas Estimates

PreviousFee StructureNextStuck Transactions

Last updated 10 months ago

Was this helpful?

When Rango API provides a quote response, we try to provide an accurate estimation of fees. For the actual transaction creation however, especially EVM transactions, we suggest higher gaslimits and bridge fees in order to make sure the transaction is not processed by the network (or bridge). To achieve this goal, we apply safety factor multipliers to network fees and some bridge fees to reduce transaction failure rate.

Does this mean the user pays higher fees? No.

There are multiple reasons for using higher gaslimits and fees. EVM RPCs are not very good at estimating gas for complex transactions. The problem becomes even more complex if we consider gas refunds and net gas estimates.

For example imagine a transaction consumes 800k gas, but during the execution, the gas consumption up goes to 900k and at the end of the transaction 100k gas is refunded, netting the predicted 800k gas consumption. However, if the user sets 800k gas on transaction, the tx will fail because it cannot consume more than 800k to reach the 900k gas consumption, even if the user will be refunded 100k. Therefore, for this example, when we estimate the fees, we use 800k gas, but when we create the transaction, we use 900k gas.

As an example, you can take a look at this tx that has ran out of gas with a gaslimit of 695,624. () But if we simulate the same transaction with a higher gasLimit, in this example, 795,624, we see that the transaction is successful and the gas used is 641,006 which is even lower than the original tx that failed. ()

Some bridges have a similar model and we apply a safety factor for the bridge fee. In such cases, the user is refunded if the it has paid more fees than neccessary.

Note: In the future we will provide the safety factors that we use in the APIs. This way, third parties can have a better estimate of the actual costs and what is safe to use for transaction execution.

Some useful links:

  • and

⛽
Link
Simulation Link
StackExchange Discussion
Storage Gas Refunds
EIP-3529