org.bitcoinj.crypto.HDUtils Java Examples

The following examples show how to use org.bitcoinj.crypto.HDUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BisqKeyChainFactory.java    From bisq-core with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public DeterministicKeyChain makeWatchingKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicKey accountKey,
                                                  boolean isFollowingKey, boolean isMarried) throws UnreadableWalletException {
    ImmutableList<ChildNumber> accountPath = useBitcoinDeterministicKeyChain ? BtcDeterministicKeyChain.BIP44_BTC_ACCOUNT_PATH : BisqDeterministicKeyChain.BIP44_BSQ_ACCOUNT_PATH;
    if (!accountKey.getPath().equals(accountPath))
        throw new UnreadableWalletException("Expecting account key but found key with path: " +
                HDUtils.formatPath(accountKey.getPath()));
    return useBitcoinDeterministicKeyChain ? new BtcDeterministicKeyChain(accountKey, isFollowingKey) : new BisqDeterministicKeyChain(accountKey, isFollowingKey);
}
 
Example #2
Source File: GetCredentials.java    From Android-Wallet-Token-ERC20 with Apache License 2.0 5 votes vote down vote up
public Credentials FromSeed(String seedCode,
                            String passwordWallet) throws UnreadableWalletException {
    DeterministicSeed seed = new DeterministicSeed(seedCode, null, passwordWallet, 1409478661L);
    DeterministicKeyChain chain = DeterministicKeyChain.builder().seed(seed).build();
    List<ChildNumber> keyPath = HDUtils.parsePath("M/44H/60H/0H/0/0");
    DeterministicKey key = chain.getKeyByPath(keyPath, true);
    BigInteger privKey = key.getPrivKey();
    return Credentials.create(ECKeyPair.create(privKey));
}
 
Example #3
Source File: BisqKeyChainFactory.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public DeterministicKeyChain makeWatchingKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicKey accountKey,
                                                  boolean isFollowingKey, boolean isMarried) throws UnreadableWalletException {
    ImmutableList<ChildNumber> accountPath = useBitcoinDeterministicKeyChain ? BtcDeterministicKeyChain.BIP44_BTC_ACCOUNT_PATH : BisqDeterministicKeyChain.BIP44_BSQ_ACCOUNT_PATH;
    if (!accountKey.getPath().equals(accountPath))
        throw new UnreadableWalletException("Expecting account key but found key with path: " +
                HDUtils.formatPath(accountKey.getPath()));
    return useBitcoinDeterministicKeyChain ? new BtcDeterministicKeyChain(accountKey, isFollowingKey) : new BisqDeterministicKeyChain(accountKey, isFollowingKey);
}