Installing and instantiating chaincode in BAF deployed Hyperledger Fabric Network¶
- Modifying configuration file
- Chaincode Operations in BAF for the deployed Hyperledger Fabric network
Hyperledger Fabric network deployed and network.yaml configuration file already set.
Modifying configuration file¶
Refer this guide for details on editing the configuration file.
network.yaml file should contain the specific
network.organizations.services.peers.chaincode section, which is consumed when the chaincode-ops playbook is run
For reference, following snippet shows that section of
--- network: .. .. organizations: - organization: name: manufacturer .. .. services: peers: - peer: name: peer0 .. chaincode: name: "chaincode_name" #This has to be replaced with the name of the chaincode version: "chaincode_version" # This has to be different than the current version maindirectory: "chaincode_main" #The main directory where chaincode is needed to be placed repository: username: "git_username" # Git Service user who has rights to check-in in all branches password: "git_password" url: "github.com/hyperledger-labs/blockchain-automation-framework.git" branch: develop path: "chaincode_src" #The path to the chaincode arguments: 'chaincode_args' #Arguments to be passed along with the chaincode parameters endorsements: "" #Endorsements (if any) provided along with the chaincode
Chaincode Operations in BAF 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 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