Search in sources :

Example 46 with Account

use of org.ethereum.core.Account in project rskj by rsksmart.

the class Wallet method addAccount.

public RskAddress addAccount(String passphrase) {
    Account account = new Account(new ECKey());
    saveAccount(account, passphrase);
    return account.getAddress();
}
Also used : Account(org.ethereum.core.Account) ECKey(org.ethereum.crypto.ECKey)

Example 47 with Account

use of org.ethereum.core.Account in project rskj by rsksmart.

the class Wallet method addAccountWithPrivateKey.

public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes, String passphrase) {
    Account account = new Account(ECKey.fromPrivate(privateKeyBytes));
    saveAccount(account, passphrase);
    return account.getAddress().getBytes();
}
Also used : Account(org.ethereum.core.Account)

Example 48 with Account

use of org.ethereum.core.Account in project rskj by rsksmart.

the class Wallet method unlockAccount.

public boolean unlockAccount(RskAddress addr, String passphrase) {
    Account account;
    synchronized (accessLock) {
        byte[] encrypted = keyDS.get(addr.getBytes());
        if (encrypted == null) {
            return false;
        }
        account = new Account(ECKey.fromPrivate(decryptAES(encrypted, passphrase.getBytes(StandardCharsets.UTF_8))));
    }
    saveAccount(account);
    return true;
}
Also used : Account(org.ethereum.core.Account)

Example 49 with Account

use of org.ethereum.core.Account in project rskj by rsksmart.

the class Wallet method addAccountWithPrivateKey.

public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes) {
    Account account = new Account(ECKey.fromPrivate(privateKeyBytes));
    synchronized (accessLock) {
        RskAddress addr = addAccount(account);
        this.initialAccounts.add(addr);
        return addr.getBytes();
    }
}
Also used : Account(org.ethereum.core.Account)

Aggregations

Account (org.ethereum.core.Account)49 Test (org.junit.Test)29 Transaction (org.ethereum.core.Transaction)20 AccountBuilder (co.rsk.test.builders.AccountBuilder)14 TransactionBuilder (co.rsk.test.builders.TransactionBuilder)10 BigInteger (java.math.BigInteger)9 World (co.rsk.test.World)8 Coin (co.rsk.core.Coin)7 DslParser (co.rsk.test.dsl.DslParser)7 WorldDslProcessor (co.rsk.test.dsl.WorldDslProcessor)7 Repository (org.ethereum.core.Repository)7 RskAddress (co.rsk.core.RskAddress)5 ECKey (org.ethereum.crypto.ECKey)4 Block (org.ethereum.core.Block)2 BlockDifficulty (co.rsk.core.BlockDifficulty)1 Nullable (javax.annotation.Nullable)1 Bloom (org.ethereum.core.Bloom)1 ImmutableTransaction (org.ethereum.core.ImmutableTransaction)1 TransactionsMessage (org.ethereum.net.eth.message.TransactionsMessage)1 JsonRpcInvalidParamException (org.ethereum.rpc.exception.JsonRpcInvalidParamException)1