Skip to content
Docs
Submit bugs here.
Docs

Please submit any typos you come across to GitHub issues.


Fund the Account and make the First Deposit

In this section, we will go over the new user account creation flow between non-custodial wallets and anchors with SEP-24 and/or SEP-6 implementations. Before we dive into the flow, it’s important to understand how Stellar accounts are created in the first place.

The first step in creating a Stellar account is to generate a keypair. This keypair includes public and private keys. However, an account does not exist and does not warrant space on the ledger until it’s funded with the minimum balance of 1XLM by a Create Account operation. This requirement was created to minimize unused accounts from bloating the ledger. For a more in-depth look at this topic, check out this page.

Who creates the new user accounts?

When a new customer downloads the wallet application and goes through the deposit flow for the first time, their Stellar account can be created by either the user’s wallet application or the anchor facilitating the first deposit. This section describes the possible strategies and flows for you to consider.

Option 1: The anchor creates and funds the Stellar account

For this option, the wallet needs to allow users to initiate their first deposit without having to add an asset/establish a trustline. The wallet then prompts the user to add the trustline once funds are received by the anchor. The flow looks like this:

  1. The wallet registers a new user and issues a keypair.
  2. The wallet initiates the first deposit on behalf of the user without requiring the user to add the asset/create the trustline.
  3. The anchor provides deposit instructions to the customer.
  4. The user transfers money from a bank account to the anchor’s bank account.
  5. Once the anchor receives the transfer, the anchor creates and funds the Stellar account for the customer.
  6. The wallet detects that the account has been created and a trustline must be established.
  7. The wallet prompts the user to add the asset/create the trustline.
  8. Finally, the anchor sends the deposit funds to the user’s Stellar account.

Note: An anchor should always maintain a healthy amount of XLM in its distribution account to support new account creations. If doing so becomes unsustainable, it’s recommended that the anchor collaborates with wallets to determine a strategy based on the number of account creation requests. The recommended amount is 2XLM per user account creation (1XLM to meet the minimum balance requirement, and 1XLM for establishing trustlines and covering transaction fees).

anchor creates account flow

With the flow described above, the wallet and the anchor have to facilitate listening for and responding to the trustline status, which can create user experience frictions when waiting for the trustline to be established. To address this issue, Protocol 15 introduced Claimable Balances, which enhance the flow by allowing users to start using the wallet without having to secure XLM wait to create the trustline after they made their first deposit. Both the wallet and the anchor have to implement Claimable Balance support in order to make this flow work.

The flow with Claimable Balances looks like this:

  1. The wallet registers a new user, and generates a keypair.
  2. The wallet initiates a deposit on behalf of a user.
  3. The anchor provides deposit instructions to the wallet.
  4. The user transfers money from a bank account to the anchor’s account.
  5. The anchor creates and funds the user’s Stellar account plus the amount required for trustlines and transaction fees. Again, we suggest 2 XLM to start.
  6. The anchor creates a Claimable Balance.
  7. The wallet detects the Claimable Balance for the account, claims the funds, and posts it in the wallet.

anchor creates account claimable balance flow

Option 2: The wallet creates and funds the Stellar account upon user sign-up

For this option, the wallet creates and funds the Stellar account upon every new user sign-up with the minimum requirement of 1XLM, plus the .5XLM reserve for establishing the first trustline, plus a bit more to cover transaction fees. For more information on minimum balances, check out the glossary entry.

The flow looks like this:

  1. Upon a new user signup, the wallet issues a keypair, then creates and funds the user’s Stellar account with 2XLM.
  2. Then the wallet creates a trustline, and initiates the first deposit.
  3. Once the deposit request is sent to the anchor, the anchor provides instructions for the deposit.
  4. The customer transfer funds from a personal bank account to the anchor’s account.
  5. The anchor receives the funds, then sends them to the user’s Stellar account.
  6. The wallet detects that funds were sent and notifies the user.

wallet creates account flow

Note: In the examples above, we suggest having the anchor or wallet cover minimum balance and trustline XLM requirements by depositing funds directly into a user’s account. We made that suggestion for the sake of simplicity, but in all cases, the anchor or wallet could instead use Sponsored Reserves to ensure that when a user closes a trustline or merges their account, the reserve reverts to the sponsoring account rather than to the user’s account.

Last updated Oct. 11, 2021

Page Outline