How large can an address index be? In the use case where a sensor is frequently sending transactions, an address would need to be generated for each transaction in order to keep funds secure.
2 Answers
The Java Library uses int
as the type for the index (source code on Github).
The strict equivalent of the Java int is long int
in C, which is 2,147,483,647.
But this is only a limitation of the library. The nodes don't need to know about this, so the library could be changed to support bigger numbers, provided that wallets in other languages also support those bigger numbers. Python: sys.maxint = 9,223,372,036,854,775,807
There's also the possibility of using different seeds. Like have an algorithm generate a new seed per month.
-
So currently, an easy way to handle this would be every 2,147,483,646 send transactions, generate a new seed and move to that seed? (if you are using the Java Library)– NickCommented Dec 29, 2017 at 20:57
-
1Yes, but don't worry about it, because the PoW won't let you send more than 1 tx per 5 seconds... (if you're lucky)– Daniel FCommented Dec 29, 2017 at 21:00
-
Good point, with current hardware that would give us ~340 years worth of continuous txs. Though future hardware could potentially make this a real problem– NickCommented Dec 29, 2017 at 21:02
You can (in the practical sense) have unlimited addresses for a seed. The address index is added to the front of the seed. This means that multiple seeds with a different first character can point to the same address chain but with a different entry point. When you create a lot of addresses, you just run through a bunch of different seeds over time.
Because the amount of combinations is so big, this won’t affect security much.