Suppose I created and published i=10 subaddresses from which 5 already received a payment.

After restoring my wallet from the 25-word seed, how would I know how many subaddresses were already generated? How could I avoid giving out the same subaddress to two different individuals? Do I need to keep track of the amount of subaddresses generated to ensure to use the i+1th subaddress after restoring from seed? (The same issue also applies to using the same wallet from multiple devices, the wallets somehow need to keep i in syn)

An option to anonymously publish the number of generated subaddresses in the blockchain would be a nice feature to avoid reusing i. This'd allow my wallet to know exactly with which i to continue.

This could work as follows: An optional transaction field (let's call it hid) could be added which allows to store up to eg 8 byte of anonymous data. Whenever creating a new subaddress, a new transaction to myself is issued including the current value of i (number of subaddresses) encrypted using a special format (or, prefix) in this field. Upon sync (eg after restoring from a seed), my wallet checks the most recent transaction whose hid field is not empty, decrypts its value, checks if it matches the special format (or, prefix) and immediately knows how many subaddresses were already generated.


When restoring a wallet from the seed, the wallet automatically expands the internal subaddress table such that it can recognize incoming transfers to new subaddresses. If you type address all, the wallet displays a list of subaddresses in use so far:

[wallet 9xLMUj]: address all
0  9xLMUjRpNfEQLoYwogkmiBg9H6XP18mJ3UJphkvhWo9SB3vwbJFSryNfVz6vJFigYwLadki17xHQG7qsxQnnZPuPC1XvpHq  Primary address (used)
1  Bh7S7kAEQmdQ8eGjnySzb7XShEZdYVScQ8FXtbXgfoQF5NkuNH5FnTSXzfehhbnrypWuwUqtbi28YFKy2aVcqy68FGUfAwk   (used)
2  BfSTksPWaf1iJLJGHtyg6DRzWERXQA1coJTJULcwh8BBZuNgvyYcG2NYaJBQnf1d9yDAXExZaJH46AGMehGJiZCv3MsR1vg   (used)
3  BYTWmE5EXGwB2HHfN2vXvkY5U8Aj5bQgQBqyk33Hf9akfN3cFTpumyNh3kFkYLtvfjgxGgwvhDDPSBy6oR8Jh4bXSrYMaMi   (used)

The (used) flag indicates that the subaddress has ever received any funds so far. You can use address new to generate a new address.

If you generated a new subaddress and gave it to someone else, but that person didn't send money to that address, then the information about you giving the address to that person doesn't get recorded in the blockchain, so it's impossible for you to recover that information from the blockchain when you restore the wallet from seed.

I don't think it's practical to make a special transaction every time you issue a new subaddress just for the sake of recording the information about your new address in the blockchain.

  • And how big can the gap be, between the used address? For example when i uses index 1-10 and than 11-999 where not used but 1000 was again. Would the restored wallet find also the funds that where send to sub-address with index 000? – onefox Apr 20 '18 at 22:51
  • 1
    That’s exactly what the parameters “subaddress-lookahead-major/minor” are designed for. For example, the default value for the subaddress lookahead minor parameter is 200, which means you’re assumed to have received funds at least once by one of the subaddresses in a range [i, i+199] for any i. In your above example, you’d have to set a much larger value to the parameter. – stoffu Apr 22 '18 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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