An implementation of Greg Maxwell's Merkle approach to proving Bitcoin liabilities, in Clojure.
Clojure Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


An implementation of Greg Maxwell's Merkle approach to proving Bitcoin liabilities, in Clojure.

An example partial graph from the full example accounts list, for satoshi:

An example complete graph from a simpler accounts list:

Here's how to reproduce the above graphs using the CLI. You'll need accounts-deterministic.json and trivial-deterministic.json to follow along. The output is minimal (whitespace-light) so I'd recommend piping it through jq . if you want to read it, but the prettier way to view results is to render them with GraphViz using the supplied converter.

./ completetree accounts-deterministic.json >complete-tree.json

# Or...

cat trivial-deterministic.json | ./ completetree >trivial-complete.json

# Or if you've installed jq (Debian etc: jq) and prefer pretty JSON...

cat trivial-deterministic.json | ./ completetree | jq .

# Or if you've installed extra bits (Debian etc: graphviz, libjson-perl)...

cat trivial-deterministic.json | ./ completetree \
    | perl tools/ | dot -Tpng >trivial-complete.png

./ partialtree satoshi complete-tree.json >satoshi-partial.json

# You get the idea.  Altogether now...

cat accounts-deterministic.json | ./ completetree \
    | ./ partialtree satoshi | perl tools/ \
    | dot -Tpng >satoshi-partial.png

Since I imagine this is most likely to be used directly from other Clojure code by exchanges if used at all, the command line interface only really supports simple testing (account list input, complete tree output) right now. The Clojure interface is in core.clj.

I don't do lein/maven/gradle. The libraries/versions I used were as follows (but earlier versions may very well work):

  • Java 1.7 (Oracle's one)
  • Clojure 1.4
  • data.json (project; .jar direct from Maven: v0.2.4)
  • math.numeric-tower (project; .jar direct from Maven: v0.0.4)

Licence: the GPL-compatible (but less viral) Mozilla Public License v2.0, any exceptions being noted in the affected file(s).

To Do