Bitcoin Forum

Bitcoin => Armory => Topic started by: aquapurity on May 31, 2013, 05:54:02 PM



Title: How does Armory paper backup know how many addresses have been used?
Post by: aquapurity on May 31, 2013, 05:54:02 PM
I've been researching Armory and there is one question that I can't seem to find a satisfactory answer on:  How does the deterministic backup know how many addresses you've created in your wallet? 

I understand that the addresses are created deterministically, in order, but how does the client know how many of these addresses have ever been created?  Does it create the next address and then look it up in the blockchain to see if it was ever used?  If so, then what about addresses that are created by clicking on "receive funds" but then the window is cancelled... that address is never used and a new address is created the next time you click on "receive funds".  This seems to indicate that you could have an arbitrarily large sequence of never-used addresses before an address that was used and contains bitcoins.  This also seems to show that in normal daily use a wallet could contain thousands and thousands and thousands of addresses.  There also appears to be some confusion out in the world as to how this works:  the site at (http://bitcoin.stackexchange.com/questions/9828/do-i-need-to-backup-a-wallet-every-time-i-generate-a-new-address) seemed to suggest that Armory only keeps track of the first one hundred addresses and if you go beyond your backup could lose bitcoins.

This is my main confusion about the Armory deterministic backup... just how does it know how many addresses have ever been used in the wallet and how how does it deal with addresses that were created but never used?  Are all the addresses you will ever use safe in the paper backup?


For more illustration, imagine the following scenario/ thought experiment:

1.  You create a new Armory wallet and create a paper backup
2.  You create a new address for each transaction, and you go through 1,000,000 transactions
3.  You then click on "Receive Bitcoins" button and cancel 1,000 times, so now there is a series of one thousand addresses that were created but never used.
4.  You then go through another 1,000,000 transactions.
5.  When you restore from the deterministic paper backup, how does it know to look for the 2,001,000 addresses that were created?  Would you lose the last 1,000,000 addresses due the sequence of 1,000 unused addresses because they don't exist in the blockchain?  In other words, would Armory count up to 1,000,000 addresses and then encounter the sequence of 1,000 unused addresses and assume that there are no more addresses after that sequence?



I appreciate any insight as how the Armory deterministic paper backup is a true backup of every possible future transaction made in the wallet.

Thanks!



Title: Re: How does Armory paper backup know how many addresses have been used?
Post by: xxjs on July 05, 2013, 12:23:33 PM
I want to know this too.


Title: Re: How does Armory paper backup know how many addresses have been used?
Post by: picobit on July 07, 2013, 10:59:07 PM
As far as I know Armory will create 100 addresses beyond the last one having activity on the block chain before deciding that it has reached the end of the list of relevant addresses.  You can increase this number manually somewhere in the user interface (perhaps only in expert mode).


Title: Re: How does Armory paper backup know how many addresses have been used?
Post by: xxjs on July 09, 2013, 01:17:39 PM
As far as I know Armory will create 100 addresses beyond the last one having activity on the block chain before deciding that it has reached the end of the list of relevant addresses.  You can increase this number manually somewhere in the user interface (perhaps only in expert mode).


Sounds reasonable. Thanks.


Title: Re: How does Armory paper backup know how many addresses have been used?
Post by: SimonBelmond on July 12, 2013, 05:53:29 AM
I always thoght that Armory will just scann all addresses during startup and checks in which the private key fits. Then on the other hand, how would that work for a watching only wallet? Is it maybe possible to know which addresses are all deriving from the private key without knowing the private key as such?


Title: Re: How does Armory paper backup know how many addresses have been used?
Post by: TierNolan on August 07, 2013, 12:08:24 AM
I always thoght that Armory will just scann all addresses during startup and checks in which the private key fits. Then on the other hand, how would that work for a watching only wallet? Is it maybe possible to know which addresses are all deriving from the private key without knowing the private key as such?

You need the chaincode to generate the next key.

If you have a private key + chaincode, you can get the next private key.

If you have a public key + chaincode, you can get the next public key. 

A watching wallet knows the public keys and chaincode, so it can generate all the public keys.

Each key must be generated in sequence.  You have to generate the 1000th key before you can generate the 1001st key.