An embedded wallet lives inside your application. The user signs in the way they already do. The product resolves an on-chain Stellar account they can pay, receive, and sign with, no browser extension, no seed phrase, no trip to Freighter.
This guide is how to set up a Stellar wallet and create a Stellar wallet for users inside your product: an embedded, in-app wallet for developers, including mobile. It uses @cavos/kit 0.5.2. It is the how-to companion to the Stellar embedded wallet page. The chain page is the account model. This post is the install: App ID, Google / Apple / email login, the G… address before the account exists, the first sponsored execute, balance, signMessage, and React Native notes for iOS and Android. GitHub (since 0.5.0) and Telegram are optional web-only logins; Telegram needs 0.5.2. See Sign in with Telegram (Kit 0.5.2). The provider shortlist for this chain is best embedded wallets for Stellar. The cross-chain React walkthrough is how to add an embedded wallet.
Cavos, LLC is a software and SaaS company. The wallet is the main product: a hardware-isolated, non-custodial embedded wallet. Signing keys are created and used on the user’s device. Keys never leave the device in plaintext. Cavos cannot see them, sign with them, or move funds. The Stellar adapter provisions a classic G… account, not a Soroban contract account and not a Freighter connect flow.
Pricing publishes the free 1,000 wallet creates, Essential at $59/mo, and Complete at $139/mo.
Who this is for
This guide is for app developers who need to set up a Stellar wallet inside a product. It is not a consumer Stellar Android or iOS wallet from an app store, and it is not a Freighter install walkthrough.
Use this path when:
- Users should never install Freighter, paste a seed, or leave your UI.
- You want a classic
G… that exchanges, anchors, and Horizon already understand, not a Soroban contract account.
- The first on-chain step should be sponsored: Gas Sponsorship in Any Token, so the user locks no XLM to start.
- You can wrap the tree in
CavosProvider on React / Next.js, or @cavos/kit/react-native on an Expo Development Build, EAS, or bare React Native (Android API 28+, iOS 16+; a work in progress). Expo Go is not supported.
Skip this path when the user already holds a Stellar address you must connect. Cavos provisions a G… from login. It does not speak Freighter or any other extension. The fork is the next section.
Embed a G account versus connect Freighter
Set up a Stellar wallet in your app can mean two different products. Pick the one that matches who creates the account.
| Decision | Embed a classic G… (this guide) | Connect Freighter |
|----------|-----------------------------------|-------------------|
| Who creates the account | Your app, from a login the user already has | The user, in an extension they installed |
| Where they approve | Your UI | A Freighter popup you do not control |
| What they install | Nothing beyond your product | Freighter (and often a seed backup) |
| Address before Horizon | connect returns a G… while status is undeployed | The account already exists on-chain |
| First on-chain step | Sponsored execute creates the account (0 XLM cost to the user) | You request an account that already has reserves |
| Typical audience | People who should never see a wallet picker | People who already hold a Stellar wallet |
Embed when the wallet is part of sign-up. Connect Freighter when the product is a dapp among dapps and the address must be one the user already has. The two models can coexist in a product, but not in this SDK: Cavos does the embed path only. The UX comparison is embedded wallet vs browser extension. Provider rows for this chain are best embedded wallets for Stellar.
How to set up and create a Stellar wallet
This is the developer path, not a consumer Stellar Android wallet from an app store. Users never install Freighter, paste a seed, or leave your UI.
- Install
@cavos/kit 0.5.3 (React) or @cavos/kit/react-native (iOS 16+ / Android 9+, a work in progress). Numbered section 1.
- Create an app in the Cavos dashboard and copy the App ID. Numbered section 2.
- Wrap the tree in
CavosProvider with chains: ["stellar"] (native chain: "stellar" on React Native). Numbered section 3.
- Sign the user in with Google, Apple, or email. Connect returns a classic
G… before the Horizon account exists. Numbered section 4.
- Read that undeployed
G… (section 5), then create() creates the on-chain account (0 XLM cost to the user), and a payment follows once it holds XLM (section 6).
Follow those five steps in order. Sections 7 and 8 cover balance, signMessage, and React Native. Do not skip the App ID: on Stellar it is what activates the gasless relayer.
Cavos ships native embedded wallets for Starknet, Solana, and Stellar. It does not ship Midnight, Aleo, Cosmos, or Sui adapters. The account model, HKDF spend key, and relayer live on the Stellar embedded wallet page. What an embedded wallet is (custody, key models, how to choose an SDK) is the embedded wallet guide.
What you are installing
@cavos/kit is a Stellar wallet SDK for apps that should never show a wallet picker. Authentication selects which user this is. The kit looks up (userId, appId, chain, network) in the registry and returns that G…, or claims a new one. The first device to register wins. A signer bound to the device authorizes transactions from inside your UI.
That is the opposite of connecting Freighter. Freighter is a browser extension the user installed. You request an account that already exists. Cavos creates a Stellar wallet for users who have never used crypto: they sign in, you get an address, you send.
Custody is separate from that UX. Some embedded wallets hold a key, split one with MPC, or delegate signing to an HSM. Cavos does not. The G… is HKDF of a MasterDEK that stays on the device. Evaluate any SDK on custody before you write the first connect.
1. Install @cavos/kit
npm install @cavos/kit@^0.5.2
The React bindings live on the same package, under @cavos/kit/react. You do not install a second library. Mobile (@cavos/kit/react-native) is a work in progress, covered in the React Native section below. Expo Go is not supported. Telegram as a hosted login needs 0.5.2; see Sign in with Telegram (Kit 0.5.2). Kits 0.5.0 and 0.5.1 still work for Google, Apple, email, and GitHub against the current enclave. 0.4.x does not.
2. Create an app and copy the App ID
Create an app in the Cavos dashboard and copy its App ID. The kit reads it in the browser as NEXT_PUBLIC_CAVOS_APP_ID. On Stellar the App ID is what activates the gasless relayer: Gas Sponsorship in Any Token. The kit relayer sponsors reserves and fee-bumps so the user holds no XLM to start.
Register every callback URL for the app in Dashboard → App → Callback URLs, one per line, matched exactly: scheme, host, path, no trailing slash, and no wildcards. OAuth rejects a redirect_uri that is not registered. Add tunnel or preview domains while developing; each one is a distinct origin.
Never change appSalt after users exist. On Stellar it is the HKDF salt for the spend key, so changing it derives a different G… that will not match the registry row.
3. Wrap the tree in CavosProvider
For UI applications, use the bindings from @cavos/kit/react. Wrap the app once. Every descendant can call useCavos().
import { CavosProvider } from "@cavos/kit/react";
export function Providers({ children }) {
return (
<CavosProvider
config={{
chains: ["stellar"],
defaultChain: "stellar",
network: "testnet",
appSalt: "my-app",
appId: process.env.NEXT_PUBLIC_CAVOS_APP_ID,
deviceApproval: "enclave",
socialRecovery: true,
}}
modal={{ appName: "My App" }}
>
{children}
</CavosProvider>
);
}
network: "testnet" resolves to stellar-testnet; "mainnet" resolves to stellar-mainnet. Passing modal={{ appName: "My App" }} mounts the hosted login modal. Omit modal if you will drive auth yourself.
deviceApproval: "enclave" (with socialRecovery) is the current multi-factor path: the G… is HKDF of the MasterDEK (cavos-ed25519-stellar-v1, salted by appSalt). deviceApproval: "passkey" is one chain, fine for a Stellar-only app, not for a shared login across Starknet, Solana, and Stellar.
If you already authenticate users (Clerk, Auth0, your own session), pass a stable userId as identity. Cavos login turns off: the modal is not mounted and login() throws. Pass null while your auth is loading and once the user signs out. Use an immutable primary key, not an email that can change. If userId changes, the registry lookup is for a different user, a different wallet.
Do not pass a Starknet paymasterApiKey on a Stellar-only config. That key is for the Starknet paymaster; a paymaster key on a chain that ignores it is a config error.
See the React and authentication docs for identity, deviceApproval, and socialRecovery.
4. Sign the user in (Google, Apple, email)
Hosted login is Google, Apple, or an enclave-verified 9-character email code. Authentication exists for one reason: to produce a stable userId (plus optional email) that the registry keys on. The login never signs transactions. That is always the device key.
import { useCavos } from "@cavos/kit/react";
function Wallet() {
const { address, isAuthenticated, walletStatus, openModal, login, logout } =
useCavos();
if (!isAuthenticated) {
return (
<>
<button onClick={openModal}>Sign in</button>
<button onClick={() => login("google")}>Continue with Google</button>
<button onClick={() => login("apple")}>Continue with Apple</button>
</>
);
}
return (
<div>
{address} · undeployed={walletStatus.isUndeployed} ·
ready={walletStatus.isReady}
</div>
);
}
openModal() opens the hosted flow. login("google") and login("apple") start OAuth. Email uses sendOtp(email) / verifyOtp(email, code):
const { sendOtp, verifyOtp } = useCavos();
await sendOtp(email);
await verifyOtp(email, code); // 9 characters, lowercase letters and digits
The Cavos recovery enclave, running in AWS Nitro, generates that code, mails it, and verifies it. A code expires after 5 minutes and allows 3 attempts. Email, Telegram, and GitHub are not available on React Native because that build cannot verify enclave attestation; use Google or Apple there.
GitHub (since 0.5.0) and Telegram are optional hosted logins on web. Telegram needs 0.5.2. Telegram on web is optional OAuth via oauth.telegram.org, not a Telegram Mini App. Email, Telegram, and GitHub are not available on React Native because that build cannot verify enclave attestation; use Google or Apple there. Default modal providers stay Google, Apple, and email. The Telegram install is Sign in with Telegram (Kit 0.5.2).
When you connect, the kit looks up the address:
(userId, appId, chain, network) → registry lookup → G…
If the registry has an entry, that address is returned. If not, this device computes a candidate G… and claims it. The registry is insert-only.
5. Read the G… before the account exists
Connect never creates the Stellar account. After login you already have a G…:
const { wallet } = useCavos();
if (wallet?.chain === "stellar") {
console.log(wallet.address); // G… available while status is "undeployed"
console.log(wallet.status); // "undeployed" | "ready" | "needs-device-approval"
}
| Status | Meaning | Can execute? |
|--------|---------|--------------|
| undeployed | Address resolved, no on-chain account yet. | Yes: call create() first. |
| ready | Account exists and this device can sign. | Yes |
| needs-device-approval | This device has no key yet. Restore the MasterDEK. | No: restore with a passkey or the enclave. |
Both undeployed and ready wallets can execute and signMessage. Only needs-device-approval blocks transactions. That status means this device holds no key yet. It is not an on-chain device list. Do not create a second wallet for the same login.
Share the G… with your backend, your UI, or a counterparty while it is still undeployed. The Stellar docs call this lazy deploy: the address is real; the Horizon account is created by create().
6. Create the account, then pay
wallet.create() (@cavos/kit 0.5.3) is the on-chain create. Connect already returned a G…. Horizon does not have the account yet. You never call CreateAccount yourself.
What create() and the payment do:
- If status is
undeployed, the kit creates the account first (sponsored, 0 XLM cost to the user). The relayer is the transaction source and fee payer. CreateAccount starts at 0 XLM plus Cavos cv: data. The relayer is not drained into the new account.
- Native XLM cannot ride that create: the account has to exist before it can send, and a 0-balance create holds no stroops to move. Share the
G…, fund it, then call execute. An execute on an undeployed account also creates it, but its payment fails with op_underfunded until XLM arrives.
- After that, status is
ready. Later execute calls are ordinary native XLM payments.
Narrow on wallet.chain === "stellar" so TypeScript exposes the Stellar methods. In React, call wallet.execute on the Stellar handle; the context execute is Starknet-only.
const { wallet } = useCavos();
if (wallet?.status === "needs-device-approval") {
throw new Error("This device has no key yet. Restore the MasterDEK.");
}
if (wallet?.chain === "stellar") {
await wallet.create(); // sponsored CreateAccount with 0 XLM; no-op once ready
const hash = await wallet.execute(
10_000_000n, // 1 XLM, in stroops; the account must hold it
"GDESTINATION...ADDRESS",
);
}
create() creates the account (sponsored, 0 XLM cost to the user) and sends nothing; after it, status is ready. The payment then moves XLM the account holds, so fund the G… between the two calls. execute(amount, destination) moves amount stroops of native XLM out of the account.
The relayer’s create path is a 0-balance CreateAccount plus Cavos cv: data. The relayer is not drained into the new account. The user pays no reserve and no fee for that create. The payment that follows still moves stroops the account holds, which is why the chain page says share the G…, fund it, then execute.
Pass { sponsored: false } to submit directly from the account’s own XLM instead of the relayer:
await wallet.execute(10_000_000n, destination, { sponsored: false });
Without an App ID, a funded stellarSourceKeypair can fund reserves and pay fees. The App ID path is the one this tutorial uses.
Imperative connect, if you are not using the provider:
import { Cavos } from "@cavos/kit";
const session = await Cavos.connect({
chains: ["stellar"],
defaultChain: "stellar",
network: "testnet",
appSalt: "my-app",
identity,
appId: process.env.NEXT_PUBLIC_CAVOS_APP_ID,
});
const wallet = session.wallet("stellar");
network: "testnet" is the right default until you have sponsorship limits and callback URLs for production. See wallet actions for amounts and Stellar for the adapter.
7. Balance and signMessage
Native balance is stroops, as a bigint:
if (wallet?.chain === "stellar") {
const stroops = await wallet.balance(); // bigint, native XLM
const xlm = Number(stroops) / 10_000_000;
}
signMessage works on both undeployed and ready wallets: the control key exists at connect time, before Horizon has the account:
const sig = await wallet.signMessage("Hello, Cavos!");
// sig.signature: Uint8Array
// sig.publicKey: "G..." (control key's G address)
// sig.curve: "ed25519"
The message is prefixed with Cavos Signed Message:\n<len>\n before signing. Reconstruct that prefix with prefixedMessageBytes from @cavos/kit before verifying. A verifier calls Keypair.fromPublicKey(controlAddress).verify(messageBytes, signature), standard ed25519 math. Nothing is submitted; no fee is paid.
How keys, recovery, and the relayer work
The spend key is one Ed25519 key derived via HKDF from the MasterDEK (cavos-ed25519-stellar-v1, salted by appSalt). In the browser that control key is a non-extractable WebCrypto key held by the Cavos vault. React Native is a work in progress: Stellar there is not on the MasterDEK path yet. The SDK does not enforce non-extractability on Node or other server runtimes.
A new device restores the MasterDEK and derives the same key. There is no on-chain device-signer list, and there is no on-chain social recovery.
After login, call enrollPasskeyDefault(). Signing up never prompts. The passkey stores an encrypted copy of the MasterDEK; it is not 2FA. Anyone with that synced passkey can open the wallet.
Hardware-isolated recovery is opt-in per environment. When it is on, signing in again with Google, Apple, or an enclave-verified email code unwraps the same DEK. Restore paths are another signed-in device, a passkey, and that opt-in enclave. If every device and every restore factor is gone, Cavos cannot recover the wallet.
The relayer is only a fee payer and reserve sponsor, never a custodian or identity authority. Every Stellar account locks XLM reserves (a base reserve plus about 0.5 XLM per subentry). With the relayer those reserves and all fees are sponsored, so the user locks no XLM. A bad or absent relayer can cost fees; it cannot move funds or squat an address. Signing stays on the device.
See recovery and hardware-isolated recovery.
8. React Native notes
React Native is a work in progress and not production-ready. Use @cavos/kit/react-native with Expo Development Builds, EAS, or bare React Native. Expo Go is not supported: custom native modules require a development build. Minimum platforms are iOS 16 and Android 9 (API 28). Email, Telegram, and GitHub are not available on React Native because that build cannot verify enclave attestation; use Google or Apple. Telegram is web only (OAuth via oauth.telegram.org, not a Telegram Mini App).
The native provider keeps the same configuration shape, with native-only redirectUri, rpId, and minimumKeySecurity. The chain field is singular (chain, not chains):
import { CavosProvider } from "@cavos/kit/react-native";
export function Providers({ children }) {
return (
<CavosProvider
config={{
appId: process.env.EXPO_PUBLIC_CAVOS_APP_ID,
appSalt: "my-app",
chain: "stellar",
network: "testnet",
redirectUri: "myapp://auth",
rpId: "auth.example.com",
minimumKeySecurity: "os-protected",
}}
>
{children}
</CavosProvider>
);
}
Register the exact redirectUri in Callback URLs. Import @cavos/kit/react-native before any chain entrypoint so the Hermes polyfills run first; a missing shim shows up as crypto.getRandomValues must be defined or a relayer rejection for invalid Stellar XDR. Full setup is in the React Native docs.
Beyond the first payment
The same G… is a real Stellar signer. After status === "ready" you can:
invokeContract({ contractId, method, args }): simulate, re-sign only this account’s Soroban auth entry, submit (sponsored by default).
addTrustline({ code, issuer }) / tokenBalance({ code, issuer }): classic assets such as USDC. A trustline adds a subentry (reserve), sponsored by default.
signXdr(unsignedXdr): sign an unsigned envelope without submitting it.
invokeContract and addTrustline require a deployed account. Call create() first on a new account. Paying reserves in a held token (USDC, not sponsored XLM) is a separate package, @cavos/reserve, signed with wallet.signXdr.
If you also configure Starknet on the same login, that adapter uses an audited OpenZeppelin account contract, not a Cavos-written one. Each chain still has its own address.
What to read next
- Best embedded wallets for Stellar: providers with native Stellar wallets compared on custody, fees, and pricing.
- Embedded Stellar wallet: classic
G…, HKDF, relayer, Soroban.
- embedded wallet, embedded wallets, and the embedded wallet SDK: custody, key models, and how to choose.
- Best embedded wallet: chain first, then custody, then connect versus provision.
- Embedded wallet vs smart wallet: contract account versus in-app UX.
- How to add an embedded wallet to Next.js: App Router client boundary.
- Wallet-as-a-service: platform parts, pricing models, and build versus buy.
- How to add an embedded wallet to a React app: the same kit across Starknet, Solana, and Stellar.
- Embedded wallet payments: USDC trustlines,
@cavos/reserve, and Gas Sponsorship in Any Token.
- Embedded wallet API: auth, create, keys, signing, gas, and recovery.
- Embedded wallet vs browser extension: why Freighter stays out of the first-run path.
- Stellar adapter, quickstart, and wallet actions.
- What is an embedded wallet?: the plain definition, how it works, and who holds the key.
- Pricing for the free 1,000 creates and paid recovery options.
- Sign in with Telegram (Kit 0.5.2): optional web-only Telegram login on
@cavos/kit 0.5.2. GitHub login shipped in 0.5.0.