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 (Python, Node.js, etc.)

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 and wallets.read 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 smart wallet, make a POST request to the /api/v1-alpha2/wallets endpoint:

Now that your wallet is created, let’s create your first transaction:

5. Transaction Flow Overview

Smart wallet transactions follow a simple three-step process:

  1. Create Transaction - Submit your intended transaction (like transferring tokens or calling a contract)
  2. Submit Approval(s) - Sign and submit the required approval(s)
  3. Monitor Status - Once all approvals are submitted, Crossmint automatically broadcasts 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
  • Monitor the transaction status as Crossmint handles the onchain broadcast

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

6. Create a transaction

Once the smart wallet is created, you can send transactions from it, such as transferring currency, interacting with smart contracts, or purchasing items.

Make a POST request to the /api/v1-alpha2/wallets/{walletLocator}/transactions endpoint:

After creating the transaction, you’ll need to submit an approval with the required signature. See the next section for details on how to do so.

7. Sign the Approval Message

When you create a transaction, the response includes a message that needs to be signed.

{
    "approvals": {
        "pending": [
            {
                "signer": "evm-keypair:0xdeadbeef",
                "message": "0x30193ed4f46e2a538d4881bc7c05787b5c7905ef96cb61a14a45ffad4e628cd3"  // This is the message you need to sign
            }
        ]
    }
}

Use your private key to sign this message:

Or generate a signature using your private key with either Python or JavaScript:

8. Submit Transaction Approval

After signing the message, submit your approval by making a POST request to the /api/v1-alpha2/wallets/{walletLocator}/transactions/{transactionId}/approvals endpoint. Once all required approvals are submitted, Crossmint will automatically broadcast the transaction onchain.

The API will respond with the updated transaction status. If this was the final required approval, the status will be pending, showing that Crossmint is broadcasting the transaction onchain:

Response
{
    "id": "tx-b984491a-5785-43c0-8811-45d46fe6e520",
    "walletType": "evm-smart-wallet",
    "status": "pending",
    "approvals": {
        "pending": [],
        "submitted": [
            {
                "signature": "0x1234567890abcdef...",
                "submittedAt": "2024-01-01T00:00:00.000Z",
                "signer": "evm-keypair:0xdeadbeef",
                "message": "0x30193ed4f46e2a538d4881bc7c05787b5c7905ef96cb61a14a45ffad4e628cd3",
            }
        ],
    },
    "params": {
        "calls": [
            {
                "to": "0x1234567890123456789012345678901234567890",
                "value": "1000000000000000000",
                "data": "0x"
            }
        ],
        "chain": "base",
        "signer": "evm-keypair:0xdeadbeef"
    },
    "onChain": {
        "userOperation": {...userOperation details omitted for brevity},
        "userOperationHash": "0x30193ed4f46e2a538d4881bc7c05787b5c7905ef96cb61a14a45ffad4e628cd3",
    },
    "createdAt": "2024-01-01T00:00:00Z"
}

Note: No additional action is required after submitting the approval. Crossmint will automatically broadcast the transaction once all required approvals have been submitted.

9. Monitor Transaction Status

You can monitor the transaction’s status by polling the /api/v1-alpha2/wallets/{walletLocator}/transactions/{transactionId} 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