Subscribe to our Blog

Subscribe to Crossmint's blog to receive updates on the latest case studies, Web3 technical guides, and more.

Subscribe Crossmint Blog cover image
Rohit Ramesh profile image Rohit Ramesh

How to Create Wallets on Ethereum?

Learn how to create custodial wallets for your users on Ethereum in under 5 mins!

How to Create Wallets on Ethereum?

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 Ethereum using Crossmint.

By the end, you will learn how to:

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 and mint NFTs on scale with Crossmint's API. There are two different environments, they are staging and production environments.

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:

  1. Navigate to API Keys Section: Log into Crossmint's Console and navigate to "Developers" section and click on "API Keys".
  2. Choose the Type of API Key: Opt for a Server-side API Key (you can also create email wallets using a client side key).
  3. Select Scopes: Select scopes that determine the API key’s access level. Essential scopes include:
    1. "wallets.read"
    2. "wallets.create"

You need the scopes specified above to create NFT Collections and create NFTs.

Create Custodial Wallets on Ethereum

Now that you have everything set up, let's look at how you can create a custodial wallet on Ethereum.

First create a Javascript code file on your computer and then paste the below boilerplate-code within that code file.

const options = {
  method: "POST",
  headers: { "X-API-KEY": "<your-api-key-here>", "Content-Type": "application/json" },
  body: '{"email":"yourEmail@email.com","chain":"ethereum"}',
};

fetch("https://www.crossmint.com/api/v1-alpha1/wallets", options)
  .then((response) => response.json())
  .then((response) => console.log(response))
  .catch((err) => console.error(err));

createWallet.js

  • 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.
const options = {
  method: "POST",
  headers: { "X-API-KEY": "<your-api-key-here>", "Content-Type": "application/json" },
  body: '{"userId":"anyUserId","chain":"ethereum"}',
};

fetch("https://www.crossmint.com/api/v1-alpha1/wallets", options)
  .then((response) => response.json())
  .then((response) => console.log(response))
  .catch((err) => console.error(err));

createWallet.js

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: 'ethereum',
  publicKey: '0xyourAddress'
}

The "publicKey" is the wallet address of the wallet created for your user on Ethereum.

Conclusion

In this guide, we learned how to create wallets for your users on Ethereum, 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 Ethereum 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.

Case Studies
Access 25+ case studies, across industries, from the 30,000+ companies that have used Crossmint’s infrastructure.

If you want to learn how to use the Crossmint to create and mint NFTs on Ethereum, please read the step-by-step guide below.

How to Create and Mint NFTs on Ethereum
Learn how to create NFT Collections and mint NFTs on Ethereum in a few mins using a few simple API calls. You can also mint NFTs to an email address or a wallet address.

Need help?

For support, please join the official Crossmint Discord Server. You can also use Crossmint Help Page for the same.

Sign up developer console
Rohit Ramesh profile image Rohit Ramesh
DevRel Engineer at Crossmint