コード例 #1
0
    # Query a chaincode
    args = ['b']
    # The response should be true if succeed
    response = loop.run_until_complete(
        cli.chaincode_query(requestor=org1_admin,
                            channel_name='businesschannel',
                            peers=['peer0.org1.example.com'],
                            args=args,
                            cc_name='example_cc'))
    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)

    # 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(
コード例 #2
0
ファイル: sample.py プロジェクト: zjcsp/fabric-sdk-py
    # Query a chaincode
    args = ['b']
    # The response should be true if succeed
    response = loop.run_until_complete(cli.chaincode_query(
        requestor=org1_admin,
        channel_name='businesschannel',
        peers=['peer0.org1.example.com'],
        args=args,
        cc_name=CC_NAME
    ))
    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):
コード例 #3
0
            data = {'message': msg}
        finally:
            print(data)

    response = loop.run_until_complete(
        cli.chaincode_query(requestor=admin_owkin,
                            channel_name='mychannel',
                            peers=['peer1-owkin'],
                            args=[],
                            cc_name='mycc',
                            cc_version='1.0',
                            fcn='queryDataManagers'))
    print(response)

    response = loop.run_until_complete(
        cli.query_installed_chaincodes(requestor=admin_owkin,
                                       peers=['peer1-owkin']))
    print(response)

    response = loop.run_until_complete(
        cli.query_channels(requestor=admin_owkin, peers=['peer1-owkin']))
    print(response)

    response = loop.run_until_complete(
        cli.query_info(requestor=admin_owkin,
                       channel_name='mychannel',
                       peers=['peer1-owkin']))
    print(response)

    dir_path = os.path.dirname(os.path.realpath(__file__))

    response = loop.run_until_complete(
コード例 #4
0
user = enroll_user(hf_client, org_name, user_name, user_password)
user = hf_client.get_user(org_name=org_name, name='Admin')

loop = asyncio.get_event_loop()

response = loop.run_until_complete(
    operations.invoke('appdevorg.beatchain.com',
                      admin_user_name,
                      admin_password,
                      constants.channel_name,
                      function='AddAppDevRecord',
                      args=["afldsfj;ls"]))

# Query Peer installed chaincodes, make sure the chaincode is installed
response = loop.run_until_complete(
    operations.invoke('appdevorg.beatchain.com',
                      admin_user_name,
                      admin_password,
                      constants.channel_name,
                      function='AddAppDevRecord',
                      args=[str(round(admin_fee_frac, 3))]))

response = loop.run_until_complete(
    hf_client.query_info(requestor=user,
                         channel_name='dud',
                         peers=[random_peer]))

response = loop.run_until_complete(
    hf_client.query_installed_chaincodes(requestor=user, peers=[random_peer]))

print(response)