Minimal Viable PoS


Hey guys. Does anyone know of any simple implementations of a minimal viable PoS system? Can be written in Python, Javascript, whatever… just looking for something as simple as possible that I can rewrite in Rust. Thanks! :slight_smile:


Let me know if you find anything - would love to work on this together for the Chapter 4 homework assignment(s)


That sounds great. As I mentioned in my other comment, I’m refactoring my tutorial to make consensus mechanisms modular and pluggable. The goal is to then create a library of minimal viable versions of PoA, PoW, PoS, etc… and then allow the user to plug them into a generic architecture. The idea is that different cryptoeconomic mechanisms and attacks are possible with PoW vs PoS, so allowing the user to swap them out without worrying about the rest of the blockchain architecture allows for faster iteration and learning.

With that in mind, I’m looking for any simple implementations or sketches of PoS systems. They don’t have to be perfect, or even secure, but just something to build out as a starting point. Might even be better if it’s not secure because then you can have a section that builds it, a section that attacks it, and then another section that improves it to guard against the attack. Then you really address the WHY question and make the design decisions real vs just arbitrarily showing the user an architecture but not explaining why it is the way it is.

I’m starting to just compile a list of stuff that might be useful here:

What have you been looking at or thinking about as a template for a MVPoS tutorial?


Update: got the first draft of the modular architecture working with PoW and “PoS”. The PoS part really just randomly selects between validators and checks that their stakes are sufficient and that they produce valid blocks, but it’s a step in the right direction. I haven’t implemented networking or concurrent threads so everything is just running in one big main file to test that the functions function. It’s not really “consensus”, but again it’s moving towards that and Networking/Concurrency is the next thing on my TODO list :slight_smile:

PoW Sketch

PoS Sketch

Obviously these are SUPER rough, but if you look through the architectures there’s minimal changes between the two other than the STF (state transition function) section and adding some params to the State section. Also there’s notes in the PoW section kind of explaining the general thought process around the architecture. I’ll make it more readable in the book soon, so that’ll update but the code playgrounds are static. Just wanted to share in case it’s helpful for your research and/or if you had any suggestions to make it better :slight_smile: