Bitcoin Forum
May 23, 2019, 04:18:58 PM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How does the wallets know which addresses to recover in Hardware Wallet recovery  (Read 98 times)
johnokeefe09
Newbie
*
Offline Offline

Activity: 112
Merit: 0


View Profile
June 16, 2018, 12:10:45 AM
 #1

I have been reading the BIP32 proposal explaining how HD works but it didn't mention on any point how one wallet in one phone can recover from a simple mnemonic seed.

   1. Does it just try all possible addresses related to that seed's master key by doing the entire blockchain look up for addresses at the same time ? (This seems impractical imo).

   2. Are there standards on the max nth of address to generate from the wallet side ?

1558628338
Hero Member
*
Offline Offline

Posts: 1558628338

View Profile Personal Message (Offline)

Ignore
1558628338
Reply with quote  #2

1558628338
Report to moderator
1558628338
Hero Member
*
Offline Offline

Posts: 1558628338

View Profile Personal Message (Offline)

Ignore
1558628338
Reply with quote  #2

1558628338
Report to moderator
GET 25 FREE SPINS AT REGISTRATION
GET 100% BONUS ON FIRST DEPOSIT
PLAY NOW
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
RGBKey
Hero Member
*****
Offline Offline

Activity: 840
Merit: 629


rgbkey.github.io/pgp.txt


View Profile WWW
June 16, 2018, 01:17:44 AM
 #2

I believe they generate up to a certain amount by default, that can be configured to be larger if it's not generating all the addresses that you've used.
HCP
Legendary
*
Offline Offline

Activity: 980
Merit: 1507

<insert witty quote here>


View Profile
June 16, 2018, 04:42:58 AM
Merited by Welsh (1), HeRetiK (1)
 #3

I have been reading the BIP32 proposal explaining how HD works but it didn't mention on any point how one wallet in one phone can recover from a simple mnemonic seed.
   1. Does it just try all possible addresses related to that seed's master key by doing the entire blockchain look up for addresses at the same time ? (This seems impractical imo).
Most wallet implement what is known as the "Gap Limit" method of address generation. Essentially, they will continue to generate (and check) addresses until they have found N consecutive addresses that are "unused". In this instance, "unused" means there are no transactions to said address on the blockchain. It is generally NOT related to current balance... but to whether or not the address shows up in any transactions

For instance, imagine that our Gap Limit was 5... and we had a wallet that looked like this:
Address1 - 2 txes - Balance 0 BTC
Address2 - unused
Address3 - unused
Address4 - 1 tx - Balance 0.1 BTC
Address5 - unused
Address6 - unused
Address7 - unused
Address8 - unused
Address9 - unused
Address10 - 1 tx - Balance 0.1 BTC

With a Gap Limit of 5... during a restore... the wallet would likely stop generating addresses at Address9, and tell us we only have 0.1 BTC, as Address9 would have been the 5th address in a row with no transaction history found.

If the Gap Limit was more than 5, then during the restore, it would also find Address10 and show the full balance of 0.2 BTC.


Quote
   2. Are there standards on the max nth of address to generate from the wallet side ?
Not really... it is usually up to the wallet developer what value they use... and likely related to the wallets system of generating new addresses.

I know that, by default, Electrum uses a Gap Limit of 25 for receive addresses (and only 5 for change addresses). I believe MultiBit HD used to use a Gap Limit of 50 or 100... but MultiBit HD had this weird system where every single time you displayed the "receive" tab, it would generate a new address (regardless of whether or not you wanted a new address). So you could end up with a LOT of unused addresses and large "gaps".

It's a balancing act really... gap limit too large means a long wait for the user while the wallet generates and checks addresses during restore... gap limit too small means you might miss addresses/balance during restore.

Xynerise
Sr. Member
****
Offline Offline

Activity: 322
Merit: 293

39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD


View Profile
June 16, 2018, 04:57:47 AM
 #4

Quote
Does it just try all possible addresses related to that seed's master key by doing the entire blockchain look up for addresses at the same time ? (This seems impractical imo).
When a HD wallet syncs it generates a set of addresses from the derivation path m/k'/0/i, then it scans the blockchain for transactions related to those addresses. If there are transactions related to that address (even if the address is empty), it generates more addresses until the gap limit is reached.
The gap limit is a certain number of addresses in a row which have no transactions at all.

Quote
Are there standards on the max nth of address to generate from the wallet side ?
The default gap limit is 20.
Other wallets may have different implementations.
witch
Sr. Member
****
Offline Offline

Activity: 602
Merit: 250



View Profile
June 20, 2018, 09:50:13 PM
 #5

I have been reading the BIP32 proposal explaining how HD works but it didn't mention on any point how one wallet in one phone can recover from a simple mnemonic seed.

   1. Does it just try all possible addresses related to that seed's master key by doing the entire blockchain look up for addresses at the same time ? (This seems impractical imo).

   2. Are there standards on the max nth of address to generate from the wallet side ?


As far as I know there are standard recommendation drafts that determine how to generate it from the wallet side.

You should reach out to the support of the appropriate hardware wallet you are using, like Trezor or similar.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!