Mesh LogoMesh

Providers

Connect your application to the Cardano blockchain with MeshJS data providers

Providers are the bridge between your application and the Cardano blockchain. They handle data fetching, transaction submission, and blockchain queries so you can focus on building your application.

Overview

MeshJS supports multiple blockchain data providers, each with different strengths:

ProviderBest ForKey Features
BlockfrostProduction apps100+ APIs, reliable infrastructure
KoiosOpen-source projectsFree tier, distributed architecture
MaestroDeFi applicationsEnterprise-grade, turbo submit
UTxORPCHigh performancegRPC protocol, minimal overhead
OgmiosSelf-hosted nodesWebSocket API, local deployment
YaciLocal developmentCustom devnets, fast iteration
HydraLayer 2 scalingHigh throughput, low latency
Offline FetcherTestingNo network required, mock data
Offline EvaluatorScript testingPlutus evaluation, cost analysis

Quick Start

Install MeshJS and choose a provider:

npm install @meshsdk/core

Initialize your provider:

import { BlockfrostProvider } from "@meshsdk/core";

const provider = new BlockfrostProvider("<YOUR_API_KEY>");

Use the provider to fetch blockchain data:

// Fetch UTxOs from an address
const utxos = await provider.fetchAddressUTxOs(
  "addr_test1qpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0uafhxhu32dys6pvn6wlw8dav6cmp4pmtv7cc3yel9uu0nq93swx9"
);

// Fetch protocol parameters
const params = await provider.fetchProtocolParameters();

// Submit a transaction
const txHash = await provider.submitTx(signedTx);

Provider Interface

All providers implement a common interface, making them interchangeable:

interface IFetcher {
  fetchAccountInfo(address: string): Promise<AccountInfo>;
  fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
  fetchAssetAddresses(asset: string): Promise<AssetAddress[]>;
  fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
  fetchBlockInfo(hash: string): Promise<BlockInfo>;
  fetchCollectionAssets(policyId: string, cursor?: number): Promise<CollectionAssets>;
  fetchProtocolParameters(epoch?: number): Promise<Protocol>;
  fetchTxInfo(hash: string): Promise<TransactionInfo>;
  fetchUTxOs(hash: string, index?: number): Promise<UTxO[]>;
}

interface ISubmitter {
  submitTx(tx: string): Promise<string>;
}

interface IEvaluator {
  evaluateTx(tx: string): Promise<Omit<Action, "data">[]>;
}

Choosing a Provider

For production applications:

For development and testing:

  • Use Yaci for local devnets with fast feedback loops
  • Use Offline Fetcher for unit tests without network dependencies

For self-hosted infrastructure:

  • Use Ogmios to connect directly to your cardano-node
  • Use UTxORPC with Dolos for a lightweight alternative

For Layer 2 applications:

  • Use Hydra for high-throughput, low-latency transactions

Available Providers

On this page