Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An implementation of Greg Maxwell's Merkle approach to proving Bitcoin liabilities, in Clojure.
Clojure Shell
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/uk/me/iwilcox/poltree
test/uk/me/iwilcox
tools
.gitignore
LICENCE.txt
Makefile
README.md
poltree.sh

README.md

PoLtree

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.

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

# Or...

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

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

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

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

cat trivial-deterministic.json | ./poltree.sh completetree \
    | perl tools/s11n-to-dot.pl | dot -Tpng >trivial-complete.png


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

# You get the idea.  Altogether now...

cat accounts-deterministic.json | ./poltree.sh completetree \
    | ./poltree.sh partialtree satoshi | perl tools/s11n-to-dot.pl \
    | 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

Something went wrong with that request. Please try again.