def test_personal_importRawKey(accounts, rpc_client):
    initial_accounts = rpc_client('personal_listAccounts')

    private_key = mk_random_privkey()

    new_account = rpc_client('personal_importRawKey', [private_key, 'a-password'])
    n_new_account = normalize_address(new_account)

    assert n_new_account in {normalize_address(acct) for acct in rpc_client('personal_listAccounts')}
    assert rpc_client('personal_unlockAccount', [new_account, 'a-password']) is True
Ejemplo n.º 2
0
def test_personal_importRawKey(accounts, rpc_client):
    initial_accounts = rpc_client('personal_listAccounts')

    private_key = mk_random_privkey()

    new_account = rpc_client('personal_importRawKey',
                             [private_key, 'a-password'])
    n_new_account = normalize_address(new_account)

    assert n_new_account in {
        normalize_address(acct)
        for acct in rpc_client('personal_listAccounts')
    }
    assert rpc_client('personal_unlockAccount',
                      [new_account, 'a-password']) is True
Ejemplo n.º 3
0
def password_account(rpc_client, accounts, account_password,
                     account_private_key, account_public_key):
    from testrpc.client.utils import normalize_address
    address = rpc_client(
        'personal_importRawKey',
        [account_private_key, account_password],
    )
    assert normalize_address(address) == normalize_address(account_public_key)

    initial_balance = 1000000000000000000000  # 1,000 ether

    rpc_client('eth_sendTransaction', [{
        'from': accounts[0],
        'to': address,
        'value': initial_balance,
    }])

    assert rpc_client('eth_getBalance', [address]) == initial_balance
    return address
Ejemplo n.º 4
0
def test_eth_coinbase(accounts, rpc_client):
    result = rpc_client('eth_coinbase')
    assert normalize_address(result) == normalize_address(accounts[0])
def test_personal_listAccounts(accounts, rpc_client):
    actual = rpc_client('personal_listAccounts')
    n_actual = {normalize_address(acct) for acct in actual}
    n_expected = {normalize_address(acct) for acct in accounts}

    assert n_actual == n_expected
Ejemplo n.º 6
0
def accounts():
    from ethereum import tester
    return [normalize_address(acct) for acct in tester.accounts]
def test_personal_listAccounts(accounts, rpc_client):
    actual = rpc_client('personal_listAccounts')
    n_actual = {normalize_address(acct) for acct in actual}
    n_expected = {normalize_address(acct) for acct in accounts}

    assert n_actual == n_expected
Ejemplo n.º 8
0
def test_eth_coinbase(accounts, rpc_client):
    result = rpc_client('eth_coinbase')
    assert normalize_address(result) == normalize_address(accounts[0])