Evolution SDK
Advanced

Custom Providers

Implement your own blockchain provider

Custom Providers

The SDK currently provides four built-in providers. Custom provider implementation requires working with the internal ProviderEffect interface — this is an advanced topic and the API may change.

Provider Interface

All providers implement the ProviderEffect interface internally. This is what each built-in provider (Blockfrost, Kupmios, Maestro, Koios) satisfies:

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>
}

Understanding this interface is useful for knowing what data each provider must supply and for debugging provider-related errors.

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  = .()
  .({
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  })

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

Next Steps

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

On this page