问题
I want to use Hyperledger Fabric. But I need a special consensus algorithm. I have the concept ready but no idea how to get it implemented in Fabric.
The documentation says:
A consensus plugin needs to implement the Consenter and Chain interfaces defined in the consensus package. There are two plugins built against these interfaces already: solo and kafka. You can study them to take cues for your own implementation. The ordering service code can be found under the orderer package.
First question: Is it possible to code my own consensus method and run it in Hyperledger Fabric? Second: If yes, how should I start?
回答1:
I think you've just about answered your own question. The consensus algorithms in Hyperledger Fabric are implemented by the Ordering service. So, to implement a new algorithm, you would need to code a new consensus package, add this to the Ordering service, and a build a new fork of the fabric runtime.
Use one of the existing implementations as a starting point (solo or kafka), and have at it! :)
来源:https://stackoverflow.com/questions/53631929/how-to-code-own-consensus-in-hyperledger-fabric