# \[ANN\] Distributed consensus library and ecosystem with built-in DST

**URL:** <https://discourse.haskell.org/t/ann-distributed-consensus-library-and-ecosystem-with-built-in-dst/15204>\
**Category:** Announcements\
**Created:** [November 27, 2026, 2:51am UTC](https://discourse.haskell.org/t/ann-distributed-consensus-library-and-ecosystem-with-built-in-dst/15204 "2026-11-27T02:51:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaurentRDC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/laurentrdc/32/4950_2.png) [@LaurentRDC](https://discourse.haskell.org/u/LaurentRDC)\
**Post date:** [November 27, 2026, 2:51am UTC](https://discourse.haskell.org/t/ann-distributed-consensus-library-and-ecosystem-with-built-in-dst/15204/1 "2026-11-27T02:51:07Z")

</div>

Hey all,

Over the past year, I have been working on an implementation of the [Raft consensus algorithm](https://raft.github.io/) in Haskell, which allows for distributed consensus. In particular, using Raft, one can create a distributed, fault-tolerant state machine. [The library has been released on Hackage under the name `raft-consensus`](https://hackage.haskell.org/package/raft-consensus). Bring your own networking and persistence layer!

Raft is tricky to get right. To ensure that the library works correctly, and respects the properties of the algorithm _in practice_, even under faults such as crashes and network partitions, I leveraged a technique called deterministic simulation testing (DST), using `io-sim` as the foundation. `io-sim` is pure awesomeness that should be used more.

While building out examples, I noticed other ecosystem holes that resulted in more packages. Testing the linearizability of client requests required building a simple [linearizability checker: `linearizable`](https://hackage.haskell.org/package/linearizable). Another piece of technology that came from this project is a generic and performant implementation of write-ahead logs via a [new `wal` package](https://hackage.haskell.org/package/wal).

Finally, in order to make it as easy as possible to build a replicated state machine in practice, I built two adapter packages:

- Networking of Raft clusters via Cloud Haskell: [`raft-consensus-distributed-process`](https://hackage.haskell.org/package/raft-consensus-distributed-process)
- Persistence of Raft state via write-ahead logs: [`raft-consensus-wal`](https://hackage.haskell.org/package/raft-consensus-wal)

I feel relatively confident in releasing this stuff now because, over the past week, I’ve been working on a demo: [distributed software transactional memory](https://github.com/LaurentRDC/distributed-consensus/tree/master/examples/distributed-stm). [This program looks just like `stm`, but running over multiple computers](https://github.com/LaurentRDC/distributed-consensus/blob/b4ebcf7103c4a7b9f62bce07b11510b3125f6c3e/examples/distributed-stm/bank-demo/Main.hs#L132-L146).  
Right now it’s just a demo, but it shows how freaking _cool_ distributed state machines can be.

* * *

My goal, since I started helping with maintenance of Cloud Haskell, has been for Haskell to become a solid choice for distributed systems. We’re now one step closer to that reality.

If you’re interested in this stuff, I would love to get your input on this and collaborate. Development for all of this is happening here: [GitHub - LaurentRDC/distributed-consensus: Haskell implementation of distributed consensus protocols with built-in support for deterministic simulation testing · GitHub](https://github.com/LaurentRDC/distributed-consensus)

---

<div class="post-metadata">

**Author:** ![stevechy](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@stevechy](https://discourse.haskell.org/u/stevechy)\
**Post date:** [November 27, 2026, 5:49am UTC](https://discourse.haskell.org/t/ann-distributed-consensus-library-and-ecosystem-with-built-in-dst/15204/2 "2026-11-27T05:49:58Z")

</div>

This is interesting to me but I’m not sure where I would jump in with the project itself.

I think I might try to plug in `raft-consensus` into a custom protocol and play around with it there.

---

<div class="post-metadata">

**Author:** ![LaurentRDC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/laurentrdc/32/4950_2.png) [@LaurentRDC](https://discourse.haskell.org/u/LaurentRDC)\
**Post date:** [November 27, 2026, 12:57pm UTC](https://discourse.haskell.org/t/ann-distributed-consensus-library-and-ecosystem-with-built-in-dst/15204/3 "2026-11-27T12:57:53Z")

</div>

Documentation on Hackage is up.

@stevechy what protocol would this be integrated with? In my experience Raft is used for stores of data (e.g. distributed key value stores à la etcd)

---

<div class="post-metadata">

**Author:** ![stevechy](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@stevechy](https://discourse.haskell.org/u/stevechy)\
**Post date:** [November 27, 2026, 1:51pm UTC](https://discourse.haskell.org/t/ann-distributed-consensus-library-and-ecosystem-with-built-in-dst/15204/4 "2026-11-27T13:51:20Z")

</div>

@LaurentRDC I was thinking of making a very simple key value store as an experiment. I was originally thinking of trying to use grapsey Grpc with Oxia as a key value store but it would be pretty cool to see how a native Haskell implementation would work. I was thinking of inventing a simple protocol to experiment with it.

This is a very impressive collection of libraries! Sorry my first response was a bit terse since I was thinking of how to dive in deeper into it.

---

<div class="post-metadata">

**Author:** ![LaurentRDC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/laurentrdc/32/4950_2.png) [@LaurentRDC](https://discourse.haskell.org/u/LaurentRDC)\
**Post date:** [November 27, 2026, 3:05pm UTC](https://discourse.haskell.org/t/ann-distributed-consensus-library-and-ecosystem-with-built-in-dst/15204/5 "2026-11-27T15:05:36Z")

</div>

Thanks for mentioning [`grapesy`](https://hackage.haskell.org/package/grapesy), I have been meaning to take a look as well, and implement either an example or even an adapter.

If by Oxia you mean [this one](https://github.com/oxia-db/oxia), then that’s very much what I’ve been meaning to do as well. The reason I got interested in Raft is because there’s no good story for the management of Cloud Haskell clusters, e.g. to perform rolling upgrades. Doing so requires a metadata store (e.g. `etcd` for Kubernetes), so we are very much aligned.

---

<div class="post-metadata">

**Author:** ![stevechy](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@stevechy](https://discourse.haskell.org/u/stevechy)\
**Post date:** [November 27, 2026, 3:27pm UTC](https://discourse.haskell.org/t/ann-distributed-consensus-library-and-ecosystem-with-built-in-dst/15204/6 "2026-11-27T15:27:52Z")

</div>

Yes that is the Oxia I am referring to. The main reason I wanted to use it over zookeeper is that it has namespaces. With namespaces I can set up one instance that could be used for multiple projects. It has a grpc based protocol so I think that it shouldn’t be too bad to implement an Oxia client with `grapesy`.

I would be interested in picking up some small tasks in Cloud Haskell or these raft projects if you have any that you can point to.

---

<div class="post-metadata">

**Author:** ![LaurentRDC](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/laurentrdc/32/4950_2.png) [@LaurentRDC](https://discourse.haskell.org/u/LaurentRDC)\
**Post date:** [November 27, 2026, 3:45pm UTC](https://discourse.haskell.org/t/ann-distributed-consensus-library-and-ecosystem-with-built-in-dst/15204/7 "2026-11-27T15:45:03Z")

</div>

I’ve started a [few issues here](https://github.com/LaurentRDC/distributed-consensus/issues) that are related to the Raft implementation itself (e.g. performance optimizations).

For Cloud Haskell the big one for me is [this one](https://github.com/haskell-distributed/distributed-process/issues/486): creating a cluster management tool for Cloud Haskell clusters. Distributed consensus is a pre-requisite, but even with this, this is a huge task.  
I would say an interesting sub-challenge would be to define an interface for node discovery, with implementations via DNS and perhaps a gossip protocol as well.
