コード例 #1
0
ファイル: sample.py プロジェクト: zjcsp/fabric-sdk-py
        requestor=org1_admin,
        channel_name='businesschannel',
        peers=['peer0.org1.example.com', 'peer1.org1.example.com'],
        block_hash=response.currentBlockHash
    ))
    print(response)

    # TxID is extracted from the block information
    tx_id = response.get('data').get('data')[0].get(
        'payload').get('header').get(
        'channel_header').get('tx_id')

    # Query block by txid
    response = loop.run_until_complete(cli.query_block_by_txid(
        requestor=org1_admin,
        channel_name='businesschannel',
        peers=['peer0.org1.example.com', 'peer1.org1.example.com'],
        tx_id=tx_id
    ))
    print(response)

    # Query by block number
    response = loop.run_until_complete(cli.query_block(
        requestor=org1_admin,
        channel_name='businesschannel',
        peers=['peer0.org1.example.com', 'peer1.org1.example.com'],
        block_number='0'
    ))
    print(response)

    # Query instantiated chaincodes
    responses = loop.run_until_complete(cli.query_instantiated_chaincodes(
コード例 #2
0
        cli.query_block_by_hash(
            requestor=org1_admin,
            channel_name='businesschannel',
            peers=['peer0.org1.example.com', 'peer1.org1.example.com'],
            block_hash=response.currentBlockHash))
    print(response)

    # TxID is extracted from the block information
    tx_id = response.get('data').get('data')[0].get('payload').get(
        'header').get('channel_header').get('tx_id')

    # Query block by txid
    response = loop.run_until_complete(
        cli.query_block_by_txid(
            requestor=org1_admin,
            channel_name='businesschannel',
            peers=['peer0.org1.example.com', 'peer1.org1.example.com'],
            tx_id=tx_id))
    print(response)

    # Query by block number
    response = loop.run_until_complete(
        cli.query_block(
            requestor=org1_admin,
            channel_name='businesschannel',
            peers=['peer0.org1.example.com', 'peer1.org1.example.com'],
            block_number='0'))
    print(response)

    # Query instantiated chaincodes
    responses = loop.run_until_complete(