Skip to content

Latest commit

 

History

History
58 lines (37 loc) · 2.06 KB

README.md

File metadata and controls

58 lines (37 loc) · 2.06 KB

merkletree-proof

Merkletree proof is a complementary library for reverse hash service to fetch iden3 identity state roots and generate Sparse Merkle Tree proofs.

Docs

Install

go get github.com/iden3/go-merkletree-proof

Examples

Fetch identity state roots

Fetch identity state roots for identity state hash e12084d0d72c492c703a2053b371026bceda40afb9089c325652dfd2e5e11223 Identity state must be fetched from the blockchain State contract.

stateHash, _ := merkletree.NewHashFromHex("e12084d0d72c492c703a2053b371026bceda40afb9089c325652dfd2e5e11223")

cli := &merkletree_proof.HTTPReverseHashCli{URL: "<link to RHS>"}
// get identity state roots

stateValues, err := cli.GetNode(ctx, stateHash)

Generate proof

Generate proof for revocation nonce 670966937 and revocation root b92f062026083232bdd4d3a93986276515aa874fd3f7e928d6f67c8c91a6b705

revocationNonce, _ := merkletree.NewHashFromBigInt(big.NewInt(670966937))
revocationRoot, _ := merkletree.NewHashFromHex("b92f062026083232bdd4d3a93986276515aa874fd3f7e928d6f67c8c91a6b705")

cli := &proof.HTTPReverseHashCli{URL: "<link to RHS>"}
proof, _ := cli.GenerateProof(ctx, revocationRoot, revocationNonce)

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.

License

Copyright 2023 0kims Association

This project is licensed under either of

at your option.