So I'm developing a system that generates addresses for users to send bitcoins too in order for them to deposit on the system.

I generate addresses using the following:

var derivedPubKey = config.BIP32_DERIVED;
if (!derivedPubKey)
    throw new Error('Must set env var BIP32_DERIVED_KEY');

var hdNode = bitcoinjs.HDNode.fromBase58(derivedPubKey);

exports.deriveAddress = function(index) {
    return hdNode.derive(index).keyPair.getAddress().toString();

An example address this generated was: 17fPG6yJujgzysrAozHM5FTEytBvWzF2gS

However, I checked my main wallet address 1CGM9zBt885ccKg6j1aqbBESsdPju4aj2m and I don't see the transaction that I sent to the address above?

How can I access these funds?

1 Answer 1


An address is not a wallet, and a HD wallet is only locally relevant to your storage and is not reflected at all in the public ledger.

Bitcoin works on a UTXO model where funds are paid to an output which can be spent by the owner of the private key for a given address. There is no direct links between any addresses and no hierarchical structure in the public ledger.

So if you pay to address 17fPG6yJujgzysrAozHM5FTEytBvWzF2gS, then the public ledger will only see the payment to that address, and nobody else will have any idea that address 1CGM9zBt885ccKg6j1aqbBESsdPju4aj2m is even part of the same wallet.

A wallet is simply a collection of key pairs, where each key pair has an address for its public part. BIP32 describes a method of deterministically generating addresses from a root seed, so that you may regenerate the addresses rather than have to store them individually.

To access the funds spent to 17fPG6yJujgzysrAozHM5FTEytBvWzF2gS, you need to regenerate the key pair for this address by using the same index you used to derive it in the first place.

Locally, a wallet software will be able to aggregate the funds from all of the addresses it generates, so it appears as though there is an aggregated total balance for the wallet, but in the public ledger, these UTXOs are scattered and uncorrelated. Only you will know your actual balance, and nobody can learn it from public information, although some of your addresses may become linked if you have to spend several of them in the same transaction.

  • Thankyou for such a thorough response! how would I go about for example, generating keys using bitcoin-cli for an index of 1?
    – Curtis
    Commented Nov 28, 2019 at 21:02
  • You should probably ask a separate question for that. As far as I know, by convention wallets will perform a search beginning at index 0, and will continue searching until they find 20 consecutive addresses which have not been used.
    – Mark H
    Commented Nov 28, 2019 at 21:05

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.