Onboarding new users to Web 3 has always remained a challenge. In order to provide an excellent user experience, you need to ensure that the Web 3 integration in your app remains invisible. A great way to do this would be to create custodial wallets for your users using their email address or any userId.
This guide will show you how to create custodial wallets for your users on Base using Crossmint.
By the end, you will learn how to:
- Use Crossmint's APIs.
- Create custodial wallets for your users.
This guide will take you 10 mins to complete (approximately).
Let's get started!
Table of Contents:
Setup
In this section, you will learn how to create wallets at scale with Crossmint's API. There are two different environments, they are staging and production environments.
- Production - to operate on the blockchain’s mainnets. Operations may incur credit costs. Accessible from crossmint.com/console
- Staging - to build on blockchain’s testnets. Used for testing and free. Accessible from staging.crossmint.com/console
Note: We will be the Production environment for this guide. However, it is recommended that you use the Staging environment to familiarize yourself with the process, and then proceed to the Production environment.
Creating a Developer Account and API Key
To get started, make sure that you have a Crossmint developer account. If not, please sign up - Crossmint Console.
After that, follow these steps:
- Navigate to API Keys Section: Log into Crossmint's Console and navigate to "Developers" section and click on "API Keys".
- Choose the Type of API Key: Opt for a Server-side API Key (you can also create email wallets using a client side key).
- Select Scopes: Select scopes that determine the API key’s access level. Essential scopes include:
- "wallets.read"
- "wallets.create"
You need the scopes specified above to create wallets.
Create Custodial Wallets on Base
Now that you have everything set up, let's look at how you can create a custodial wallet on Base.
First create a Javascript code file on your computer and then paste the below boilerplate-code within that code file.
- Ensure that you replace "<your-api-key-here>" with the API key that you created earlier.
- Replace "yourEmail@email.com" with the actual email address of the user that you are trying to create the wallet for. This will create a wallet that will be associated to the email address used.
- You can also create wallets using a "userId" instead. Replace "anyUserId" with any value of userId that you want to assign to a user. This value is of String type.
After that, you can run the code file on your terminal using Node.
💡 Hint: You can run "node fileName.js" to execute the code.
After you run the code, i.e., make the API call to Crossmint's endpoint, you will receive a response.
{
chain: 'base',
publicKey: '0xYourWalletAddress'
}
The "publicKey" is the wallet address of the wallet created for your user on Base.
Conclusion
In this guide, we learned how to create wallets for your users on Base, starting with creating an API key with the appropriate scopes to creating the wallet.
And that's it! You have now learned how to create wallets for your users on Base using Crossmint.
What's Next?
If you are wondering how Crossmint has helped enterprises and brands by powering their NFT Drops, you can click on the link below to read all our Case Studies.
If you want to learn how to use the Crossmint to create and mint NFTs on Base, please read the step-by-step guide below.
Need help?
For support, please join the official Crossmint Discord Server. You can also use Crossmint Help Page for the same.