예제 #1
0
def register_contract(ledger_config, creator_keys, contract_code,
                      provisioning_service_ids, **extra_params):

    ss = create_submitter(ledger_config, pdo_signer=creator_keys)

    txnsignature = ss.register_contract(contract_code.compute_hash(),
                                        provisioning_service_ids,
                                        **extra_params)

    contract_id = putils.from_transaction_signature_to_id(txnsignature)

    return contract_id
예제 #2
0
def register_contract(ledger_config, creator_keys, contract_code,
                      provisioning_service_ids, **extra_params):

    txn_keys = keys.TransactionKeys()

    if 'wait' not in extra_params:
        extra_params['wait'] = 60

    ss = Submitter(ledger_config['LedgerURL'], key_str=txn_keys.txn_private)
    txnsignature = ss.submit_contract_registration_from_data(
        creator_keys.signing_key, creator_keys.verifying_key,
        txn_keys.txn_public,
        crypto.byte_array_to_base64(contract_code.compute_hash()),
        provisioning_service_ids, **extra_params)

    contract_id = putils.from_transaction_signature_to_id(txnsignature)

    return contract_id