0xPolygonID / polygonid-flutter-sdk

Flutter Plugin to use the Polygon ID SDK
Apache License 2.0
39 stars 29 forks source link

[Mobile SDK] Identity Wallet - Sparse Merkle Tree #29

Closed rauljareno closed 1 year ago

rauljareno commented 2 years ago

Description

https://justjjy.com/An-optimized-compact-sparse-merkle-tree

  1. sparse MT wrapper (not exported to the public )
    1. CreateIdentityMerkleTrees returns three trees: claims tree, revocation tree, and roots tree.
    2. GetRevocationTree()
    3. GetClaimsTree()
    4. GetRootsTree()
    5. AddClaim()

We have an option to use compile go-merkletree-sql library, but we need to test if it works with mobile databases.

https://idyllicvision.atlassian.net/browse/IDEN-364

If it’s not possible to reuse, we need to implement a native version of go-merkletree-sql. (java and objective c). If we implement flutter SDK we will need future implement go-merkletree-sql for Android SDK and iOS SDK anyway.

https://github.com/iden3/go-merkletree-sql https://github.com/iden3/iden3-docs/blob/master/source/iden3_repos/research/publications/zkproof-standards-workshop-2/merkle-tree/merkle-tree.rst https://github.com/iden3/iden3js/tree/master/src/sparse-merkle-tree Also in specification or implementation is a mistake. But as it was implemented in circom we leave it as is, but I spent some time thinking why my hash is different :cara_ligeramentesonriente: (Agreed with Jordi to leave it as implemented) H{path} = H(e) = H(1 || k || v). In current implementations it is, in your implementation it should be the same H_{path} = H(e) = H(k || v || 1).

For all functions see reference implementation: https://github.com/iden3/go-merkletree-sql/blob/eb9e0711e00430409377f8ebc14f0558023eba21/merkletree.go @Dmytro(Dima) Sukhyi

https://github.com/EthanYuan/sparse-merkle-tree https://github.com/mtereshchuk/compact-sparse-Merkle-trees https://github.com/dymchenkko/sparse_merkle_tree https://github.com/jgustave/merkle_study

Subtasks

rauljareno commented 2 years ago

@OBrezhniev could we integrate this as a go-mobile library?