How to get list of all transactions in bitcoinj wallet?

1

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

Posted 2016-02-21T19:09:03.377

Reputation: 454

I found get wallet.getTransaction(hash) , but still missing get all ..Pavel Niedoba 2016-02-21T19:38:23.030

Answers

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

Posted 2016-02-21T19:09:03.377

Reputation: 372

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 2016-02-23T01:35:27.733