Re-arranged the README a bit.

This commit is contained in:
Dave Hrycyszyn
2024-10-19 17:11:19 +01:00
parent 0af7d1b2b0
commit 5f6f4a0409

View File

@@ -1,6 +1,10 @@
# BFT-CRDT PoC # BFT-CRDT PoC
This is a proof of concept implementation of a BFT-CRDT blockchain-like system. It is not at all secure right now, it is strictly for fun and poking at ideas. This is a proof of concept implementation of a [BFT-CRDT](https://jzhao.xyz/posts/bft-json-crdt) blockchain-like system. It is willfully, wildly insecure as a blockchain right now. Think of it as an experiment which is strictly for fun and poking at ideas. It is based on the ideas of [Martin Kleppmann](https://martin.kleppmann.com/papers/bft-crdt-papoc22.pdf) and the ideas and code of [Jacky Zhao](https://jzhao.xyz/). Have a read, they are both excellent writers and have some of the most interesting computing ideas I've run across in quite a while.
It is not clear what this thing is for, yet. It's not a blockchain. It makes a kind of secure DAG. It uses BFT-CRDTs to make a Sybil-proof and secure information transmission system for messages, with eventual consistency guarantees.
The idea that it could be possible to set up a secure Sybil-proof system, negating the energy burn required for proof of work, the financially exclusionary proof of stake, or the meat space hassle of a proof of personhood ceremony, is too attractive to ignore. At least, if you're interested in cool P2P systems.
## Prerequisites ## Prerequisites
@@ -33,40 +37,21 @@ cargo watch -x "run -- run -- node2"
cargo watch -x "run -- run -- node3" cargo watch -x "run -- run -- node3"
cargo watch -x "run -- run -- node4" cargo watch -x "run -- run -- node4"
``` ```
You can then type directly into each of the Crdt Node consoles. Messages will be relayed to each Crdt Node, and the transaction history will end up being the same on all nodes. You can then type directly into each of the Crdt Node consoles. Messages will be relayed to each Crdt Node, and the transaction history will end up being the same on all nodes.
## Discussion ## Discussion
What we have here is a very simple system comprised of two key parts: the Crdt Node, and the Crdt Relayer. What we have here is a very simple system comprised of two key parts: the Crdt Node, and the Crdt Relayer.
### Side Node(s) ### Crdt Node(s)
The Crdt Nodes make up a system of BFT-CRDT-producing nodes that can make a sort of wildly insecure blockchain. Currently, they can reliably send transactions to each other in a secure way, such that all nodes they communicate with can tell whether received transactions are obeying the rules of the system. The Crdt Nodes make up a system of BFT-CRDT-producing nodes that can make a sort of wildly insecure blockchain. Currently, they can reliably send transactions to each other in a secure way, such that all nodes they communicate with can tell whether received transactions are obeying the rules of the system.
The Crdt Node does not download any chain state, and if one goes off-line it will miss transactions. This is expected at the moment and fairly easy to fix, with a bit of work. The Crdt Node does not download any chain state, and if one goes off-line it will miss transactions. This is expected at the moment and fairly easy to fix, with a bit of work.
Next dev tasks:
- [ ] we don't need a relayer, the first crdt node can act as a leader until people decide they don't want to trust it any more
- [ ] the leader node can have a timer in it for block creation
- [ ] code up the ability to switch leaders (can be a human decision at first, later an (optional) automated choice)
- [ ] pick a commit and reveal scheme to remove MEV. One thing to investigate is [single-use seals](https://docs.rgb.info/distributed-computing-concepts/single-use-seals)
- [ ] enable Crdt Nodes should download current P2P chain/dag state so that they start - out with a consistent copy of transaction data, and also do catch-up after going off-line
- [ ] remove the proc macro code from bft-json-crdt, it's not really needed in this implementation
- [ ] add smart contract execution engine (CosmWasm would be a good first choice)
- [ ] enable Crdt Nodes to download contract code for a given contract
- [ ] enable Crdt Nodes to download current contract state for a given contract
- [ ] switch to full P2P messaging instead of websockets
### Crdt Relayer ### Crdt Relayer
The Crdt Relayer is a simple relayer node that sits between a Cosmos chain and the decentralized Crdt Nodes. At the moment, it simply relays transactions between nodes via a websocket. We aim to eliminate this component from the architecture, but for the moment it simplifies networking and consensus agreement while we experiment with higher-value concepts. The Crdt Relayer replicates transactions between nodes using a websocket. We aim to eliminate this component from the architecture, but for the moment it simplifies networking and consensus agreement while we experiment with higher-value concepts.
In future, the Crdt Relayer needs to:
- [ ] make a block for the BFT-CRDT chain when the Cosmos chain creates a block
- [ ] submit BFT-CRDT chain data to the Cosmos chain
Later, we will aim to remove the Crdt Relayer from the architecture, by (a) moving to pure P2P transactions between Crdt Nodes, and (b) doing leader election of a Crdt Node to reach agreement on the submitted block. Later, we will aim to remove the Crdt Relayer from the architecture, by (a) moving to pure P2P transactions between Crdt Nodes, and (b) doing leader election of a Crdt Node to reach agreement on the submitted block.
@@ -92,10 +77,23 @@ There is a second, unused Bitcoin client in place which uses Blockstream's Elect
### DKG ### DKG
It strikes me that there are many, many systems which rely on a trusted setup, and which might be able to use Distributed Key Generation (DKG) instead. SNARK systems for instance all have this problem. Could BFT-CRDTs help here? It strikes me that there are many, many systems which rely on a trusted setup, and which might be able to use Distributed Key Generation (DKG) instead. SNARK systems for instance all have this problem. Could BFT-CRDTs help here?
It is not necessarily the case that e.g. signer participants and validators are the same entities. Being able to quickly spin up a blockchain and use it to sign (potentially temporary or ephemeral) keyshare data might be pretty useful. It is not necessarily the case that e.g. signer participants and Cosmos validators are the same entities. Being able to quickly spin up a blockchain and use it to sign (potentially temporary or ephemeral) keyshare data might be pretty useful.
### Cross chain transfers ### Cross chain transfers
Might the ability to be part of multiple consensus groups at once provide new opportunities for cross-chain transfers? Might the ability to be part of multiple consensus groups at once provide new opportunities for cross-chain transfers?
## Next dev tasks:
- [ ] we don't need a relayer, the first crdt node can act as a leader until people decide they don't want to trust it any more
- [ ] the leader node can have a timer in it for block creation
- [ ] code up the ability to switch leaders (can be a human decision at first, later an (optional) automated choice)
- [ ] pick a commit and reveal scheme to remove MEV. One thing to investigate is [single-use seals](https://docs.rgb.info/distributed-computing-concepts/single-use-seals)
- [ ] enable Crdt Nodes should download current P2P chain/dag state so that they start - out with a consistent copy of transaction data, and also do catch-up after going off-line
- [ ] remove the proc macro code from bft-json-crdt, it's not really needed in this implementation
- [ ] add smart contract execution engine (CosmWasm would be a good first choice)
- [ ] enable Crdt Nodes to download contract code for a given contract
- [ ] enable Crdt Nodes to download current contract state for a given contract
- [ ] switch to full P2P messaging instead of websockets