Overview
This feature is currently only available to customers who request access. Please reach out for access here.
Wallet PreGen is currently only available for EVM-compatible blockchains.
Use Cases
- Airdrop tokens or NFTs to users before they create an account
- Prepare wallets for onboarding campaigns
- Pre-fund wallets for new users
- Create wallets for batch user imports
- Generate wallets for rewards
API Reference
You can make the API call below to pregenerate a single wallet for a specific email address.Request Parameters
The secret API key obtained from your Magic Dashboard. Keep this secure and never expose it in client-side code.
The email address associated with the PreGen wallet. The user must authenticate with this email to claim the wallet.
Response
The Ethereum-compatible public wallet address generated for the specified email. This address can be used to send assets before the user claims the wallet.
Success (200 OK)
Error (400 Bad Request)
Error (401 Unauthorized)
Claiming a PreGen Wallet
Once a wallet has been pregenereated, the user can claim it by authenticating through your application using the same email address.1
User authenticates
The user logs in to your application using the same email address that was used to pregenerate the wallet.
JavaScript
2
Wallet is automatically claimed
Magic automatically links the PreGen wallet to the authenticated user. No additional steps required.
The user now has full access to their wallet and any assets that were sent to it.
3
Verify wallet ownership
You can verify the user’s wallet address matches the PreGen one.
JavaScript
Complete Example
Here’s a complete example of pregenerating a wallet, funding it, and having the user claim it:- Backend: Pregenerate
- Backend: Fund Wallet
- Frontend: User Claims
Node.js