2

I configured bitcoinj library so I can connect to network, replay blockchain, create addresses, receive and send bitcoins. I using FullPrunedDatabase as block store.

I'm still missing how to find all transaction in this wallet. I'm also interested how to compute confirmed and unconfirmed balance on single address. I know this one was asked here before,How to get balance from a specific address in bitcoinj?, but I cannot figure out how to use CoinSelector

Pavel Niedoba
  • 556
  • 1
  • 4
  • 16

2 Answers2

1

Use Wallet.getTransactions(boolean). This returns a Set<Transaction>:

boolean includeDeadTransactions = true;
Set<Transaction> transactions = wallet.getTransactions(includeDeadTransactions);

for (Transaction t : transactions) {
    //Do something
}
Ander Acosta
  • 412
  • 3
  • 12
  • Thanks, I have already found transaction hash map on wallet class, so i can get the list. BTW. now I'm trying to get list of change addresses which seems to be more difficult, because of protected and private access. Iwill create new question. – Pavel Niedoba Feb 23 '16 at 01:35
0

simply use wallet.getTransactionsByTime() to get all transactions list of the bitcoin wallet in bitcoinj in Java (works well in bitcoinj 0.15.6). Sample code:

appKit = new WalletAppKit(params, new File("./wallet"), "client-testnet") {
    @Override
    protected List<WalletExtension> provideWalletExtensions() {
        return ImmutableList.<WalletExtension>of(new StoredPaymentChannelClientStates(wallet()));
            }
};          
appKit.wallet().getTransactionsByTime();
Abhishek
  • 101