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:
| Provider | Best For | Key Features |
|---|---|---|
| Blockfrost | Production apps | 100+ APIs, reliable infrastructure |
| Koios | Open-source projects | Free tier, distributed architecture |
| Maestro | DeFi applications | Enterprise-grade, turbo submit |
| UTxORPC | High performance | gRPC protocol, minimal overhead |
| Ogmios | Self-hosted nodes | WebSocket API, local deployment |
| Yaci | Local development | Custom devnets, fast iteration |
| Hydra | Layer 2 scaling | High throughput, low latency |
| Offline Fetcher | Testing | No network required, mock data |
| Offline Evaluator | Script testing | Plutus evaluation, cost analysis |
Quick Start
Install MeshJS and choose a provider:
npm install @meshsdk/coreInitialize 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:
- Use Blockfrost or Maestro for reliable, managed infrastructure
- Consider UTxORPC if you need maximum performance
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
Blockfrost Provider
Featuring over 100 APIs tailored for easy access to Cardano blockchain
Hydra Provider (beta)
Layer 2 scaling solution for Cardano that increases transaction throughput and ensures cost efficiency while maintaining security.
Koios Provider
Distributed & open-source public API query layer for Cardano
Maestro Provider
Advanced UTxO-indexing data layer to supercharge Defi on Bitcoin, Cardano & Dogecoin
Ogmios Provider
Lightweight bridge interface for cardano-node that offers WebSockets API that enables local clients to speak Ouroboros' mini-protocols
UTxORPC Provider
Highly efficient through gRPC, using a compact and high-performance binary format
Yaci Provider
Custom Cardano devnet to tailor your devnet needs with a builtin indexer and custom viewer for devnet
Offline Fetcher
Provider for testing, development and offline scenarios
Offline Evaluator
An offline Plutus script evaluator for testing and validation.
Related Resources
- Transaction Builder - Build transactions using provider data
- Wallets - Connect wallets and sign transactions
- Smart Contracts - Deploy and interact with Plutus scripts