1

I need to get private keys (ethereum/bitcoin and other currencies) from mnemonic phrases as fast as possible. At the moment I am using BitcoinJ library:

Set<BigInteger> privateKeys = new HashSet<>();
for (String mnemonic : mnemonics) {
    try {
        DeterministicSeed deterministicSeed = new DeterministicSeed(mnemonic, null, "", 0);
        DeterministicKeyChain deterministicKeyChain = DeterministicKeyChain.builder().seed(deterministicSeed).build();
        DeterministicKey deterministicKey = deterministicKeyChain.getKeyByPath(ETHEREUM_HD_PATH, true);
        privateKeys.add(deterministicKey.getPrivKey());
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

Obtaining a private key this way takes on average ~10 ms. Are there any ways to speed up this process (without using a video card)?

1
  • Generating the private key involves using a hashing function, that should take most of the time. You could try using a low-level language like C, rust or assembly.
    – Ismael
    Commented Feb 4, 2023 at 17:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.