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

1
  • I found get wallet.getTransaction(hash) , but still missing get all .. Commented Feb 21, 2016 at 19:38

2 Answers 2

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
}
1
  • 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. Commented Feb 23, 2016 at 1: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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.