The Blockchain (distributed ledger technology)

What do you all think about writing a blockchain in Elixir? Being a functional language and having OTP in our arsenal, it seems it would be easier to get a block chain up-and-running quickly. We even have some good starting points for the consensus algorithm and hash trees:

:024: :lol:

Blockchain resources

Elixir community effort








White Papers


These projects are in active (rapid!) development and in a variety of languages.

Academic Papers

Specific implementations


Distributed consensus

Proofs of “X”

Various methods of using blockchain technologies to prove something in a way that is cryptographically verifiable.


Blockchain components

Distributed consensus algorithms

A fundamental problem in distributed computing and multi-agent systems is to achieve overall system reliability in the presence of a number of faulty processes. This often requires processes to agree on some data value that is needed during computation. Examples of applications of consensus include whether to commit a transaction to a database, agreeing on the identity of a leader, state machine replication, and atomic broadcasts. (Wikipedia)

  • raftex - Raft consensus
  • expaxos - Paxos consensus
  • rafute - Another implementation of Raft
  • dike - Paxos implementation in Erlang

Merkle (hash) trees

A hash tree or Merkle tree is a tree in which every non-leaf node is labelled with the hash of the labels or values (in case of leaves) of its child nodes. Hash trees are useful because they allow efficient and secure verification of the contents of large data structures. Hash trees are a generalization of hash lists and hash chains. (Wikipedia)





  • elixir-rsa - Erlang public_key cryptography wrapper
  • elixir-ecc - elliptic curve cryptography
  • elixir-mcrypt - NIF wrapper around libmcrypt
  • cryptex - library for encrypting/decrypting, signing/verifying data


Keywords: state machine replication, distributed cryptographic ledger, transaction log


Should be interesting to do something. However I do not know enough about blockchain just yet to make anything impactful


Princeton researchers are writing a book on Bitcoin and they also have a Coursera course on Bitcoin and Cryptocurrencies. Although these resources are mostly geared toward cryptocurrency, the fundamentals of the distributed cryptographic ledger are discussed as well.

[moved compiled list of blockchain learning resources to OP]


I’m currently at an accelerator that invests in VR and Blockchain. If anyone’s interested, the applications for the next tribe just opened. Feel free to ask me anything!


Fantastic , I was going into Blockchain for IoT security. So Was thinking about going that route.

Thanks for the links saves me a lot of time :slight_smile:

Could they perhaps invest in open source development of a Elixir implementation of Blockchain Perhaps I could get my company to do something as well.


There’s a lot of talk about blockchain for IoT. I know IBM created a proof-of-concept and I just saw an article on Cisco Newsroom about it. It’s a great application and IoT security is a big issue nowadays.

Yes, I am definitely for open source development - instead of yet another business based on blockchain (the list on is huuuge :103:) - knowing that the two are not mutually exclusive. I am happy to see investors opening their wallets for its development though.

I was thinking of this as more of a learning project, although it may be able to compete with the big dogs if it builds enough momentum. There’s two routes I could see this going: 1) implement the Ethereum protocol and thereby benefit from all its conventions 2) build our own barebones blockchain with smart contracts, perhaps drawing inspiration from Hyperledger. I know one of the design goals for Hyperledger is to completely modularize the software so that developers are free to pick-and-choose components to build their blockchain product. I like modularity… :icon_razz: For example, you should be able to choose whether you want proof-of-work or proof-of-stake depending on your application.


Lets go for something bare bones and modular, perfect combination. I like the hyperledger aproach. I eas actually looking IBM’s source at github. So lets gave a chat an get started :slight_smile:


Indeed, the Hyperledger/IBM incubation project, fabric, is very active.

I created a GitHub organization called exchain. @Hoegbo are you @Hoegbo on GitHub? I’ll send you an invite.

I think we should start by verifying the work on raftex. For one, we want it to be Byzantine fault-tolerant - juno provides a good reference point for us. This paper discusses some subtle correctness requirements of the Raft consensus algorithm and they actually implement it in OCaml. We can write more tests…

