@Test public void walletTest() throws Exception { Context.propagate(new Context(MAINNET)); DumpedPrivateKey privKey = DumpedPrivateKey.fromBase58(MAINNET, "5Kg1gnAjaLfKiwhhPpGS3QfRg2m6awQvaj98JCZBZQ5SuS2F15C"); Address addr = LegacyAddress.fromKey(MAINNET, privKey.getKey()); assertEquals("17Wx1GQfyPTNWpQMHrTwRSMTCAonSiZx9e", addr.toString()); KeyChainGroup group = KeyChainGroup.builder(MAINNET).build(); group.importKeys(ECKey.fromPublicOnly(privKey.getKey()), ECKey.fromPublicOnly(HEX.decode("03cb219f69f1b49468bd563239a86667e74a06fcba69ac50a08a5cbc42a5808e99"))); Wallet wallet = new Wallet(MAINNET, group); wallet.commitTx(new Transaction(MAINNET, HEX.decode("01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0d038754030114062f503253482fffffffff01c05e559500000000232103cb219f69f1b49468bd563239a86667e74a06fcba69ac50a08a5cbc42a5808e99ac00000000"))); assertEquals(5, wallet.getBloomFilterElementCount()); BloomFilter filter = wallet.getBloomFilter(wallet.getBloomFilterElementCount(), 0.001, 0); assertEquals("082ae5edc8e51d4a03080000000000000002", HEX.encode(filter.unsafeBitcoinSerialize())); }
@Override public String toString() { final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this).omitNullValues(); helper.add("data length", data.length); helper.add("hashFuncs", hashFuncs); helper.add("nFlags", getUpdateFlag()); return helper.toString(); }
BloomFilter extends Message { @Override public String toString() { final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this).omitNullValues(); helper.add("data length", data.length); helper.add("hashFuncs", hashFuncs); helper.add("nFlags", getUpdateFlag()); return helper.toString(); } }
BloomFilter extends Message { @Override public String toString() { final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this).omitNullValues(); helper.add("data length", data.length); helper.add("hashFuncs", hashFuncs); helper.add("nFlags", getUpdateFlag()); return helper.toString(); } BloomFilter(NetworkParameters params, byte[] payloadBytes);  BloomFilter(int elements, double falsePositiveRate, long randomNonce);  BloomFilter(int elements, double falsePositiveRate, long randomNonce, BloomUpdate updateFlag); }
BloomFilter extends Message { @Override public String toString() { final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this).omitNullValues(); helper.add("data length", data.length); helper.add("hashFuncs", hashFuncs); helper.add("nFlags", getUpdateFlag()); return helper.toString(); } BloomFilter(NetworkParameters params, byte[] payloadBytes);  BloomFilter(int elements, double falsePositiveRate, long randomNonce);  BloomFilter(int elements, double falsePositiveRate, long randomNonce, BloomUpdate updateFlag); double getFalsePositiveRate(int elements); @Override String toString(); static int murmurHash3(byte[] data, long nTweak, int hashNum, byte[] object); synchronized boolean contains(byte[] object); synchronized void insert(byte[] object); synchronized void insert(ECKey key); synchronized void insert(TransactionOutPoint outpoint); synchronized void setMatchAll(); synchronized void merge(BloomFilter filter); synchronized boolean matchesAll(); synchronized BloomUpdate getUpdateFlag(); synchronized FilteredBlock applyAndUpdate(Block block); synchronized boolean applyAndUpdate(Transaction tx); @Override synchronized boolean equals(Object o); @Override synchronized int hashCode(); }
BloomFilter extends Message { @Override public String toString() { final MoreObjects.ToStringHelper helper = MoreObjects.toStringHelper(this).omitNullValues(); helper.add("data length", data.length); helper.add("hashFuncs", hashFuncs); helper.add("nFlags", getUpdateFlag()); return helper.toString(); } BloomFilter(NetworkParameters params, byte[] payloadBytes);  BloomFilter(int elements, double falsePositiveRate, long randomNonce);  BloomFilter(int elements, double falsePositiveRate, long randomNonce, BloomUpdate updateFlag); double getFalsePositiveRate(int elements); @Override String toString(); static int murmurHash3(byte[] data, long nTweak, int hashNum, byte[] object); synchronized boolean contains(byte[] object); synchronized void insert(byte[] object); synchronized void insert(ECKey key); synchronized void insert(TransactionOutPoint outpoint); synchronized void setMatchAll(); synchronized void merge(BloomFilter filter); synchronized boolean matchesAll(); synchronized BloomUpdate getUpdateFlag(); synchronized FilteredBlock applyAndUpdate(Block block); synchronized boolean applyAndUpdate(Transaction tx); @Override synchronized boolean equals(Object o); @Override synchronized int hashCode();  }