Open Shimuuar opened 4 years ago
It seems easiest and probably best approach is to implement PoW as a separate library, say hschain-pow
and reuse libs like hschain-{crypto,merkle,net}
. What are main different between PBFT & PoW:
hschain
. Alas documentation on network protocol of bitcoin & Co is light on details when it comes to propagation of blocks, handling of bch reorganizations etc. Network is quite complicated and has its own subsystems. Probably it would be reasonable to start designing full PoW system starting from network:
This is big and important topic which was punted somehow in hshchain. Blockchain state is big bad, require serialization.
Here we get into the realm of CAS. There's some rudimentary implementation in haschain but it leave much to be desired.
Tracking of chain with most work. Conseptually very simple but figuring exact API could take time. We also could check that block has enough work just by looking at header while we need full block to validate it completely. This allows some interplay between
Question which I wasn't able to crack in the hschain
. Maybe fresh start will allow some insights
[1] Quite interesting writeup on block propagation in bitcoin https://people.xiph.org/~greg/gmaxwell-sf-prop-2017.pdf
It turns out we need to implement PoW consensus. It's not clear how could we squeeze both PBTF0like and PoW consensusn into same library but it does seems to be possible. Consensus algoprithms are completely different but they do share a lot of supporting infrastructure.