Evolution SDK
Advanced

Custom Providers

Implement your own blockchain provider

Custom Providers

If the built-in providers (Blockfrost, Maestro, Koios, Kupo/Ogmios) don't meet your needs, you can implement the ProviderEffect interface to create a custom provider.

Provider Interface

A provider must implement these methods:

interface ProviderEffect {
  getProtocolParameters(): Effect<ProtocolParameters, ProviderError>
  getUtxos(addressOrCredential): Effect<UTxO[], ProviderError>
  getUtxosWithUnit(addressOrCredential, unit): Effect<UTxO[], ProviderError>
  getUtxoByUnit(unit): Effect<UTxO, ProviderError>
  getUtxosByOutRef(refs): Effect<UTxO[], ProviderError>
  getDelegation(rewardAddress): Effect<Delegation, ProviderError>
  getDatum(datumHash): Effect<Data, ProviderError>
  submitTx(tx): Effect<TransactionHash, ProviderError>
  awaitTx(txHash, checkInterval?, timeout?): Effect<boolean, ProviderError>
  evaluateTx(tx, additionalUTxOs?): Effect<EvalRedeemer[], ProviderError>
}

Built-in Providers

ProviderConnectionBest For
BlockfrostREST APIProduction apps, simple setup
MaestroREST APIAdvanced queries, data analytics
KoiosREST APIOpen source, community maintained
Kupo/OgmiosWebSocket + RESTSelf-hosted, devnet, full control

Using a Provider

import {  } from "@evolution-sdk/evolution"

// Blockfrost
const  = ({
  : "preprod",
  : {
    : "blockfrost",
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  }
})

// Kupo/Ogmios
const  = ({
  : "preprod",
  : {
    : "kupmios",
    : "http://localhost:1442",
    : "http://localhost:1337"
  }
})

Next Steps

  • Architecture — How providers fit into the build pipeline
  • Providers — Provider comparison and configuration