GithubHelp home page GithubHelp logo

hyperledger-labs / fablo Goto Github PK

View Code? Open in Web Editor NEW
190.0 25.0 72.0 6.57 MB

Fablo is a simple tool to generate the Hyperledger Fabric blockchain network and run it on Docker. It supports RAFT and solo consensus protocols, multiple organizations and channels, chaincode installation and upgrade.

License: Apache License 2.0

JavaScript 0.28% Shell 55.33% Dockerfile 0.61% EJS 0.20% TypeScript 43.58%
hyperledger-fabric-network hyperledger-fabric network-topology hyperledger chaincodes generator blockchain

fablo's People

Contributors

dependabot[bot] avatar dzikowski avatar florianldt avatar gzhk avatar hejwo avatar jnjerin avatar rucek avatar ryjones avatar sanket-0510 avatar sentientforest avatar sroopsai avatar umegbewe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fablo's Issues

Consider different schema for orgs in channel

Current:

      "orgs": [
        {
          "key": "org1",
          "peers": [
            "peer0"
          ]
        },
        {
          "key": "org2",
          "peers": [
            "peer0",
            "peer1"
          ]
        }
      ]

Proposed:

      "orgs": [
        {
          "organization": "org1",
          "peer": "peer0"
        },
        {
          "organization": "org2",
          "peer": "peer0"
        },
        {
          "organization": "org2",
          "peer": "peer1"
        }
      ]

Or:

      "orgs": {
        "org1": [
          "peer0"
        ],
        "org2": [
          "peer0",
          "peer1"
        ]
      }

Improve supportedFabricVersions config

We can improve supportedFabricVersions field of generator.
Some options in newer fabric versions can be turn on by default and overwritten in config.

The same peer certificates for one org?

#!/bin/sh

peer="peer1.org1.com"
channel="my-channel2"
chaincode="chaincode1"
command='{"Args":["KVContract:get", "name"]}'

docker exec "cli.org1.com" peer chaincode invoke \
  --peerAddresses "$peer:7051" \
  --tlsRootCertFiles "/var/hyperledger/cli/crypto/peers/peer1.org1.com/tls/ca.crt" \
  -C "$channel" \
  -n "$chaincode" \
  -c "$command" \
  --waitForEvent \
  --tls \
  --cafile "/var/hyperledger/cli/crypto/daTls/msp/tlscacerts/tlsca.root.com-cert.pem" \
  2>&1

in the line with --tlsRootCertFiles we can change peer1 with peer0 and everything will work since the content of files /var/hyperledger/cli/crypto/peers/peer1.org1.com/tls/ca.crt and /var/hyperledger/cli/crypto/peers/peer0.org1.com/tls/ca.crt is the same

Create dist

  • dist script and dist command line (wget/curl + chmod)
  • docker image published
  • create logo
  • consider the license
  • consider autoupdates
  • update documentation with installation instructions
  • update documentation with logo
  • create CHANGELOG.md
  • add Fabrica to producthunt.com
  • create release

Docker-compose generation

From network-config file we should generate also :

  1. configtx.yml
  2. crypto-config.yml
  3. scripts for starting/stopping network

`base-functions.sh` more error prone implementation

functions:

  • certsGenerate
  • genesisBlockCreate
  • createChannelTx
  • createAnchorPeerUpdateTx

Run docker container to generate Fabric's artifacts. Thanks to that we can ommit installing various HLF utils in path and we always have same, stable version of cli utils.
But they all have one flaw : every error in part docker exec -it will exit container but won't remove it, so we can have dandling containers if error occurs.
Solution ideas :

  1. Like in my helper scripts
#!/bin/bash
set -e

SITE_URL=$1
PDF_NAME=$2

if [ ! -z "$SITE_URL" ] || [ ! -z "$PDF_NAME" ]; then
  echo "Downloading $SITE_URL as $PDF_NAME..."
  docker run --rm -it --user $(id -u):$(id -g) -v $(pwd):/pandoc --name pandoc1 hejwo/pandoc-web-to-pdf-util \
  pandoc --highlight-style tango --pdf-engine=xelatex -V geometry:margin=1.5cm -s -r html $SITE_URL -o $PDF_NAME
else
  echo "Usage: pdfMe http://site.to.download.com pdf-name.pdf"
fi
  1. Some kind od try { ... } finnally { ...} in bash

Use org.name or org.key to create mspId

Currentlly we're using org.key to create organization mspId's.
It's not a good option since it'sused for iteratin purposes only and with every next org it will be org1, org2 and so on.
We might want to have meaningful user input here.

Introduce Lint

Currently we have no ESLint in project, would be good to add something ;)

configtx - add better profiles support

Currently all organisations are just added to AllOrgChannel profile and then this profile is used to generate ALL channels. Why that's wrong ?

  • we have 3 organisations: org1, org2, org3
  • channel channel1 defined between org1, org2
  • org3 can just fetch & join channel1 because of AllOrgChannel used

Add `networkName` field in json

TODO:

  • .env (Docker network name)
  • remove network subdir from fabrikka-target

