Skip to content

Installing and instantiating chaincode in Bevel deployed Hyperledger Fabric Network

Pre-requisites

Hyperledger Fabric network deployed and network.yaml configuration file already set.

Modifying configuration file

Refer this guide for details on editing the configuration file.

The network.yaml file should contain the specific network.organizations.services.peers.chaincodes section, which is consumed when the chaincode-ops playbook is run

For reference, following snippet shows that section of network.yaml

        - orderer:
          name: orderer2
          type: orderer
          consensus: raft
          grpc:
            port: 7050
          ordererAddress: orderer2.supplychain-net.org1proxy.hlf.blockchaincloudpoc-develop.com:443
        - orderer:
      ..
      ..
      country: CH
      fabric_console: enabled               # To deploy Fabric console for this organization
      ca_data:
        certificate: /path/manufacturer/server.crt

      cloud_provider: aws   # Options: aws, azure, gcp, digitalocean, minikube
      aws:
        access_key: "aws_access_key"        # AWS Access key, only used when cloud_provider=aws
        secret_key: "aws_secret_key"        # AWS Secret key, only used when cloud_provider=aws

      # Kubernetes cluster deployment variables. The config file path and name has to be provided in case
      # the cluster has already been created.
      k8s:
        region: "cluster_region"
        context: "cluster_context"
        config_file: "cluster_config"

      # Hashicorp Vault server address and root-token. Vault should be unsealed.
      # Do not check-in root_token
      vault:
        url: "vault_addr"
        root_token: "vault_root_token"
        secret_path: "secretsv2"
      # Git Repo details which will be used by GitOps/Flux.
      # Do not check-in git_access_token
      gitops:
        git_protocol: "https" # Option for git over https or ssh
        git_url: "https://github.com/<username>/bevel.git"         # Gitops https or ssh url for flux value files 
        branch: "develop"           # Git branch where release is being made
        release_dir: "platforms/hyperledger-fabric/releases/dev" # Relative Path in the Git repo for flux sync per environment.
        component_dir: "platforms/hyperledger-fabric/releases/k8sComponent" # Relative path where values files are stored. 
        chart_source: "platforms/hyperledger-fabric/charts"     # Relative Path where the Helm charts are stored in Git repo
        git_repo: "github.com/<username>/bevel.git"   # Gitops git repository URL for git push  (without https://)
        username: "git_username"          # Git Service user who has rights to check-in in all branches
        password: "git_access_token"          # Git Server user password/token (Optional for ssh; Required for https)
        email: "git@email.com"                # Email to use in git config

Chaincode Operations in Bevel for the deployed Hyperledger Fabric network

The playbook chaincode-ops.yaml is used to install and instantiate chaincode for the existing fabric network. For Fabric v2.2 and 2.5 multiple operations such as approve, commit and invoke the chaincode are available in the same playbook. This can be done by using the following command

ansible-playbook platforms/hyperledger-fabric/configuration/chaincode-ops.yaml --extra-vars "@path-to-network.yaml"

NOTE: The same process is executed for installing and instantiating multiple chaincodes