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