Won't do:

  • fabrikka-target/networkName
  • fabrikka.sh up (select network???)
  • JSON schema + validation (the field won't be added to JSON)

Raft improvements

Before Raft we assumed that Orderer will be part of root ogranization and suborganizations will not host Orderer instance.
This statement is no longer true in Raft mode. .

Check list:

  • Propose different Fabrikka's config file format to support both old and new approach
  • Organization can have Orderer hosted, but only in Raft mode.
  • We should validate the case
  • Implement new config

Test Java chaincode

add generator to create simple chaincode.
It would ease up testing + could be valuable feature for quick start with Fabric

Test `invoke` with `AND` endorsement for multiple orgs

Currently our network tests verify only invoke with endorsement policies when one of the organization is supposed to endorse (OR ('Org1MSP.member', 'Org2MSP.member')). The case when both organizations need to endorse (AND ('Org1MSP.member', 'Org2MSP.member')) is not covered, since it requires changes in the test scripts for invoke (expect-invoke.sh). In this case we need to explicitly provide --peerAdresses for peer chaincode invoke.

Rethink `networkSettings.rootCaOnly` option

rootCaOnly is kinna flacky idea.
If we have 2 orgs channel, and rootCaOnly: true only root ca will be generated and no ca's for organisations.
So organisation won't be able to properly enroll it's users (it can't be done in rootCa) and use chaincode. That's really unnecessary and confusing

No need to intstantiate chaincode on every peer?

For configuration with 2 peers in channel:

============ \U1F60B Building 'chaincode1' \U1F60B ==============

> [email protected] build /Users/jakubdzikowski/IdeaProjects/generator-fabric-network/e2e-network/test-01-simple.sh.tmpdir/chaincode-kv-node
> echo "No need to build the chaincode"

No need to build the chaincode
============ \U1F60E Installing 'chaincode1' on my-channel1/Org1/peer0 \U1F60E ==============
Installing chaincode on my-channel1...
   CHAINCODE_NAME: chaincode1 
   CHAINCODE_VERSION: 0.0.1 
   CHAINCODE_LANG: node 
   CHAINCODE_DIR_PATH: /Users/jakubdzikowski/IdeaProjects/generator-fabric-network/e2e-network/test-01-simple.sh.tmpdir/chaincode-kv-node 
   PEER_ADDRESS: peer0.org1.com:7051 
   ORDERER_URL: orderer0.root.com:7050 
   CLI_NAME: cli.org1.com 
2020-10-05 14:23:26.914 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-10-05 14:23:26.914 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Verifying if container peer0.org1.com is ready (2)...
Verifying if container peer0.org1.com is ready (3)...
Verifying if container peer0.org1.com is ready (4)...
Verifying if container peer0.org1.com is ready (5)...
Verifying if container peer0.org1.com is ready (6)...
Container peer0.org1.com is ready!
Verifying if container peer1.org1.com is ready (1)...
Verifying if container peer1.org1.com is ready (2)...
Container peer1.org1.com is ready!
jakubdzikowski@MacBook-Pro e2e-network % 2020-10-05 14:23:35.350 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
==== \U1F618 Instantiating 'chaincode1' on my-channel1/Org1/peer0 \U1F618 ====
Instantiating chaincode on my-channel1...
   CHAINCODE_NAME: chaincode1 
   CHAINCODE_VERSION: 0.0.1 
   CHAINCODE_LANG: node 
   CHAINCODE_DIR_PATH: /Users/jakubdzikowski/IdeaProjects/generator-fabric-network/e2e-network/test-01-simple.sh.tmpdir/chaincode-kv-node 
   INIT_PARAMS: {"Args":[]} 
   ENDORSEMENT: AND ('Org1.member') 
   PEER_ADDRESS: peer0.org1.com:7051 
   ORDERER_URL: orderer0.root.com:7050 
   CLI_NAME: cli.org1.com 
2020-10-05 14:23:35.666 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-10-05 14:23:35.666 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
============ \U1F60E Installing 'chaincode1' on my-channel1/Org1/peer1 \U1F60E ==============
Installing chaincode on my-channel1...
   CHAINCODE_NAME: chaincode1 
   CHAINCODE_VERSION: 0.0.1 
   CHAINCODE_LANG: node 
   CHAINCODE_DIR_PATH: /Users/jakubdzikowski/IdeaProjects/generator-fabric-network/e2e-network/test-01-simple.sh.tmpdir/chaincode-kv-node 
   PEER_ADDRESS: peer1.org1.com:7051 
   ORDERER_URL: orderer0.root.com:7050 
   CLI_NAME: cli.org1.com 
2020-10-05 14:23:54.747 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-10-05 14:23:54.747 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-10-05 14:24:03.184 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
==== \U1F618 Instantiating 'chaincode1' on my-channel1/Org1/peer1 \U1F618 ====
Instantiating chaincode on my-channel1...
   CHAINCODE_NAME: chaincode1 
   CHAINCODE_VERSION: 0.0.1 
   CHAINCODE_LANG: node 
   CHAINCODE_DIR_PATH: /Users/jakubdzikowski/IdeaProjects/generator-fabric-network/e2e-network/test-01-simple.sh.tmpdir/chaincode-kv-node 
   INIT_PARAMS: {"Args":[]} 
   ENDORSEMENT: AND ('Org1.member') 
   PEER_ADDRESS: peer1.org1.com:7051 
   ORDERER_URL: orderer0.root.com:7050 
   CLI_NAME: cli.org1.com 
2020-10-05 14:24:03.500 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-10-05 14:24:03.500 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg chaincode with name 'chaincode1' already exists

However both peers return proper instantiated chaincodes:

Get instantiated chaincodes on channel my-channel1:
Name: chaincode1, Version: 0.0.1, Path: /var/hyperledger/cli/chaincode1/, Escc: escc, Vscc: vscc

Remove `create-*` generators

Original conception was to use generator to create fabrikkaConfig.json, but we decided to change it. And base on fabrikkaConfig only

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.