Exemplo n.º 1
0
    # Invoke chaincode with 1st peers of each org
    setup()

    # Query chaincode from the 1st peer of the 1st org after Invoke
    res = res and queryChaincode('queryObjectives', [], 'owkin',
                                 [cli.get_peer('peer1-owkin')])
    print(res)

    if res:
        print('Congratulations! The fixtures have been loaded successfully.',
              flush=True)
        call(['touch', f'{SUBSTRA_PATH}/data/log/fixtures.successful'])
    else:
        print('Loading fixtures failed.', flush=True)
        call(['touch', f'{SUBSTRA_PATH}/data/log/fixtures.fail'])


if __name__ == "__main__":
    files = glob.glob(f'{SUBSTRA_PATH}/conf/config/conf-*.json')
    files.sort(key=os.path.getmtime)
    orgs = [json.load(open(file_path, 'r')) for file_path in files]

    cli = init_cli(orgs)

    # add channel on cli if needed
    # add channel on cli
    channel_name = orgs[0]['misc']['channel_name']
    cli.new_channel(channel_name)

    run()
Exemplo n.º 2
0
        # Instantiate chaincode on peers (could be done on only one peer)
        client.instanciateChaincode()

    # Query chaincode
    if client.queryChaincodeFromPeers() == '[]':
        print('Congratulations! Ledger has been correctly initialized.',
              flush=True)
        call(['touch', conf['misc']['run_success_file']])
    else:
        print('Fail to initialize ledger.', flush=True)
        call(['touch', conf['misc']['run_fail_file']])


if __name__ == "__main__":
    org_name = os.environ.get('ORG')
    substra_path = os.environ.get('SUBSTRA_PATH')

    print(os.path.join(substra_path, 'conf/config', f'conf-{org_name}.json'))

    conf = json.load(
        open(
            os.path.join(substra_path, 'conf/config', f'conf-{org_name}.json'),
            'r'))
    conf_orderer = json.load(
        open(os.path.join(substra_path, 'conf/config', f'conf-orderer.json'),
             'r'))

    cli = init_cli([conf, conf_orderer])
    client = Client(cli, conf, conf_orderer)
    add_org()