Skip to content

Get the number of accounts derived for a wallet #2818

Answered by ricmoo
alex1233213 asked this question in Q&A
Discussion options

You must be logged in to vote

That is something that requires state, like a file or lock storage, which is not built into ethers as state is application and domain specific.

You will need to manually track that data somewhere that makes sense for your application.

NetaMask uses the plug-in container local storage for their purpose.

In a more generic sense, when importing a mnemonic, most software will scan a “gap” (which I think is commonly 40?). This is to find and addresses in use, searching until there are at least GAP unused addresses. This software will also not usually allow creating new unused accounts past GAP too, to ensure future imports would work as expected.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alex1233213
Comment options

Answer selected by alex1233213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants