Wallets Integration
With Mesh, you can initialize a new wallet with:
- Social login self-custody wallet (Wallet as a Service)
- CIP-30 & CIP-95 wallets (Browser Wallet)
- Cardano CLI generated keys (Mesh Wallet)
- Mnemonic phrases (Mesh Wallet)
- Private key (Mesh Wallet)
- Read only (Mesh Wallet)
Wallet as a Service
UTXOS wallet-as-a-service (WaaS) solution provide a seamless way for users to transact on-chain. Developers can integrate social logins and other familiar experiences into their applications, making onboarding fast and effortless. Users can create non-custodial wallets (the user owns the key and have full control over their digital assets) instantly without needing to manage private keys. Users can also recover their wallets and export their private keys at any time.
Wallet key management system uses Shamir’s Secret Sharing to split the private key into multiple parts. The parts are stored in different locations, such as the user’s device and encrypted in the server. Neither UTXOS nor the developer’s application has access to the user’s keys. The private key is reconstructed only on the user’s device during transaction signing, in an isolated iframe, which persists in-memory and is destroyed after the transaction is signed.
Overall, the integration with a wallet-as-a-service solution provides a self-custody wallet to end users and accelerates the time-to-market for developers.
To get started with UTXOS wallet-as-a-service, visit the UTXOS documentation. See also our UTXOS integration guide for detailed setup instructions and examples.
Browser Wallet
Browser Wallet is use for connecting, queries and performs wallet functions in accordance to CIP-30, which defines the API for dApps to communicate with the user's wallet.
To use Browser Wallet is simple, just import BrowserWallet execute the APIs, for example:
// import BrowserWallet
import { BrowserWallet } from '@meshsdk/core';
// connect to a wallet
const wallet = await BrowserWallet.enable('eternl');
// get assets in wallet
const assets = await wallet.getAssets();
| APIs | |
|---|---|
| Get installed wallets | BrowserWallet.getInstalledWallets(); |
| Connect wallet | const wallet = await BrowserWallet.enable('eternl'); |
| Get balance | const balance = await wallet.getBalance(); |
| Get change address | const changeAddress = await wallet.getChangeAddress(); |
| Get network ID | const networkId = await wallet.getNetworkId(); |
| Get reward addresses | const rewardAddresses = await wallet.getRewardAddresses(); |
| Get used addresses | const usedAddresses = await wallet.getUsedAddresses(); |
| Get unused addresses | const unusedAddresses = await wallet.getUnusedAddresses(); |
| Get UTXOs | const utxos = await wallet.getUtxos(); |
| Sign data | const addresses = await wallet.getUsedAddresses(); const signature = await wallet.signData(addresses[0], 'mesh'); |
| Sign transaction | const signedTx = await wallet.signTx(tx, partialSign?); |
| Submit transaction | const txHash = await wallet.submitTx(signedTx); |
| Get lovelace | const lovelace = await wallet.getLovelace(); |
| Get assets | const assets = await wallet.getAssets(); |
| Get policy IDs | const policyIds = await wallet.getPolicyIds(); |
| Get collection of assets | const assets = await wallet.getPolicyIdAssets('64af2...42'); |
| Get Supported Extensions | await wallet.getSupportedExtensions('eternl'); |
| Get Extensions | await wallet.getExtensions(); |
| Get DRep ID Key | await wallet.getPubDRepKey(); |
| Get Registered Pub Stake Keys | await wallet.getRegisteredPubStakeKeys(); |
Definitely do check out the Mesh Playground for live demo and full explanation.
Mesh Wallet
App Wallet is use for building transactions in your applications. You can import App Wallet with:
import { MeshWallet } from '@meshsdk/core';
Generate a new wallet
import { MeshWallet } from '@meshsdk/core';
const mnemonic = MeshWallet.brew();
Load with Cardano CLI generated keys
import { MeshWallet } from '@meshsdk/core';
const wallet = new MeshWallet({
networkId: 0,
fetcher: blockchainProvider,
submitter: blockchainProvider,
key: {
type: 'cli',
payment: '5820aaca553a7b95b38b5d9b82a5daa7a27ac8e34f3cf27152a978f4576520dd6503',
stake: '582097c458f19a3111c3b965220b1bef7d548fd75bc140a7f0a4f080e03cce604f0e',
},
});
Load with mnemonic phrases
import { MeshWallet } from '@meshsdk/core';
const wallet = new MeshWallet({
networkId: 0,
fetcher: blockchainProvider,
submitter: blockchainProvider,
key: {
type: 'mnemonic',
words: ["solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution"],
},
});
Load with private keys
import { MeshWallet } from '@meshsdk/core';
const wallet = new MeshWallet({
networkId: 0,
fetcher: blockchainProvider,
submitter: blockchainProvider,
key: {
type: 'root',
bech32: 'xprv1cqa46gk29plgkg98upclnjv5t425fcpl4rgf9mq2txdxuga7jfq5shk7np6l55nj00sl3m4syzna3uwgrwppdm0azgy9d8zahyf32s62klfyhe0ayyxkc7x92nv4s77fa0v25tufk9tnv7x6dgexe9kdz5gpeqgu',
},
});
Read only wallet
import { MeshWallet } from '@meshsdk/core';
const wallet = new MeshWallet({
networkId: 0,
fetcher: blockchainProvider,
submitter: blockchainProvider,
key: {
type: 'address',
address: 'addr_test1qpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0uafhxhu32dys6pvn6wlw8dav6cmp4pmtv7cc3yel9uu0nq93swx9',
},
});
Check out the Mesh Playground for live demo and full explanation.