use of org.ethereum.crypto.ECKey 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();
}
use of org.ethereum.crypto.ECKey in project account-identity by cryptofiat.
the class EscrowService method createEscrowKey.
public Escrow createEscrowKey(long idCode) {
ECKey key = new ECKey();
Escrow escrow = Escrow.builder().privateKey(encUtils.encrypt(ethereumService.hex(key.getPrivKeyBytes()))).address(ethereumService.hex(key.getAddress())).idCode(idCode).build();
return escrow;
}
use of org.ethereum.crypto.ECKey in project account-identity by cryptofiat.
the class EthereumService method testSigning.
public void testSigning() throws IOException {
String addr = "65fa6548764c08c0dd77495b33ed302d0c212691";
ECKey signer = ECKey.fromPrivate(Hex.decode(without0x("0xc33d80b3fddd6bc5d62498905b90c94cf1252ffd846def3b530acd803bbb3783")));
signDelegate(0, 3, 1, "65fa6548764c08c0dd77495b33ed302d0c212691", signer);
WalletServerAccountResponse addrDetails = wsService.getAccount(hex(signer.getAddress()));
log.info("some info about address" + addrDetails.toString());
}
use of org.ethereum.crypto.ECKey in project account-identity by cryptofiat.
the class EthereumService method activateEthereumAccount.
public String activateEthereumAccount(String accountAddress) throws IOException {
accountAddress = with0x(accountAddress);
ECKey approver = getAccountApproverKey();
String txHash = sendTransaction(approver, approveAccountFunction.encode(accountAddress));
log.info("Account " + accountAddress + " approved by " + hex(approver.getAddress()) + ". TxHash=" + txHash);
return txHash;
}
use of org.ethereum.crypto.ECKey in project account-identity by cryptofiat.
the class HDKey method deriveAddressFromKey.
public static HdAddress deriveAddressFromKey(String pubkey, int index) {
while (index < 1 << 30) {
try {
DeterministicKey master = DeterministicKey.deserializeB58(null, pubkey, MainNetParams.get());
DeterministicKey child = HDKeyDerivation.deriveChildKey(master, index);
ECKey childkey = ECKey.fromPublicOnly(child.getPubKey());
HdAddress address = new HdAddress(index, "0x".concat(org.spongycastle.util.encoders.Hex.toHexString(childkey.getAddress())));
return address;
} catch (HDDerivationException e) {
index++;
}
}
throw new RuntimeException("Couldn't generate HD Key after max tries");
}
Aggregations