You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.0 KiB

  1. # asmt
  2. asmt is a GoLang sparse merkle tree.
  3. A forked of [Aergo SMT](https://github.com/aergoio/aergo/tree/develop/pkg/trie) with minor style code modifications
  4. and some new methods: Walk() WalkWithRoot() and GetWithRoot().
  5. This module includes an abstraction layer to make the SMT more developer friendly with a very easy to use API:
  6. + Init(name, dataDir string) error
  7. + LastAccess() (timestamp int64)
  8. + Add(key, value []byte) error
  9. + AddBatch(keys, values [][]byte) (failedIndexes []int, err error)
  10. + GenProof(key, value []byte) (mproof []byte, err error)
  11. + CheckProof(key, value, root, mproof []byte) (included bool, err error)
  12. + Root() []byte
  13. + HashExists(hash []byte) (bool, error)
  14. + Dump(root []byte) (data []byte, err error) // Dump must return a format compatible with ImportDump
  15. + DumpPlain(root []byte) (keys [][]byte, values [][]byte, err error)
  16. + ImportDump(data []byte) error
  17. + Size(root []byte) (int64, error)
  18. + Snapshot(root []byte) (Tree, error) // Snapshot is a frozen trie on a specific Root hash that cannot be modified