Custom Oracle Integration: Band Protocol Pull Model and Scripts

A client faced a problem: their DeFi protocol on Polygon required a reliable data source to calculate interest rates across 50+ pairs. Chainlink didn't fit — high push-update costs ($5000 per month for 50 feeds) and limited customization. We proposed integrating Band Protocol, which uses a pull mode

Blockchain Development Services

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1301
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1267
  • image_logo-advance_0.webp
    B2B Advance company logo design
    713
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1003
  • image_logo-aider_0.webp
    AIDER company logo development
    943
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1056

A client faced a problem: their DeFi protocol on Polygon required a reliable data source to calculate interest rates across 50+ pairs. Chainlink didn't fit — high push-update costs ($5000 per month for 50 feeds) and limited customization. We proposed integrating Band Protocol, which uses a pull model via BandChain (Cosmos SDK) and allows creating custom oracle scripts. As a result, gas costs decreased 5x, with savings up to 97% (saving ~$8000 per month for 100 pairs). Our experience includes 20+ oracle integrations in DeFi protocols with a combined TVL of $150M+. With 5+ years in blockchain development, our team ensures reliable deployment. Get a consultation — contact us to evaluate your project.

Solving Expensive Data Problems with Custom Oracles

Band Protocol is a cross-chain oracle built on a separate BandChain blockchain with 30+ validators executing data requests. Unlike Chainlink's push model where price feeds update every 10 minutes, Band operates on demand. You pay only for the data you actually use.

BandChain Architecture

  • BandChain: a blockchain on Cosmos SDK optimized for oracles. Validators vote on request results; consensus time is 3 seconds.
  • Oracle Scripts: programs in Owanscript (WebAssembly) that define how to aggregate data from selected sources. For example, take the median of 3 sources over the last 5 minutes.
  • Data Sources: verified sources (CoinGecko, Binance, CryptoCompare) — you can combine up to 10 sources in a single script.
  • IBC + Bridges: results are transmitted to other chains via IBC (Cosmos) or bridge contracts (EVM) with a fee of $0.01 per request.

EVM Integration

For standard prices (BTC/USD, ETH/USD), you can use the ready-made IStdReference contract:

interface IStdReference { struct ReferenceData { uint256 rate; uint256 lastUpdatedBase; uint256 lastUpdatedQuote; } function getReferenceData(string memory _base, string memory _quote) external view returns (ReferenceData memory); function getReferenceDataBulk( string[] memory _bases, string[] memory _quotes ) external view returns (ReferenceData[] memory); } contract BandConsumer { IStdReference ref; constructor(IStdReference _ref) { ref = _ref; } function getPrice(string memory symbol) external view returns (uint256) { IStdReference.ReferenceData memory data = ref.getReferenceData(symbol, "USD"); // Check freshness: data not older than 1 hour require(block.timestamp - data.lastUpdatedBase < 3600, "Stale price"); return data.rate; } } 

Custom Oracle Scripts and How to Create Them

An oracle script is a program in Owanscript that defines which external APIs to query, how to aggregate results, and how to return data. We create scripts tailored to your task: from simple median to weighted averages with manipulation protection.

Example of an advanced oracle script for prices with frontrunning protection:

# Fetch function with response time check def execute(ctx): sources = ctx.get_sources() prices = [] for s in sources: data = s.fetch() if data.response_time > 500: # ms continue prices.append(data.price) # Remove 10% extreme values trim = len(prices) // 10 trimmed = sorted(prices)[trim:-trim] return median(trimmed) 

Why Custom Oracle Scripts Are the Main Advantage of Band?

Band lets you write your own scripts in Owanscript. This offers flexibility unavailable in Chainlink, especially for non-standard feeds — weather, sports, random numbers. Band outperforms Chainlink by 3-10x in data update cost when dealing with many pairs. The financial benefit is clear: for 100 pairs, savings reach $8000 per month.

How to Create an Oracle Script: Step by Step

  1. Define data sources. Choose from verified APIs (CoinGecko, Binance) — up to 5 sources.
  2. Write aggregation logic in Owanscript. Use median, average, or weighted with trimming of extremes.
  3. Compile the script to WASM. Size limit — 1 MB.
  4. Deploy the script to BandChain. Deployment fee — 0.1 BAND (~$0.50).
  5. Test locally using Band CLI.
  6. Connect consumer contract to the bridge.

How We Conduct Integration

We perform full-cycle integration. The process includes stages with estimated timelines:

Stage Duration Result
Analytics 1-2 days List of required data feeds, their sources, and update frequency
Design 2-3 days Oracle script and consumer contract architecture
Development 3-7 days Consumer contract in Solidity/Rust with unit tests
Bridge integration 1-2 days Configure IBC or EVM bridge
Testing 2-3 days Fuzzing (Echidna), reentrancy and MEV checks
Deployment and monitoring 1 day Mainnet with Tenderly dashboard

What’s Included in the Work?

  • Full smart contract code with comments.
  • Docker environment for testing.
  • Deployment and feed update documentation.
  • Access to monitoring dashboard (Tenderly).
  • Training session for your team (1 hour).
  • Guarantee of correct contract operation for 1 month after deployment.

Comparison: Band Protocol vs Chainlink

Aspect Chainlink Band Protocol
Model Push (on-chain updates) Pull via bridge
Customization Limited High (oracle scripts)
Cross-chain Via CCIP Native via IBC
TVL secured $100B+ $5B+
Cosmos ecosystem Weak Native
Update cost High (all feeds at once) Low (on demand)

Band Protocol is optimal for projects on Cosmos and those needing custom data feeds. For Ethereum mainnet DeFi with high liquidity, Chainlink remains the standard. However, with a large number of pairs, Band delivers 3-10x cost savings. Contact us so we can evaluate your project and choose the best integration scheme.

Learn more on Wikipedia.

Estimated timeline: from one week to one month. Get a consultation — contact us to assess your project. Order Band Protocol integration today to reduce oracle costs.