Skip to main content

Wallet Pregeneration

Pre-generated wallets are a key feature of Web3Auth, aimed at simplifying user onboarding. This functionality enables developers to generate both EOA wallet addresses and Smart Accounts (ERC-4337) for users before their first login. By providing this flexibility, you can tailor when and how users are introduced to wallet functionalities, ultimately enhancing their experience and boosting engagement.

Capabilities of Pre-generated Wallets

The ability to pre-generate wallets unlocks diverse use cases, making it seamless to integrate Web3 features into your application's user journey:

  1. Early Wallet Creation: Create wallets during the user invite or onboarding process, even before their first login, ensuring a smoother start to their Web3 experience.
  2. Deferred Login Setup: Postpone wallet access management, such as OAuth logins or passkeys, until the user is ready to perform their first on-chain transaction, reducing initial friction.
  3. Wallet Prefunding: Incentivize users by preloading wallets with token rewards for off-chain activities, enabling them to easily claim these rewards upon accessing their pre-generated wallet.
note

Access to Wallet Pregeneration is gated. You can use this feature in sapphire_devnet for free. The minimum pricing plan to use this feature in a production environment is the Scale Plan.

Pre-generate EOA Wallets

Web3Auth provides a straightforward API to facilitate the creation of pre-generated EOA wallets. You can integrate this API into your user signup flow, either after a user verifies their email or independently by supplying their email or unique identifier to the API.

warning

This API only returns the Core Kit Key wallet addresses. To use the wallet addresses with the Web3Auth SDKs, you will need to either use the useCoreKitKey flag in our PnP SDKs or use any of our Single Factor Auth SDKs

Learn more about how keys can change within different Web3Auth Products

Implementation Steps

  1. Identify Users: Determine the unique identifier or email for the user within your system. This will be the verifierId used to create the wallet.
  2. API Call: Use the provided API to submit the user's identifier. You'll need to specify parameters from the Web3Auth dashboard, specifically the Verifier Name, Web3Auth Network, and Client Id.
  3. Receive Wallet Address: The API response will include the new wallet address, ready for use by the user upon their first login.

HTTP Request

GET https://lookup.web3auth.io/lookup?verifier=w3a-google-demo&verifierId=devrel@web3auth.io&web3AuthNetwork=sapphire_mainnet&clientId=BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ&
ParameterDescriptionValue
verifierThe verifier name can be found on your Web3Auth dashboard. To learn more about verifiers, click here.
verifierIdThe verifier ID value. One of the ways to get it is via the response to the getUserInfo() method.
web3AuthNetworkName of the Web3Auth network your project is deployed on.
clientIdThe client ID for your project. This can also be found on the Web3Auth dashboard.

Edit parameters and click submit to see the response in the terminal.

Response

Pre-generate Smart Accounts

Web3Auth provides a straightforward API to facilitate the creation of pre-generated Smart Accounts. You can integrate this API into your user signup flow, either after a user verifies their email or independently by supplying their email or unique identifier to the API.

Implementation Steps

  1. Identify Users: Determine the unique identifier or email for the user within your system. This will be the verifierId used to create the wallet.
  2. API Call: Use the provided API to submit the user's identifier. You'll need to specify parameters from the Web3Auth dashboard, specifically the Verifier Name, Web3Auth Network, and Client Id.
  3. Receive Wallet Address: The API response will include the new wallet address, ready for use by the user upon their first login.

HTTP Request

GET https://lookup.web3auth.io/lookup/scw?verifier=w3a-google-demo&verifierId=devrel@web3auth.io&web3AuthNetwork=sapphire_mainnet&clientId=BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ&chainId=0x1&smartAccountType=safe&entryPointVersion=0.7&
ParameterDescriptionValue
verifierThe verifier name can be found on your Web3Auth dashboard. To learn more about verifiers, click here.
verifierIdThe verifier ID value. One of the ways to get it is via the response to the getUserInfo() method.
web3AuthNetworkName of the Web3Auth network your project is deployed on.
clientIdThe client ID for your project. This can also be found on the Web3Auth dashboard.
chainIdChain Id for the chain you want to pre-generate Smart account. The `chainId` should be hex value.
smartAccountTypeThe Smart Account provider you want to use.
entryPointVersionThe entry point version for the Smart Account. Please note, some SCW currently only work with specific entry point version (biconomy - 0.6, nexus - 0.7, trust - 0.6) so setting entryPointVersion for those SCW will have no effect.
smartAccountVersion?Smart Account version for the Smart Account Provider contract. This parameter is optional.
saltNonce?Salt nonce for the Smart Account to add randomness or predictability when the address is generated. This parameter is optional.
factoryAddress?Specifies the address of the Factory Contract. While providers typically deploy the factory contract on popular chains, you have the option to deploy your own factory contract on any chain and pass its address. This parameter is optional.

Edit parameters and click submit to see the response in the terminal.

Response