Waves icon indicating copy to clipboard operation
Waves copied to clipboard

A way to bulk generate addresses when restoring wallet.

Open Crypto2 opened this issue 4 years ago • 7 comments

When you are restoring a wallet with the RPC there isn't a way I see to regenerate all your addresses except to POST to /addresses in an endless loop that can be hours/days long.

Would be good if there was an RPC to restore up to a specified index, and maybe when you generate an address it returns in the current index as well so that could be stored for later reference.

Crypto2 avatar Feb 08 '21 22:02 Crypto2

@Crypto2 what kind of business case do you have that you need to create about million addresses per day? Why don't you want to use one of our libs or create your own to sign and broadcast transaction using lib, not node? It could be much faster if you are using a library

DrBlast avatar Mar 18 '21 10:03 DrBlast

I'm not generating millions/day, I said that's how long it takes to restore a wallet if it crashes/corrupts and you have to restore from seed and you had a bunch of addresses in the wallet.

There isn't a Waves SDK in my language so I can't use one of them.

Crypto2 avatar Mar 18 '21 14:03 Crypto2

What language do you use? I've tried to restore addresses, it took about 10ms per address.

DrBlast avatar May 18 '21 11:05 DrBlast

PHP, this is over the RPC to the internal wallet. Individual addresses are fast, it's just when you have thousands+ of them it adds up to a lot of time.

For example if you had 100,000 addresses * 10 ms = 1,000,000 ms / 60,000 (1 hour) = 16.6 hours.

Crypto2 avatar May 19 '21 04:05 Crypto2

deemru wrote a lib for php: https://github.com/deemru/WavesKit

1 hour contains 3600 seconds = 3600000 ms 1,000,000 / 3600000 = 0.27

DrBlast avatar May 25 '21 10:05 DrBlast

That doesn't really help existing systems that use the internal wallet, versus rewriting the whole integration to use a new lib. (When we did the integration Waves was super new and nothing really existed for it yet in PHP.)

I can tell you in real-world we have ~1 million addresses and even using multiple threads it took over 24 hours to regenerate the addresses even using the sequence API that supports like 100 at a time.

Crypto2 avatar May 27 '21 06:05 Crypto2

Why don't you backup wallet.dat? You can restore file with already created addresses if smth failed.

DrBlast avatar May 31 '21 09:05 DrBlast