Create wallets
1) Create your wallet
There are three ways you can create a wallet for your user using Crossmint, depending on your preferred level of branding. Further implementation details on each below
A) Crossmint Connect | B) Partial white-label | C) Full white-label | |
---|---|---|---|
How is a wallet created? | You implement the Crossmint Connect SDK; users sign up with Crossmint | You pass user email to Crossmint via API; we return wallet address | You pass any UUID to Crossmint via API; we return wallet address |
What is the UX? | Users interact with a Crossmint sign up modal on your site | You have full UI control on your site. Must indicate ‘powered by Crossmint’ | You have full UI control on your site |
How is the user authenticated? | Via Crossmint email 2FA. You will just receive wallet address from Crossmint | You authenticate user Once authenticated, you pass email to Crossmint for wallet creation | You authenticate user Once authenticated, you pass any UUID to Crossmint for wallet creation |
What is the scope of the wallet? | All assets in a user’s Crossmint wallet. You can filter on front end to show your specific NFTs | All assets in a user’s Crossmint wallet. You can filter on front end to show your specific NFTs | Just your specific NFTs |
What is the cost? | Free | Low-cost solution | Premium, enterprise solution |
Inquire about pricing for the partial and full white label solutions here
A) Crossmint Connect
Add wallet connect-like functionality to allow users to create a wallet and authenticate into your app using their Crossmint account. See Crossmint Connect in action here.
Crossmint Connect can easily embed into your website, easily compatible with Wallet Adapters, and works across chains. Once users create a wallet via Crossmint Connect, they can give scoped permissions to your application to receive their: (1) Wallet address and (2) View the NFTs in their wallet.
Get started by downloading our Crossmint Connect SDK from Github here.
B) Partial whitelabel
Create Crossmint user accounts programmatically, via headless API. When created, these users will be able to access any NFTs both from your website and Crossmint.com. To create partial white-label wallets, follow these steps:
- Ensure that you have a Crossmint developer account. If you haven't yet, start by creating an account on our developer console. You can read more about the developer console here.
- Create API keys with Wallet API scopes. From the API keys section of the developer console, create a new API key with the following scopes: wallets.read, wallets.create, wallets:nfts.read, and wallets:nfts.transfer
- Create partial white-label wallets: Create wallets by passing the following parameters to our API:
email: Email address that should be used to create Crossmint user and wallets
chain: Chain for which wallet should be created. Options are: ethereum, polygon, BSC, solana, cardano
import fetch from 'node-fetch';
const body = {
email: "<YOUR_USERS_EMAIL>",
chain: "<TARGET_CHAIN>",
}
const response = await fetch(
`https://staging.crossmint.com/api/v1-alpha1/wallets`,
{
method: 'POST',
headers: {
'X-PROJECT-ID': '<YOUR_PROJECT_ID>',
'X-CLIENT-SECRET': '<YOUR_CLIENT_SECRET>'
},
body: JSON.stringify(body),
}
);
const wallet = await response.json();
Possible responses:
Code | User visible message | Example of successful response |
---|---|---|
201 | Return wallet address created | { publicKey: “123”, chain: “solana” } This will also return address if wallet already exists |
400 | Email is not included or is not correct format “[email protected]__” | |
400 | Chain is not specified, formatted correctly or supported (chains supported: ethereum, polygon, BSC, solana, cardano) | |
401 | Unauthorized. The API key may not exist, or does not have the proper scopes to perform this action (wallets.create) |
Implementation notes:
- In order for your users to interact with the newly created wallet, you’ll need to create UI for them. Alternatively, you can direct them to Crossmint.com, where they can manage their assets.
- If the user already had a wallet with the same <email, chain> combo, no new wallet will be created. The existing wallet will be returned instead.
- You will need to verify / authenticate email before passing to our API. We currently do not perform any email / user validation on the passed email parameter.
C) Full white-label
See Quickstart for implementation instructions!
Fetch wallet address
All three wallet creation options will return the newly created public address if successful, which you can store. If you do not want to store a user’s wallet address, you can easily fetch that wallet address on demand:
i) For Crossmint Connect and partial white-label implementations, pass the following parameters:
- email: Email address that should be used to create Crossmint user and wallets
- chain: Chain for which wallet should be created. Options are: ethereum, polygon, BSC, solana, cardano
import fetch from 'node-fetch';
const body = {
email: "<YOUR_USERS_EMAIL>",
chain: "<TARGET_CHAIN>",
}
const response = await fetch(
`https://staging.crossmint.com/api/v1-alpha1/wallets`,
{
method: 'POST',
headers: {
'X-PROJECT-ID': '<YOUR_PROJECT_ID>',
'X-CLIENT-SECRET': '<YOUR_CLIENT_SECRET>'
},
body: JSON.stringify(body),
}
);
const wallet = await response.json();
Possible responses:
Code | User visible message | Example of successful response |
---|---|---|
200 | Return wallet address created | [{ publicKey: “123”, chain: “solana” }, …] |
400 | Email is not included or is not correct format “[email protected]__” | |
401 | Unauthorized. The API key may not exist, or does not have the proper scopes to perform this action (wallets.read) | |
404 | No email exists for user | |
404 | No address exists for that user on the specified chain |
ii) For full white-label implementation, simply change the email parameter to userID. You do not need to specify chain - we’ll return all addresses a user has with the chain specified:
userID: Email address that should be used to create Crossmint user and wallets
const fetch = require('node-fetch');
const url = 'https://staging.crossmint.com/api/v1-alpha1/wallets?userId=<userID>;
const options = {
method: 'GET',
headers: {
accept: 'application/json',
'X-CLIENT-SECRET': '<YOUR_CLIENT_SECRET>',
'X-PROJECT-ID': '<YOUR_PROJECT_ID>'
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));
Updated 23 days ago