How to generate multiple wallets for a single user with PnP Flutter SDK and firebase custom authentication

Hello, I am using web3auth flutter with firebase custom authentication.

Since this gives us the private key for a single wallet, is it possible to generate multiple wallets from the same session?

From the docs, I believe we can get the dappShare value from userInfo = await Web3AuthFlutter.getUserInfo();

Taking an example of Metamask, once we have the mnemonic, we can generate multiple wallet accounts, is this possible with web3auth flutter?

And if so, any guides on how to go about it?

Hi Dickens!

Thanks for reaching out! It sounds like you’re looking to work with multiple wallets using the PnP Flutter SDK and Firebase custom authentication.

You mentioned needing to generate multiple wallets based on the dappShare from userInfo. While you can create a single wallet using the provided private key, to enable users to add multiple wallets, you’ll likely need to generate new key pairs for each wallet.

If you have the dappShare, you might consider using it to create multiple instances of wallets with different keys. Unfortunately, Web3Auth does not natively support wallet generation from a single Firebase user through dappShare.

Here are some suggested steps you might take:

  1. Use the dappShare to authenticate the user and maintain their session.
  2. Generate new wallets as needed either using a keystore approach or by creating new keys on the client-side.

If you have specific code snippets or additional details about how you’re currently initializing Web3Auth or any other related integration, please share! That way, I can assist you better.

Best of luck with your integration, and feel free to ask if you have more questions!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

Yes, I am using PnP Flutter SDK and Firebase custom authentication to generate a user’s wallet/key pair from the idToken from firebase.

To get the session status if active or not, I am fetching the private key value with the recommended final privateKey = await Web3AuthFlutter.getPrivKey();

Just thinking out loud if there is a way I can use web3auth Pnp Flutter SDK and firebase custom authentication to generate multiple wallets for a user and enable them to switch between the generated wallets.

Hey @dickensodera9 directly you won’t be able to use the Web3Auth package to have multiple accounts. What you can do is, use the Web3Auth generated private key as an entropy to generate the 12/24 words mnemonic. For the mnemonic you can checkout this package: bip39_mnemonic | Dart package

These mnemonic can be then used to create a HD Wallet, there are lot of Dart packages which allows you to create HD Wallet. In HD Wallet you can use the account index to get a new account. Learn more about HD Wallet.

1 Like

Hi @Ayush, thank you so much for the response and suggestions. I’ll check them out.