What is the difference between "create" and "restore" Wallet operations in API V1?


#1

https://cardanodocs.com/technical/wallet/api/v1/#tag/Wallets%2Fpaths%2F~1api~1v1~1wallets%2Fpost

I might be too dumb or tired, but I can’t see the difference between Create a new or Restore an existing Wallet.
As I understand in both cases the POST body is the same (except for the operation), and the result is the same.
A Wallet is created from the given mnemonic and password.
If a wallet already exists with the same mnemonic the operation fails.

Can someone please tell me what am I missing?


#2

I assume Create doesn’t scan the blockchain to collect data about existing balances.


#3

I believe you are correct, but it takes more than 10 hours (!!!) to sync the restored wallet!
I really don’t understand why?


#4

Because, It should scan the whole blockchain for addresses that belong to your wallet and associated it with your HD Wallet

HD ( Daedalus is HD ) hierarchical deterministic, which allow you to create many addresses within a single wallet
Those addresses are perceived as wallets and has many advantages in terms of security anonymity…


#5

@ishleh Well, I really don’t know how it scans the block-chain internally. but if it does, it should be using some sort of indexer to do it.

It is unexceptionable to wait so many hours to get a list of transactions for an HD wallet.
There could be a consensus that there is a max gap limit of 20 for the derived addresses (both deposit/change)
you can derive the addresses from a given root until you get a gap of 20 addresses with no txs.

Using an explorer you can get the txs for each derived address e.g.
http://cardanoexplorer.com/api/addresses/summary/DdzFFzCqrhsrvkwAsiuNXn85KPRuR6FU1XtwzHXSTjPQPBkg1RFw7HssxdgL9dprPRaPT9EVKVJ5ajj3oMKXcxFA4771JzCd5nXJvpNs

etc…

This should not take more than a few seconds.


#6

It really depends on the computer. Daedalus syncs a wallet in ~25-30 minutes on my macbook. It also depends on number of cores, because they made it parallel. If restoration takes 10 hours - then there’s something wrong in the whole setup, or the computer processes I/O load very badly for some reason.

Do you use latest 1.3 node?


#7

Yes, I use the latest version 1.3. I also have a reasonable server power.
I am saying this processes should not even take 25-30 min. but no more than a few seconds.
Think about it.
But again, I don’t know how it syncs the wallet internally…


#8

The HD wallets structure is reworked right now. You can look into Prometheus (https://github.com/input-output-hk/rust-cardano) which already uses new address-scheme, but it’s not officially finished/released yet.

Yoroi, when released will also use new address-scheme which allows very quick restoration process. And Daedalus will support it closer to Shelley, afaik.