123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2019-2020 Nomadic Labs <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(* Signature that hides the Bytes.t implementation *)moduletypeT=sigtypeask(* 32 bytes *)typeak(* 32 *)typensk(* 32 *)typenk(* 32 *)typeovk(* 32 *)typediversifier(* 11 *)typepkd(* 32 *)typenullifier(* 32 *)typecommitment(* 32 *)typeepk(* 32 *)typesymkey(* 32 *)typesighash(* 32 *)typespend_sig(* 64 *)typehash(* 32 *)typecv(* 32 *)typerk(* 32 *)typespend_proof(* 48 + 48 + 96 *)typebinding_sig(* 64 *)typeoutput_proof(* 48 + 48 + 96 *)typeivk(* 32 *)typear(* 32 *)typercm(* 32 *)typeesk(* 32 *)typediversifier_index(* 11 *)valcompare_diversifier_index:diversifier_index->diversifier_index->int(*96 bytes*)typeexpanded_spending_key={ask:ask;nsk:nsk;ovk:ovk}(* 169 bytes *)(* this is an extended_spending_key that can be used to derive more
keys using zip32*)typezip32_expanded_spending_key={depth:Bytes.t;(* 1 byte *)parent_fvk_tag:Bytes.t;(* 4 bytes *)child_index:Bytes.t;(* 4 bytes *)chain_code:Bytes.t;(* 32 bytes *)expsk:expanded_spending_key;(* 96 bytes *)dk:Bytes.t;(* 32 bytes *)}(* 96 bytes*)typefull_viewing_key={ak:ak;nk:nk;ovk:ovk}(* 169 bytes *)(* this is an extended_full_viewing_key that can be used to derive more
keys using zip32 *)typezip32_full_viewing_key={depth:Bytes.t;(* 1 byte *)parent_fvk_tag:Bytes.t;(* 4 bytes *)child_index:Bytes.t;(* 4 bytes *)chain_code:Bytes.t;(* 32 bytes *)fvk:full_viewing_key;(* 96 bytes *)dk:Bytes.t;(* 32 bytes *)}valto_nk:Bytes.t->nkvalto_ak:Bytes.t->akvalto_ask:Bytes.t->askvalto_nsk:Bytes.t->nskvalto_pkd:Bytes.t->pkdvalto_ovk:Bytes.t->ovkvalto_nullifier:Bytes.t->nullifiervalto_commitment:Bytes.t->commitmentvalto_symkey:Bytes.t->symkeyvalto_epk:Bytes.t->epkvalto_spend_sig:Bytes.t->spend_sigvalto_hash:Bytes.t->hashvalto_cv:Bytes.t->cvvalto_rk:Bytes.t->rkvalto_spend_proof:Bytes.t->spend_proofvalto_output_proof:Bytes.t->output_proofvalto_sighash:Bytes.t->sighashvalto_binding_sig:Bytes.t->binding_sigvalto_diversifier:Bytes.t->diversifieroptionvalto_diversifier_index:Bytes.t->diversifier_indexvalto_ar:Bytes.t->arvalto_rcm:Bytes.t->rcmvalto_esk:Bytes.t->eskvalto_ivk:Bytes.t->ivkvalto_expanded_spending_key:Bytes.t->expanded_spending_keyvalto_zip32_expanded_spending_key:Bytes.t->zip32_expanded_spending_keyvalto_full_viewing_key:Bytes.t->full_viewing_keyvalto_zip32_full_viewing_key:Bytes.t->zip32_full_viewing_keyvalof_nk:nk->Bytes.tvalof_ak:ak->Bytes.tvalof_ask:ask->Bytes.tvalof_nsk:nsk->Bytes.tvalof_pkd:pkd->Bytes.tvalof_ovk:ovk->Bytes.tvalof_nullifier:nullifier->Bytes.tvalof_commitment:commitment->Bytes.tvalof_symkey:symkey->Bytes.tvalof_epk:epk->Bytes.tvalof_spend_sig:spend_sig->Bytes.tvalof_hash:hash->Bytes.tvalof_cv:cv->Bytes.tvalof_rk:rk->Bytes.tvalof_spend_proof:spend_proof->Bytes.tvalof_output_proof:output_proof->Bytes.tvalof_sighash:sighash->Bytes.tvalof_binding_sig:binding_sig->Bytes.tvalof_diversifier:diversifier->Bytes.tvalof_diversifier_index:diversifier_index->Bytes.tvalof_ar:ar->Bytes.tvalof_rcm:rcm->Bytes.tvalof_esk:esk->Bytes.tvalof_ivk:ivk->Bytes.tvalof_expanded_spending_key:expanded_spending_key->Bytes.tvalof_zip32_expanded_spending_key:zip32_expanded_spending_key->Bytes.tvalof_full_viewing_key:full_viewing_key->Bytes.tvalof_zip32_full_viewing_key:zip32_full_viewing_key->Bytes.tvalhash_compare:hash->hash->intvalhash_of_commitment:commitment->hashvalcommitment_of_hash:hash->commitmentend