public static ECKeyPair createEcKeyPair(SecureRandom random) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { KeyPair keyPair = createSecp256k1KeyPair(random); return ECKeyPair.create(keyPair); }
public static ECKeyPair create(byte[] privateKey) { return create(Numeric.toBigInt(privateKey)); }
public static Credentials create(String privateKey) { return create(ECKeyPair.create(Numeric.toBigInt(privateKey))); }
ecKeyPair = ECKeyPair.create(apiSecret1);
public static Credentials loadBip39Credentials(String password, String mnemonic) { byte[] seed = MnemonicUtils.generateSeed(mnemonic, password); return Credentials.create(ECKeyPair.create(sha256(seed))); }
/** * Generates a BIP-39 compatible Ethereum wallet. The private key for the wallet can * be calculated using following algorithm: * <pre> * Key = SHA-256(BIP_39_SEED(mnemonic, password)) * </pre> * * @param password Will be used for both wallet encryption and passphrase for BIP-39 seed * @param destinationDirectory The directory containing the wallet * @return A BIP-39 compatible Ethereum wallet * @throws CipherException if the underlying cipher is not available * @throws IOException if the destination cannot be written to */ public static Bip39Wallet generateBip39Wallet(String password, File destinationDirectory) throws CipherException, IOException { byte[] initialEntropy = new byte[16]; secureRandom.nextBytes(initialEntropy); String mnemonic = MnemonicUtils.generateMnemonic(initialEntropy); byte[] seed = MnemonicUtils.generateSeed(mnemonic, password); ECKeyPair privateKey = ECKeyPair.create(sha256(seed)); String walletFile = generateWalletFile(password, privateKey, destinationDirectory, false); return new Bip39Wallet(walletFile, mnemonic); }
return ECKeyPair.create(privateKey);
@Test public void testGenerateBip39Wallets() throws Exception { Bip39Wallet wallet = WalletUtils.generateBip39Wallet(PASSWORD, tempDir); byte[] seed = MnemonicUtils.generateSeed(wallet.getMnemonic(), PASSWORD); Credentials credentials = Credentials.create(ECKeyPair.create(sha256(seed))); assertEquals(credentials, WalletUtils.loadBip39Credentials(PASSWORD, wallet.getMnemonic())); }
private EthereumAccount(NETWORK network, byte[] privateKey, BigInteger nonce) { this(network, ECKeyPair.create(privateKey), nonce); }
@Override public void setPrivateKey(BigInteger key) { this.ecKeyPair = ECKeyPair.create(key); }
private EthereumAccount(NETWORK network, BigInteger privateKey, BigInteger nonce) { this(network, ECKeyPair.create(privateKey), nonce); }
public static ECKeyPair createEcKeyPair(SecureRandom random) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { KeyPair keyPair = createSecp256k1KeyPair(random); return ECKeyPair.create(keyPair); }
public ClaimRepositoryContract(final String contractAddress, final Web3j web3j) { super("", contractAddress, web3j, Credentials.create(ECKeyPair.create(BigInteger.ONE)), BigInteger.ONE, BigInteger.ZERO); }
public static ECKeyPair create(byte[] privateKey) { return create(Numeric.toBigInt(privateKey)); }
public TokenWhitelistPreconditionContract(final String contractAddress, final Web3j web3j) { super("", contractAddress, web3j, Credentials.create(ECKeyPair.create(BigInteger.ONE)), BigInteger.ONE, BigInteger.ZERO); }
public FundRepositoryContract(final String contractAddress, final Web3j web3j) { super("", contractAddress, web3j, Credentials.create(ECKeyPair.create(BigInteger.ONE)), BigInteger.ONE, BigInteger.ZERO); }
public static Credentials create(String privateKey) { return create(ECKeyPair.create(Numeric.toBigInt(privateKey))); }
@Override public Single<Wallet> importPrivateKey(String privateKey, String newPassword) { return Single.fromCallable(() -> { BigInteger key = new BigInteger(privateKey, PRIVATE_KEY_RADIX); ECKeyPair keypair = ECKeyPair.create(key); WalletFile walletFile = create(newPassword, keypair, N, P); return new ObjectMapper().writeValueAsString(walletFile); }).compose(upstream -> importKeystore(upstream.blockingGet(), newPassword, newPassword)); }
public EthAddress getAddress() { Credentials credentials = Credentials.create(ECKeyPair.create(privateKey)); return EthAddress.of(credentials.getAddress()); }
private WalletFile createWalletFile(List<String> words) throws MnemonicException.MnemonicLengthException, MnemonicException.MnemonicWordException, MnemonicException.MnemonicChecksumException, CipherException { byte[] seeds = MnemonicCode.INSTANCE.toEntropy(words); DeterministicKey masterPrivateKey = HDKeyDerivation.createMasterPrivateKey(seeds); DeterministicHierarchy deterministicHierarchy = new DeterministicHierarchy(masterPrivateKey); DeterministicKey child = deterministicHierarchy.deriveChild(DeterministicKeyChain.BIP44_ACCOUNT_ZERO_PATH, true, true, ChildNumber.ZERO); ECKeyPair ecKeyPair = ECKeyPair.create(child.getPrivKeyBytes()); return Wallet.createLight(PASSWORD, ecKeyPair); }