GithubHelp home page GithubHelp logo

meeshbhoombah / mpt Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 1.17 MB

A Naive Modified Merkle Patricia Trie in ink!: Substrate’s Smart Contract Language

License: MIT License

Shell 13.32% Rust 86.68%
mpt patricia-trie ink

mpt's Introduction

mpt

Naive implementation of Modfied Merkle Patricia Trie.

Structure

The following ("key", "value") pairs...

("a711355", "dog")
("a77d337", "cat")
("a7f9365", "frog")
("a77d397", "bat")

Would result in:

|- "a7"
    |-"0"
    |-"1"
        |-"1355"
            |-"dog"
    |-"2"
    |-"3"
    |-"4"
    |-"5"
    |-"6"
    |-"7"
        |-"d3"
            |-"0"
            |-"1"
            |-"2"
            |-"3"
                |-"7"
                    |-"cat"
            |-"4"
            |-"5"
            |-"6"
            |-"7"
            |-"8"
            |-"9"
                |-"7"
                    |-"bat"
            |-"a"jj
            |-"b"
            |-"c"
            |-"d"
            |-"e"
            |-"f"
            |-"value"
    |-"8"
    |-"9"
    |-"a"
    |-"b"
    |-"c"
    |-"d"
    |-"e"
    |-"f"
        |-"9365"
    |-"value"

  1. Create a Trie
  2. Insert a key
  3. Get a value with the key
  4. Remove a value at key

Constraints

  • Strings only
  • One Trie per smart contract
  • No encoding
  • Ink

References

  1. Ethereum Wiki: Patricia Trie
  2. Ethereum Yellowpaper: Appendix D
  3. Nevous System's Clojure EVM
  4. Ethereum Wiki: RLP
  5. Vitalik Buterin's Merkling in Ethereum

Implementations

  1. go-ethereum
  2. begmaroman's
  3. ebuchman's

mpt's People

Contributors

meeshbhoombah avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

wade-welles

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.