WalletToolsETH implements IWalletTools { public MasterPrivateKeyETH getMasterPrivateKey(String seedMnemonicSeparatedBySpaces, String password, String cryptoCurrency, int standard){ if (password == null) { password = ""; } List<String> split = ImmutableList.copyOf(Splitter.on(" ").omitEmptyStrings().split(seedMnemonicSeparatedBySpaces)); DeterministicSeed seed = new DeterministicSeed(split,null,password, MnemonicCode.BIP39_STANDARDISATION_TIME_SECS); DeterministicKey masterKey = HDKeyDerivation.createMasterPrivateKey(seed.getSeedBytes()); final String prv = MasterPrivateKeyETH.serializePRV(masterKey,standard); return getMasterPrivateKey(prv,cryptoCurrency,standard); }  @Override String generateSeedMnemonicSeparatedBySpaces(); MasterPrivateKeyETH getMasterPrivateKey(String seedMnemonicSeparatedBySpaces, String password, String cryptoCurrency, int standard); @Override MasterPrivateKeyETH getMasterPrivateKey(String prv, String cryptoCurrency, int standard); @Override String getWalletAddress(IMasterPrivateKey master, String cryptoCurrency, int accountIndex, int chainIndex, int index); @Override String getWalletAddressFromAccountPUB(String accountPUB, String cryptoCurrency, int chainIndex, int index); @Override String getWalletPrivateKey(IMasterPrivateKey master, String cryptoCurrency, int accountIndex, int chainIndex, int index); @Override String getAccountPUB(IMasterPrivateKey master, String cryptoCurrency, int accountIndex); @Override String getWalletAddressFromPrivateKey(String privateKey, String cryptoCurrency); @Override ISignature sign(String privateKey, byte[] hashToSign, String cryptoCurrency); boolean isAddressValid(String address, String cryptoCurrency); @Override Classification classify(String input, String cryptoCurrencyHint); @Override Classification classify(String input); @Override Set<String> supportedCryptoCurrencies(); static byte[] sha3(byte[] message); static String encodeAddressToIBAN(byte[] addrBytes); String generateWalletPrivateKeyWithPrefix(String prefix, String cryptoCurrency); static final int XPUB; static final int XPRV; }
@Test public void getMasterPrivateKey() { Assert.assertEquals("xprv9s21ZrQH143K3vrXj7RW2pKgDjYifyseBrZjGSnxm6ik7JeSeQMn3mE7VjvfBQhMj8hBZja7cgs2EshvQQp2Akguei7WPkJiHH7CQtMs9mJ", masterPrivateKey.getPRV()); Assert.assertEquals("xpub6DAMckKDeQnkHC1RiaQ61v93RXaP5eRiFzwCRixsUDxceF2omZ3E3kGKugU5qYFyDBFNRqsDLt9H2rNZTE9z8tE8H3Fvr7Teq35FAEnexJb", masterPrivateKey.getPUB()); }