Blockchain Providers
Connect to Cardano with Blockfrost, Koios, Nexus, Ogmios, UTxO RPC, and Bitcoin with Blockstream. Unified provider interface for data fetching and transaction submission.
Providers are the bridge between your application and the 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:
Cardano Providers
| Provider | Best For | Key Features |
|---|---|---|
| Blockfrost | Production apps | 100+ APIs, reliable infrastructure |
| Koios | Open-source projects | Free tier, distributed architecture |
| Nexus | Hosted or self-hosted Cardano API | REST queries, submit, and script evaluation |
| 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 |
| Iagon Insight | Mainnet apps | Data, submit and evaluate in one, Blockfrost and Koios compatible |
| Offline Fetcher | Testing | No network required, mock data |
| Offline Evaluator | Script testing | Plutus evaluation, cost analysis |
Bitcoin Providers
| Provider | Best For | Key Features |
|---|---|---|
| Blockstream | Development & prototyping | No API key, free public Esplora API |
| Blockstream Enterprise | Production applications | OAuth API keys, authenticated Esplora hosts |
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 Nexus 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
For Bitcoin applications:
- Use Blockstream for free, zero-config access to mainnet and testnet
- Use Blockstream Enterprise when you have Explorer API credentials and want the enterprise Esplora hosts
Available Providers
Related Resources
- Transaction Builder - Build transactions using provider data
- Wallets - Connect wallets and sign transactions
- Smart Contracts - Deploy and interact with Plutus scripts