Bitcoinj generates receiving addresses on demand and change addresses after each transaction. So how do I list all receiving addresses ? I guess I have to deal with KeyChainGroup and BasicKeyChain. I know how to get all issued receive keys


but cannot find change keys. So where is getIssuedChangeKeys() method or if there is not such method whta is the reason. I'm trying to imagine how recovery would work if the wallet is restored from seed.

1 Answer 1


This seems to get change addresses:

public List<String> getChangeAddresses() {
    List<String> ret = new ArrayList<>();
    int issuedKeys = wallet.getActiveKeyChain().getIssuedInternalKeys();

    for (int i = 0; i < issuedKeys; i++) {
        ChildNumber childNumber = new ChildNumber(i, false);
        List<ChildNumber> childNumbers = new ArrayList<>();
        ECKey key = wallet.getKeyByPath(childNumbers);
        ret.add(new Address(params, key.getPubKeyHash()).toBase58());
    return ret;

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.