I think I understand how the UTXO model works, the inputs, and outputs, etc. However, one thing I am still having a hard time still, is understanding how balance is calculated from a seed or xkeys.

If you were to create a new receiving address for each transaction, then wouldn't that mean that in order to check your entire balance you have to go through every single address that could be generated from the derivation path of your keys? If so, how would that be efficient at all?

Also, as far as I know, every node keeps a dataset of all the UTXOs. But in order to check for your balance, wouldn't you still need to check the whole dataset for every possible address you could generate?

Thanks in advance!

1 Answer 1


For hierarchical deterministic wallets this is usually solved with a "gap limit". It means that when restoring from a recovery seed (or similar backup) the wallet will start checking for addresses until it finds a long enough run (e.g. 100) of unused addresses, and then it assumes that's all there is. Conversely, the wallet should not allow you to generate more than this number of addresses ahead of use, or at least display a warning that it might later prevent the wallet from discovering your funds.

Checking if an address is unused cannot be done with the UTXO set alone, because knowing that the address doesn't have a UTXO associated with it doesn't mean it never had. You need to store the entire blockchain, preferably in a way to allow efficient lookup of transactions associated with a specific address. Most hierarchical deterministic wallets delegate this task to an external service.

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.