chari

package module
v0.0.0-...-ec79efd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

README

Chari

Plugable consensus PBFT for hyperledger/fabric

Fabric Tests Date
9bf243e pass Nov 28, 2017

Install

go get -u github.com/amamina/chari

How to use

  1. Add PBFT consenters into orderer, modify fabric/orderer/main.go

    import "github.com/amamina/chari"

    add consenters["pbft"] = chari.New() after

    consenters["solo"] = solo.New()
    consenters["kafka"] = kafka.New(conf.Kafka.TLS, conf.Kafka.Retry, conf.Kafka.Version)
    
  2. Support pbft in configtx.yaml, modify fabric/common/configtx/tool/provisional/provisional.go

    add ConsensusTypePBFT = "pbft" after

    // ConsensusTypeSolo identifies the solo consensus implementation.
    ConsensusTypeSolo = "solo"
    // ConsensusTypeKafka identifies the Kafka-based consensus implementation.
    ConsensusTypeKafka = "kafka"
    

    add case ConsensusTypePBFT: //do nothing after

    switch conf.Orderer.OrdererType {
    case ConsensusTypeSolo:
    case ConsensusTypeKafka:
    bs.ordererGroups = append(bs.ordererGroups, config.TemplateKafkaBrokers(conf.Orderer.Kafka.Brokers))
    
  3. Change consensus to PBFT in configtx.yaml

    OrdererType: pbft

  4. Make docker image hyperledger/fabric-orderer Cause we have modify fabric/orderer/main.go, a new image hyperledger/fabric-orderer should be remake. There is a script to in chari/make, cd chari/make and $>make, it will auto to make image hyperledger/fabric-orderer:latest.

  5. Configuration files Chari depends on tendermint, for provide some configuration files to startup tendermint, a tool called charigen in chari/charigen which will auto create configuration files. Notice: charigen should be in the same dir of configtxgen and cryptogen.

  6. Startup Orderer Chari supports PBFT instead of Kafka in orderer, so Kakfa no needs. Now, orderers must meet 3F +1, and additional configurations likes below should be added to orderer shell.

-p 3450:3450 \
-e BFT_P2P_PORT=3450 \
-e BFT_P2P_SEEDS=192.168.110.128:3450,192.168.110.128:3451,192.168.110.128:3452,192.168.110.128:3453 \
-v /etc/hyperledger/crypto-config/chari0:/etc/hyperledger/chari \
-v /etc/hyperledger/channel-artifacts/chari.genesis.json:/etc/hyperledger/chari/genesis.json \

Warning

The current version, when orderer shutdown and restart, the one will be ejected by other orderers, cause the missing blocks during down time will re-execute after orderer restart, this operation will be regarded as do evil by other orderers. To avoid this issue, the down orderer should delete and re-startup but not restart. In the next version will fix this issue.

Documentation

Index

Constants

View Source
const (
	AppHash = "ChariPBFTConsenter"
)

Variables

This section is empty.

Functions

func New

func New() (consenter multichain.Consenter)

Types

type Log

type Log struct {
	// contains filtered or unexported fields
}

func (*Log) Debug

func (this *Log) Debug(msg string, keyvals ...interface{})

func (*Log) Error

func (this *Log) Error(msg string, keyvals ...interface{})

func (*Log) Info

func (this *Log) Info(msg string, keyvals ...interface{})

func (*Log) With

func (this *Log) With(keyvals ...interface{}) log.Logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL