Skip to content

Commit 846b183

Browse files
author
Damien LACHAUME / PALO-IT
committed
Update mithril-client-wasm developer documentation
1 parent 21ae072 commit 846b183

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

docs/website/root/glossary.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ A Cardano node is a node that runs in a [Cardano network](#cardano-network). The
2424

2525
A Cardano key pair is an asymmetric key pair used to identify a [stake pool operator](#stake-pool-operator-spo) on the [Cardano network](#cardano-network).
2626

27+
## Cardano transaction
28+
29+
A Cardano transaction proof is a cryptographic proof that a set of Cardano transactions is included in the global Cardano transactions set. It is generated unpon request using a [Mithril client](#mithril-client) and is tied to a [certificate](#certificate).
30+
31+
A Cardano transaction commitment is stamp that state how much of the global Cardano transactions sets a [Mithril aggregator](#mithril-aggregator) is aware of, only for those transactions a Cardano transaction proof can be generated.
32+
2733
## Certificate
2834

2935
The Mithril aggregator combines the produced [multi-signature](#multi-signature) and some metadata into a Mithril certificate that will be later used by the [Mithril client](#mithril-client) to verify the authenticity of a [snapshot](#snapshot). The certificates are chained so that the [stake distribution](#stake-distribution) used to create the signatures is verifiably genuine.

docs/website/root/manual/developer-docs/nodes/mithril-client-library-wasm.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Mithril client library WASM can be used by Javascript developers to use the Mith
1414
It is responsible for handling the different types of data certified by Mithril, and available through a Mithril aggregator:
1515
- [**Snapshot**](../../../glossary.md#snapshot): list and get.
1616
- [**Mithril stake distribution**](../../../glossary.md#stake-distribution): list and get.
17+
- [**Cardano transaction**](../../../glossary.md#cardano-transaction): list & get commitment, get proofs
1718
- [**Certificate**](../../../glossary.md#certificate): list, get, and chain validation.
1819

1920
:::
@@ -113,6 +114,20 @@ let valid_stake_distribution_message = await client.verify_message_match_certifi
113114
console.log("valid_stake_distribution_message:", valid_stake_distribution_message);
114115
```
115116

117+
If the aggregator signs **CardanoTransactions** _(as of 2023-02-19 only the sanchonet aggregator signs them)_, you can add the code below to the previous example:
118+
119+
```js
120+
const proof = await client.unstable.get_cardano_transaction_proofs(["CARDANO_TRANSACTION_HASH_1", "CARDANO_TRANSACTION_HASH_2"]);
121+
console.log("Proof tx hash", proof.transactions_hashes);
122+
console.log("Proof certificate hash", proof.certificate_hash);
123+
124+
let proof_certificate = await client.verify_certificate_chain(proof.certificate_hash);
125+
console.log("verify_certificate_chain OK, last_certificate_from_chain:", proof_certificate);
126+
127+
let valid_cardano_transaction_proof = await client.unstable.compute_cardano_transaction_proof_message(proof, proof_certificate);
128+
console.log("valid_cardano_transaction_proof:", valid_cardano_transaction_proof);
129+
```
130+
116131
:::tip
117132

118133
You can read the complete [Rust developer documentation](https://mithril.network/rust-doc/mithril_client_wasm/index.html).

0 commit comments

Comments
 (0)