Blockfrost
A Blockfrost-compatible REST API for Cardano, hosted by Demeter.
What it is for
Reading chain data over HTTP: blocks, transactions, addresses, UTxOs, assets,
protocol parameters, and transaction submission. Any client written for the
Blockfrost API works against it once you point it at the Demeter URL. Mesh,
Lucid Evolution and Blaze all ship a Blockfrost provider, and
@blockfrost/blockfrost-js is the Blockfrost SDK itself.
For the endpoints it serves, see the API reference.
Hosts
The pattern, where {network} is cardano-mainnet, cardano-preprod or
cardano-preview:
https://{network}.blockfrost-m1.dmtr.host
On preprod:
https://cardano-preprod.blockfrost-m1.dmtr.host
The authenticated form puts the key in the host:
https://{key}.{network}.blockfrost-m1.dmtr.host
Paths start at the root, so the latest block is /blocks/latest. There is no
/api/v0 prefix.
Authentication
Send the key in the dmtr-api-key header:
dmtr-api-key: <your key>
Or use the authenticated host, with no header. Use it with libraries that cannot set a custom header. Mesh, Lucid Evolution and Blaze are all in that group.
Networks
cardano-mainnet, cardano-preprod and cardano-preview. Each port serves
one network, chosen when you create it.
Limits
| Tier | Minimum fee | Per 100k requests | Max requests / second | Daily requests |
|---|---|---|---|---|
| Free | $0 | $0 | 5 | ~430,000 |
| Flexible | $0 | $0.30 | 20 | — |
| Pro I | $50 | $0.26 | 100 | — |
| Pro II | $150 | $0.23 | 300 | — |
Usage is counted per 100,000 requests, and throughput is capped by requests per second. Minimum fees apply only to the tiers that reserve throughput.
Getting a key
Create a Blockfrost port at https://console.demeter.run. The port's page
shows its endpoint, its authenticated endpoint and its API key.
Example
Set the key in your shell:
export DEMETER_API_KEY=... # the API key from the port's page
With curl, the latest block on preprod:
curl -H "dmtr-api-key: $DEMETER_API_KEY" \
https://cardano-preprod.blockfrost-m1.dmtr.host/blocks/latest
Mesh
BlockfrostProvider takes a base URL and sends no custom header, so use the
authenticated host (checked against @meshsdk/core 1.9.1):
import { BlockfrostProvider } from "@meshsdk/core";
const provider = new BlockfrostProvider(
`https://${process.env.DEMETER_API_KEY}.cardano-preprod.blockfrost-m1.dmtr.host`,
);
console.log(await provider.fetchLatestBlock());
Lucid Evolution
Blockfrost takes a URL and an optional project id, which it sends as a
project_id header. Demeter reads the key from the host, so leave the project
id out (checked against @lucid-evolution/lucid 0.8.2):
import { Blockfrost, Lucid } from "@lucid-evolution/lucid";
const provider = new Blockfrost(
`https://${process.env.DEMETER_API_KEY}.cardano-preprod.blockfrost-m1.dmtr.host`,
);
console.log(await provider.getProtocolParameters());
const lucid = await Lucid(provider, "Preprod");
Blaze
Blaze's Blockfrost provider has no base-URL option: its constructor takes a
network name and builds a blockfrost.io URL from it. Its url field is
public, and every request reads it, so you can point it at Demeter after
construction. The value must end with /. This works as of
@blaze-cardano/query 0.6.4, but it is not a documented option, so pin your
version:
import { Blockfrost } from "@blaze-cardano/query";
const provider = new Blockfrost({ network: "cardano-preprod", projectId: "" });
provider.url = `https://${process.env.DEMETER_API_KEY}.cardano-preprod.blockfrost-m1.dmtr.host/`;
console.log(await provider.getParameters());