Overview

Automated, programmable control over assets and funds allows developers to set permissions, customize transactions, and support real-time interactions with ease. This is all possible through Crossmint’s server-side Smart Wallets API, which enables seamless integration of smart contract wallets into any application stack.

This quickstart demonstrates how to:

  • Create smart wallets and manage transactions from your backend, with no client-side blockchain dependencies
  • Work with any environment that can make HTTP requests

1. Create and Configure a Crossmint Project

To get started, create a developer account in the Crossmint Staging Console. Open that link, sign in, and accept the dialog to continue.

Crossmint offers two consoles: staging, for development and testing, and www, for production.

Then, navigate to project Settings > General, and change the wallet type to Smart Wallets.

2. Get an API Key

Once you log in to the console, the next step is to create an API key.

Click the “Integrate” tab, then select “API Keys” from the top menu.

Within the Server-side keys section, click the “Create new key” button in the top right. Then, select the scopes wallets.create, wallets.read, wallets.fund, wallets:balance.read, wallets:transactions.create, wallets:transactions.read, and wallets:transactions.sign under the Wallets API category and create your key.

Save this key for the next step.

3. Generate a Key Pair

Smart Wallets are controlled by one or more secrets that you hold, called the wallet “signers”.

In production, you may want to use passkeys, MPC wallets, or some other secret management service to guard these, but for the purposes of this tutorial, we will generate a key that you can guard in your computer.

4. Create Your Smart Wallet

To create a new non-custodial smart wallet, make a POST request to the Create Wallet endpoint:

5. Fund Your Wallet

Now that your wallet is created, let’s give it some funds so that you can complete your first transaction.

To do so we will call the Fund Wallet endpoint, using the wallet address returned from the previous step as the wallet locator.

This endpoint is only available in staging and only supports USDC and USDXM.

6. Get Your Wallet’s Balance

To ensure that the right amount has made it to your wallet, you call the Get Wallet Balance endpoint, just like shown above using the returned wallet locator.

7. Transaction Flow

Now that the wallet is funded, you can send transactions from it, such as transferring currency, interacting with smart contracts, or purchasing items. Custodial smart wallet transactions follow a simple three-step process:

  1. Create Transaction - Create your intended transaction (i.e. transfer tokens, call a contract)
  2. Sign Transaction - Sign the transaction with the wallet’s signer
  3. Approve Transaction - Submit the transaction onchain

Once all approvals are submitted, Crossmint will automatically broadcast the transaction onchain

Here’s a quick visualization of the flow:

The following sections will walk you through implementing each step. You’ll need to:

  • Create a transaction with your intended operation
  • Sign the approval message and submit it
  • Approve the transaction
  • Monitor the transaction status

Crossmint automatically broadcasts the transaction once all required approvals are submitted. No manual broadcasting is needed.

A. Create Transaction

Let’s send 4 USDC from your wallet to a new recipient’s address.

The first step is to prepare the transaction’s data. The script below uses Infura’s Base Sepolia RPC endpoint to generate the encoded transaction data needed to transfer 4 USDC, by constructing the transaction using Web3.py.

Now the serialized transaction data can be passed to the Create Transaction endpoint to create the transaction.

B. Sign Transaction

The transaction’s status in the response is “awaiting-approval” as the signer has not yet signed the message shown below.

"approvals": {
    "pending": [
        {
            "signer": "evm-keypair:0x6a2adD0a666479eA7E642897C84a1a2167425a0E",
            "message": "0x5c2aea33db1b1ad62e16c815dd910db33357b1a65fb7a05af46f291e00a55cee"
        }
    ],
    "submitted": []
}

To complete this step you need to sign the message returned (also referred to as “userOperationHash”) with the signer’s private key.

You can also approve the transaction by generating a signature via Python or JavaScript.

C. Approve Transaction

After signing the message, submit your approval by calling the Approve Transaction endpoint.

Once all required approvals are submitted, Crossmint will automatically broadcast the transaction onchain.

No additional action is required after submitting the approval. If this was the final required approval, the status will be pending, showing that Crossmint is broadcasting the transaction onchain

8. Monitor Transaction Status

You can monitor the transaction’s status by polling the Get Transaction endpoint.

The API will return the full transaction, including it’s status, which can be one of the following:

  • awaiting-approval: Waiting for required approvals
  • pending: Broadcasting transaction onchain
  • success: Transaction successfully executed onchain
  • failed: Transaction failed during execution