Skip to content
  • Srinivasan Muralidharan's avatar
    FAB-1547 initial create/join chain support · a93135b1
    Srinivasan Muralidharan authored
    https://jira.hyperledger.org/browse/FAB-1547
    
    With this change the fabric has basic support for create / join
    chain begun with the implementation of CSCC (configuraton system
    chaincode) in https://jira.hyperledger.org/browse/FAB-1022.
    
    Some todos remain for follow up CRs
      . docker based commands to channel-setup.md
      . CONFIGURATION_TRANSACTION validation - https://jira.hyperledger.org/browse/FAB-1639
      . further MSP integration (still uses default MSP)
      . absorption of deliver client management into gossip later - https://jira.hyperledger.org/browse/FAB-1580
      . adding specific configuration items to channel create - https://jira.hyperledger.org/browse/FAB-1642
    
    
    
    Steps to test chain create / join below. All commands assume shell
    in "fabric/" directory.
    
    Vagrant window 1 - start orderer
      cd orderer
      ORDERER_GENERAL_LOGLEVEL=debug ./orderer
    
    Vagrant window 2 - ask orderer to create a chain
      cd peer
      peer channel create -c myc1
    
      #on successful creation, a genesis block myc1.block is saved
      #in the same directory
    
    Vagrant window 3 - start the peer without **TEST_CHAINID**
                       (basically in a "chainless" mode)
    
      #to start with a clean env do "rm -rf /var/hyperledger/*"
      cd peer
      peer node start --peer-defaultchain=false
    
      #in "--peer-defaultchain=false" mode the peer has to join
      #chains to create leader and do transactions. It does not
      #have a default chain or ledger (the **TEST_CHAINID** chain)
    
    Vagrant window 4 - ask peer to join a chain
      cd peer
      peer channel join -b myc1.block
    
    At this point we can issue transactions
    
    Vagrant window 2 - deploy a chaincode to myc1
      cd peer
      peer chaincode deploy -C myc1 -n mycc -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a","100","b","200"]}'
    
      #note the use of "-C myc1"
      #wait for 10 secs or so
    
    Vagrant window 2 - query chaincode
      cd peer
      peer chaincode query -C myc1 -n mycc -c '{"Args":["query","a"]}'
    
    Change-Id: I7d1d04e8a207eb57597a1e6eb8b986e1080e7811
    Signed-off-by: default avatarSrinivasan Muralidharan <muralisr@us.ibm.com>
    a93135b1