# kafka-fabric-network **Repository Path**: bmy8/kafka-fabric-network ## Basic Information - **Project Name**: kafka-fabric-network - **Description**: A simple implementation of Kafka based Ordering service in Fabric - **Primary Language**: Docker - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2020-02-16 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Kafka Fabric Network This repository holds the configuration and the sample chaincode for testing a kafka enabled network. ## Introduction The Hyperledger Fabric has introduced Kafka as it’s primary consensus mechanism among the orderers. While in development, for testing purposes, a solo config orderer is used. However, in production, you need to have multiple orderer nodes set up to have fail proof systems. In the case of a hardware/software failure, this is what will rescue you from critical situations. Kafka helps implement this easily. To understand in detail how all of this works, refer to this article [TODO]. ## Assumptions You already know how to work with Hyperledger Fabric and deploy chaincode to the network in development. You are also comfortable with docker and docker-compose. To get comfortable with these topics, refer to these [articles](https://www.skcript.com/svr/blockchain/). ## Network Architecture We have a simple network configuration - 3 Orderers. - 2 Organizations. - 4 peers, 2 for each organization. - 4 Kafka broker instances. - 3 Zookeper instances. ## Technical Documentation ### Folder Structure ``` ./ ├── bin │   ├── configtxgen │   ├── configtxlator │   ├── cryptogen │   ├── fabric-ca-client │   ├── get-docker-images.sh │   ├── orderer │   └── peer ├── chaincode │   └── sacc.go ├── network-config │   ├── configtx.yaml │   ├── crypto-config.yaml │   ├── docker-compose-base.yml │   ├── docker-compose-cli.yml │   ├── docker-compose-couchdb.yml │   ├── docker-compose-kafka.yml │   ├── docker-compose-peer-org3.yml │   └── docker-compose-solo.yml ├── generate.sh ├── install.sh ├── README.md ├── start.sh ├── stop.sh ├── teardown.sh ├── test.sh └── update.sh 3 directories, 24 files ``` ### Description - `bin/` contains all the binaries required for generating crypto material. - `chaincode/` contains the sacc chaincode, present in `fabric-samples`. - `network-config/` contains all the configuration `yaml` files for the network. - `generate.sh` will generate all the crypto-material required for the network to run. - `install.sh` will install and instantiate the chaincode. - `start.sh` will start all the containers in docker-compose files. - `stop.sh` will stop and remove all docker containers, use with caution. - `teardown.sh` will kill containers and remove images generated by the network. - `test.sh` is used to test an invoke query. - `update.sh` is used to install and upgrade chaincode. ### Steps - Make sure you've grabbed all the [prerequisites](http://hyperledger-fabric.readthedocs.io/en/release-1.1/prereqs.html) and [samples](http://hyperledger-fabric.readthedocs.io/en/release-1.1/samples.html#) for running hyperledger fabric. - In your `$GOPATH`, make sure you have the hyperledger fabric source. ```bash cd $GOPATH/src/github.com/ mkdir hyperledger cd hyperledger git clone https://github.com/hyperledger/fabric.git ``` - Clone this repository and enter the directory. ```bash git clone https://github.com/banbanpeppa/kafka-fabric-network.git cd kafka-fabric-network ``` NOTE : Give exec permissions to the shell scripts ```chmod 777 ./script-name.sh``` - Generate the crypto-material ```bash ./generate.sh ``` - Start the network ```bash ./start.sh ``` - Install and Instantiate the chaincode ```bash ./install.sh ``` - Verify if all the docker containers are running ```bash docker ps ``` - Test a sample invoke command ```bash ./test.sh ``` - Stop every docker container and kill all the containers ```bash ./stop.sh ```