コード例 #1
0
def add_keys_and_set_quorum():
    alice_iroha = Iroha('alice@test')
    alice_cmds = [
        alice_iroha.command('AddSignatory', account_id='alice@test',
                            public_key=ic.hex_key_to_bytes(alice_public_keys[1])),
        alice_iroha.command('SetAccountQuorum', account_id='alice@test', quorum=2)
    ]
    alice_tx = alice_iroha.transaction(alice_cmds)
    ic.sign_transaction(alice_tx, alice_private_keys[0])
    send_transaction_and_print_status(alice_tx)

    bob_iroha = Iroha('bob@test')
    bob_cmds = [
        bob_iroha.command('AddSignatory', account_id='bob@test', public_key=ic.hex_key_to_bytes(bob_public_keys[1])),
        bob_iroha.command('SetAccountQuorum', account_id='bob@test', quorum=2)
    ]
    bob_tx = bob_iroha.transaction(bob_cmds)
    ic.sign_transaction(bob_tx, bob_private_keys[0])
    send_transaction_and_print_status(bob_tx)
コード例 #2
0
def create_users():
    global iroha
    init_cmds = [
        iroha.command('CreateAsset', asset_name='bitcoin', domain_id='test', precision=2),
        iroha.command('CreateAsset', asset_name='dogecoin', domain_id='test', precision=2),
        iroha.command('AddAssetQuantity', asset_id='bitcoin#test', amount='100000'),
        iroha.command('AddAssetQuantity', asset_id='dogecoin#test', amount='20000'),
        iroha.command('CreateAccount', account_name='alice', domain_id='test',
                      public_key=ic.hex_key_to_bytes(alice_public_keys[0])),
        iroha.command('CreateAccount', account_name='bob', domain_id='test',
                      public_key=ic.hex_key_to_bytes(bob_public_keys[0])),
        iroha.command('TransferAsset', src_account_id='admin@test', dest_account_id='alice@test',
                      asset_id='bitcoin#test', description='init top up', amount='100000'),
        iroha.command('TransferAsset', src_account_id='admin@test', dest_account_id='bob@test',
                      asset_id='dogecoin#test', description='init doge', amount='20000')
    ]
    init_tx = iroha.transaction(init_cmds)
    ic.sign_transaction(init_tx, admin_private_key)
    send_transaction_and_print_status(init_tx)