Example #1
0
        cli.query_installed_chaincodes(requestor=org1_admin,
                                       peers=['peer0.org1.example.com']))
    print("Query installed chaincode.")
    print(response)

    # check if channel named "businesschannel" is already exists
    response = cli.get_channel(name="businesschannel")
    print("Channel named `businesschannel`: ", response)

    # query channels joined in by given peers
    response = loop.run_until_complete(
        cli.query_channels(requestor=org1_admin,
                           peers=['peer0.org1.example.com']))
    print("Channels: ", response)

    # query channel info of a given channel named "businesschannel"
    response = loop.run_until_complete(
        cli.query_info(requestor=org1_admin,
                       channel_name="businesschannel",
                       peers=['peer0.org1.example.com']))
    print("Channels: ", response)

    # Get channel config
    response = loop.run_until_complete(
        cli.get_channel_config(requestor=org1_admin,
                               channel_name='businesschannel',
                               peers=['peer0.org1.example.com']))
    print("Get channel config done.")
    print(response)
    ##############################################################################
Example #2
0
    ))
    print("Query chaincode done.")
    print(response)

    # Query Peer installed chaincodes
    response = loop.run_until_complete(cli.query_installed_chaincodes(
        requestor=org1_admin,
        peers=['peer0.org1.example.com']
    ))
    print("Query installed chaincode.")
    print(response)

    # Get channel config
    response = loop.run_until_complete(cli.get_channel_config(
        requestor=org1_admin,
        channel_name='businesschannel',
        peers=['peer0.org1.example.com']
    ))
    print("Get channel config done.")
    print(response)

    # Channel event hub
    def getBlocks(blocks):
        # On event complition the block is appended to the list of blocks
        def onEvent(block):
            blocks.append(block)
        # Returns an instance of the onEvent function
        return onEvent

    blocks = [] # empty list