/** * Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given watching key. A * watching key corresponds to account zero in the recommended BIP32 key hierarchy. */ public static Wallet fromWatchingKey(NetworkParameters params, DeterministicKey watchKey) { return new Wallet(params, new KeyChainGroup(params, watchKey)); }
/** * Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given watching key. */ public static Wallet fromWatchingKey(NetworkParameters params, DeterministicKey watchKey) { return new Wallet(params, new KeyChainGroup(params, watchKey)); }
/** * Creates a wallet that tracks payments to and from the HD key hierarchy rooted by the given watching key. A * watching key corresponds to account zero in the recommended BIP32 key hierarchy. */ public static Wallet fromWatchingKey(NetworkParameters params, DeterministicKey watchKey, boolean useSegwit) { return new Wallet(params, new KeyChainGroup(params, watchKey, useSegwit)); }
/** * Creates a new, empty wallet with a randomly chosen seed and no transactions. Make sure to provide for sufficient * backup! Any keys will be derived from the seed. If you want to restore a wallet from disk instead, see * {@link #loadFromFile}. */ public Wallet(Context context) { this(context, new KeyChainGroup(context.getParams())); }
protected Wallet createWallet() { KeyChainGroup kcg; if (restoreFromSeed != null) kcg = new KeyChainGroup(params, restoreFromSeed, useSegwit); else kcg = new KeyChainGroup(params, useSegwit); if (walletFactory != null) { return walletFactory.create(params, kcg); } else { return new Wallet(params, kcg); // default } }
/** * Creates a new, empty wallet with a randomly chosen seed and no transactions. Make sure to provide for sufficient * backup! Any keys will be derived from the seed. If you want to restore a wallet from disk instead, see * {@link #loadFromFile}. */ public Wallet(Context context) { this(context, new KeyChainGroup(context.getParams())); }
protected Wallet createWallet() { KeyChainGroup kcg; if (restoreFromSeed != null) kcg = new KeyChainGroup(params, restoreFromSeed); else kcg = new KeyChainGroup(params); if (walletFactory != null) { return walletFactory.create(params, kcg); } else { return new Wallet(params, kcg); // default } }
/** * Creates a new, empty wallet with a randomly chosen seed and no transactions. Make sure to provide for sufficient * backup! Any keys will be derived from the seed. If you want to restore a wallet from disk instead, see * {@link #loadFromFile}. */ public Wallet(Context context, boolean useSegwit) { this(context, new KeyChainGroup(context.getParams(), useSegwit)); }
/** * Creates a wallet containing a given set of keys. All further keys will be derived from the oldest key. */ public static Wallet fromKeys(NetworkParameters params, List<ECKey> keys) { for (ECKey key : keys) checkArgument(!(key instanceof DeterministicKey)); KeyChainGroup group = new KeyChainGroup(params); group.importKeys(keys); return new Wallet(params, group); }
/** * Creates a wallet containing a given set of keys. All further keys will be derived from the oldest key. */ public static Wallet fromKeys(NetworkParameters params, List<ECKey> keys) { for (ECKey key : keys) checkArgument(!(key instanceof DeterministicKey)); KeyChainGroup group = new KeyChainGroup(params); group.importKeys(keys); return new Wallet(params, group); }
public BitcoinCrypto(NetworkParameters networkParameters, DeterministicSeed seed) throws Exception, NoSuchAlgorithmException { this.params = NetworkParameters.fromID(networkParameters.getId()); this.keyChainGroup = new KeyChainGroup(networkParameters, seed); Security.insertProviderAt(new BouncyCastleProvider(), 1); crashIfJCEMissing(); //this.sr = SecureRandom.getInstance("SHA1PRNG", new BouncyCastleProvider()); this.sr = SecureRandom.getInstance("SHA1PRNG"); this.keyPG = KeyPairGenerator.getInstance("ECIES", new BouncyCastleProvider()); //this.kit = initKit(seed); //this.wallet = kit.wallet(); }
public static KeyChainGroup fromProtobufEncrypted(NetworkParameters params, List<Protos.Key> keys, KeyCrypter crypter, KeyChainFactory factory, boolean useSegwit) throws UnreadableWalletException { checkNotNull(crypter); BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufEncrypted(keys, crypter, useSegwit); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, crypter, factory, useSegwit); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, crypter, useSegwit); }
public static KeyChainGroup fromProtobufEncrypted(NetworkParameters params, List<Protos.Key> keys, KeyCrypter crypter, KeyChainFactory factory) throws UnreadableWalletException { checkNotNull(crypter); BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufEncrypted(keys, crypter); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, crypter, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, crypter); }
public static KeyChainGroup fromProtobufUnencrypted(NetworkParameters params, List<Protos.Key> keys, KeyChainFactory factory) throws UnreadableWalletException { BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufUnencrypted(keys); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, null, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, null); }
public static KeyChainGroup fromProtobufUnencrypted(NetworkParameters params, List<Protos.Key> keys, KeyChainFactory factory) throws UnreadableWalletException { BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufUnencrypted(keys); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, null, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, null); }
public static KeyChainGroup fromProtobufUnencrypted(NetworkParameters params, List<Protos.Key> keys, KeyChainFactory factory) throws UnreadableWalletException { BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufUnencrypted(keys); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, null, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, null); }
public static KeyChainGroup fromProtobufUnencrypted(NetworkParameters params, List<Protos.Key> keys, KeyChainFactory factory, boolean useSegwit) throws UnreadableWalletException { BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufUnencrypted(keys, useSegwit); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, null, factory, useSegwit); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, null, useSegwit); }
@Test(expected = IllegalStateException.class) public void isWatchingNoKeys() { group = new KeyChainGroup(PARAMS); group.isWatching(); }
private KeyChainGroup createMarriedKeyChainGroup() { KeyChainGroup group = new KeyChainGroup(PARAMS); DeterministicKeyChain chain = createMarriedKeyChain(); group.addAndActivateHDChain(chain); group.setLookaheadSize(LOOKAHEAD_SIZE); group.getActiveKeyChain(); return group; }
@Test public void serializeWatching() throws Exception { group = new KeyChainGroup(PARAMS, watchingAccountKey); group.setLookaheadSize(LOOKAHEAD_SIZE); group.freshKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); group.freshKey(KeyChain.KeyPurpose.CHANGE); group.getBloomFilterElementCount(); // Force lookahead. List<Protos.Key> protoKeys1 = group.serializeToProtobuf(); assertEquals(3 + (group.getLookaheadSize() + group.getLookaheadThreshold() + 1) * 2, protoKeys1.size()); group = KeyChainGroup.fromProtobufUnencrypted(PARAMS, protoKeys1); assertEquals(3 + (group.getLookaheadSize() + group.getLookaheadThreshold() + 1) * 2, group.serializeToProtobuf().size()); }