EVM Non-Custodial Wallets
Set up a non-custodial wallet in a server environment in 5 minutes
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.
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.
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:
- Create Transaction - Create your intended transaction (i.e. transfer tokens, call a contract)
- Sign Transaction - Sign the transaction with the wallet’s signer
- 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.
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 approvalspending
: Broadcasting transaction onchainsuccess
: Transaction successfully executed onchainfailed
: Transaction failed during execution