From there we can work on implementing Merkle trees.

1 Like

I’m one of the startups and not the investors so I don’t think I can answer that question for you. However, I can tell you that it’s mostly all about the founder, and of course the potential of the product. So if there are some smart people that are committed, why not :slight_smile:

1 Like

Cool ,
Would be interesting to see if we could get something funded for open source Elixir projects.


I am Hoegbo on Github.

1 Like

Hi everyone,

Good news for you: there’s already at least one successfully funded open source Elixir project in the blockchain space.

We are Stampery, a startup leveraging the power of the bitcoin and ethereum blockchains to create immutable proof of existence, integrity and ownership of any kind of data set.

In fact, we have been part of the last batch of the aforementioned Boost accelerator. I am pretty sure @IamCharlesHan knows my colleges Luis, Daniele and of course Tomasso and his celebrated cooking skills.

Stampery was funded with $600K from Draper & Associates, Blockchain Capital and Di-Ann Eisnor in 2015 Q3, shortly after presenting at TechCrunch Disrupt SF.

We used Elixir to build our distributed blockchain data anchoring architecture, best known as BTA. It allows us to embed as many data as we want in a single bitcoin or ethereum TX.

We are open sourcing our whole stack these days. We started by publishing our binary merkle tree Elixir implementation, which as @uranther mentioned is crucial for any blockchain project you may want to start out:

We will continue releasing the source code for more components of our stack in the next weeks, including the bitcoin and ethereum raw transaction composer modules.

Of course I will be more than happy to contribute to this exchain initiative. I’m aesedepece at Github.

Let’s see what we can come up with!


Looking at the architectural diagram of Hyperledger, I tried to figure which modules would be suited to Elixir (highlighted yellow in the image) and which to Rust or the like (highlighted red). It seems Elixir could handle a large portion of these services, while leaving computation- and memory-intensive chaincode services to a faster computing language. That fast language could be Haskell or even Futhark. I wonder how juno compares to Ethcore Parity in chaincode/smart contract speed.

Maybe the ledger storage could be handled with Riak or a NewSQL database like VoltDB or CockroachDB? The event stream could be exposed through a WebSocket. Any other thoughts?

So a possible way forward is to build out Elixir services which replace those in Hyperledger. The idea being that we can write correct distributed systems code with fewer SLOC and which is easier to understand and reason about.

@aesedepece That’s awesome you are using Elixir for this exact purpose! I look forward to seeing more open source libraries released from Stampery. I am especially interested in these five types of proofs you provide:

  • Proof of Ownership
  • Proof of Existence
  • Proof of Integrity
  • Proof of Agreement
  • Proof of Receipt

I have some other feedback about the website and copy, but it doesn’t really fit in this thread :wink:


Hi uranter,

that’s a good idea. I’m learning Elixir/Phoenix and have great interest in cryptocurrencies, applications of blockchain.
I’ve found this article and think it is interesting


This is a great explanation! Thank you for sharing. For reference, the author’s Merkle tree Elixir module is here on GitHub. It looks far more complete than Stampery’s because it includes documentation and typespecs checked by dialyzer.


There is also a pure Erlang implementation:


thanks! I will check it. I was reading a paper “Tangaroa: a Byzantine Fault Tolerant Raft” and have the following question: is it possible to use Tangaroa or simply the Raft to create a cryptocurrency? do you have any idea? thanks



1 Like

@rps17 I think the consensus algorithm should be pluggable. And in some blockchain deployments it’s really not that important to have Byzantine fault tolerance because they are dealing with (more) trusted actors.

@arpunk Thanks for the link! I was wondering if there was a Merkle tree module from Riak; I was peeking the source/code today, and it seems to be a specialized implementation for Riak’s architecture. The module you linked is another reference point for us and maybe we can adapt some of its functions, like diffs, into the Elixir module.

1 Like

@uranther merklet seems to be a reimplementation of the one riak has. I haven’t diffed the code but it says so in the README.

1 Like