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
Danny Mulvihill profile image Danny Mulvihill

How to Create Custodial Wallets for your Users on Aptos?

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

How to Create Custodial Wallets for your Users on Aptos?

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 Aptos 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:

What is Aptos?

Aptos is a decentralized, high-performance blockchain platform designed for scalable and secure applications. It utilizes the Move programming language, which is tailored for secure and resource-efficient transaction scripting and smart contract development.

The platform adopts a novel consensus protocol, AptosBFT (Byzantine Fault Tolerance), to improve transaction throughput and reduce latency, enabling it to handle thousands of transactions per second. This protocol represents a variant of classical BFT consensus mechanisms, optimized for enhanced performance and security.

Aptos is committed to providing a user-friendly and developer-centric ecosystem. Its architecture is modular, facilitating easy upgrades and maintenance without network disruptions. The blockchain boasts several features to ensure robust security, including the formal verification of smart contracts and a flexible account model that enhances key management and recovery.

Targeting widespread adoption of decentralized applications (dApps), Aptos focuses on scalability, reliability, and upgradability. Its infrastructure supports a broad spectrum of use cases, from finance and gaming to social applications, aiming to overcome the limitations faced by earlier blockchain systems in terms of speed, scalability, and user experience. All of these benefits makes Aptos a much better choice.

Setup

In this section, you will learn how to create custodial wallets at 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 wallets.

Create Custodial Wallets on Aptos

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

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":"aptos"}',
};

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":"aptos"}',
};

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: 'aptos',
  publicKey: '0xYourWalletAddress'
}

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

Conclusion

In this guide, we learned how to create wallets for your users on Aptos, 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 Aptos 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 Aptos, please read the step-by-step guide below.

How to Create and Mint NFTs on Aptos | Crossmint Guides
Learn how to create NFT Collections and mint NFTs on Aptos in a few mins using only two simple API calls. No Move knowledge is required!

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