Skip to main content
Version: Next 🚧

Mithril client library WASM


Mithril client library WASM can be used by Javascript developers to use the Mithril network in their web applications.

It is responsible for handling the different types of data certified by Mithril, and available through a Mithril aggregator:

  • For more information about the Mithril network, please see the architecture overview.
Mithril networks

Here is an updated list of all Mithril networks, including their configurations and current statuses:

Last update: 07/21/2023


Mithril networkrelease-mainnet
Cardano networkmainnet
Cardano magic Id-
SupportedYes βœ”οΈ
StatusBeta 🟒
Aggregator endpoint ↗️
Genesis verification key ↗️
Era reader adapter typecardano-chain
Era reader address ↗️
Era reader verification key ↗️
Build fromLatest release ↗️

In this documentation, we use the following generic identifiers:

  • YOUR_CARDANO_NETWORK You need to replace this with the name of the network that runs on your Cardano node (eg, preprod)
  • YOUR_AGGREGATOR_ENDPOINT You need to replace this with the endpoint of an aggregator that runs on the Cardano network you are targeting (eg,
  • YOUR_GENESIS_VERIFICATION_KEY You need to replace this with the genesis verification key URL that runs on the Cardano network you are targeting (eg,
  • YOUR_ERA_READER_ADAPTER_TYPE You need to replace this with the era reader adapter type used by the Mithril network you are targeting (eg, cardano-chain)
  • YOUR_ERA_READER_ADDRESS You need to replace this with the era reader address URL used by the Mithril network you are targeting (eg,
  • YOUR_ERA_READER_VERIFICATION_KEY You need to replace this with the era reader verification key URL used by the Mithril network you are targeting (eg,


NodeSource repositoryRust documentation
Mithril client WASM↗️↗️


The Mithril client library is compatible with the following browsers:

BrowserMinimum versionReleasedTested in CI
Chrome Android542016-10-19-
Firefox for Android382015-05-12-
Opera Android412016-10-25-
Safari on iOS15.42022-03-14-

In your Javascript project, use npm to add mithril-client-wasm library as a dependency:

npm i @mithril-dev/mithril-client-wasm

Using Mithril client library​

Below is a basic example of how to use most of the functions exposed by the Mithril client library:

import initMithrilClient, { MithrilClient } from "@mithril-dev/mithril-client-wasm"

let aggregator_endpoint =
let genesis_verification_key =

const broadcast_channel = new BroadcastChannel("mithril-client");
broadcast_channel.onmessage = (e) => {
let event =;
if (event.type == "CertificateChainValidationStarted") {
console.log("The certificate chain validation has started");
} else if (event.type == "CertificateValidated") {
console.log("A certificate has been validated, certificate_hash: " + event.payload.certificate_hash);
} else if (event.type == "CertificateChainValidated") {
console.log("The certificate chain is valid");
} else {

await initMithrilClient();

let client = await new MithrilClient(
let mithril_stake_distributions_list = await client.list_mithril_stake_distributions();
console.log("stake distributions:", mithril_stake_distributions_list);

let last_mithril_stake_distribution = mithril_stake_distributions_list[0];
console.log("last_mithril_stake_distribution:", last_mithril_stake_distribution);

let last_stake_distribution = await client.get_mithril_stake_distribution(last_mithril_stake_distribution.hash);
console.log("last_stake_distribution:", last_stake_distribution);

let certificate = await client.get_mithril_certificate(last_stake_distribution.certificate_hash);
console.log("certificate:", certificate);

let last_certificate_from_chain = await client.verify_certificate_chain(certificate.hash);
console.log("verify certificate chain OK, last_certificate_from_chain:", last_certificate_from_chain);

let mithril_stake_distributions_message = await client.compute_mithril_stake_distribution_message(last_stake_distribution);
console.log("mithril_stake_distributions_message:", mithril_stake_distributions_message);

let valid_stake_distribution_message = await client.verify_message_match_certificate(mithril_stake_distributions_message, last_certificate_from_chain);
console.log("valid_stake_distribution_message:", valid_stake_distribution_message);

If the aggregator signs CardanoTransactions, you can add the code below to the previous example:


You can verify that the aggregator signs CardanoTransactions by running the command below:

wget -q -O - YOUR_AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])'

For example with the aggregator on testing-sanchonet Mithril network:

wget -q -O - | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])'
const proof = await client.unstable.get_cardano_transaction_proofs(["CARDANO_TRANSACTION_HASH_1", "CARDANO_TRANSACTION_HASH_2"]);
console.log("Proof tx hash", proof.transactions_hashes);
console.log("Proof certificate hash", proof.certificate_hash);

let proof_certificate = await client.verify_certificate_chain(proof.certificate_hash);
console.log("verify_certificate_chain OK, last_certificate_from_chain:", proof_certificate);

let valid_cardano_transaction_proof = await client.unstable.verify_cardano_transaction_proof_then_compute_message(proof, proof_certificate);
console.log("valid_cardano_transaction_proof:", valid_cardano_transaction_proof);

You can read the complete Rust developer documentation.