Stellar is a self-serve distributed ledger that you can use as a backend to power all kinds of apps and services. It has built-in logic for creating accounts, signing transactions, and tracking balances, and anyone can use it to issue, store, transfer, and trade assets. Since many of those assets connect to real-world currencies, and since there are open protocols for integrating deposit and withdrawal of those assets, a Stellar-based app can take advantage of real banking rails and connect to real money.
Currently, developers use Stellar to power cross-border payment apps, currency exchanges, micropayment services, and platforms for in-game purchases, but what you build — and how you build it — is up to you. At its core, though, any app built on Stellar relies on the same basic functions: key storage, account creation, transaction signing, and queries to the Stellar database. To make things easy, and to stick with common parlance, we’ll call the part of an app that implements those core functions a wallet. This section of the docs will walk you through the process of building one.
Stellar wallets can do more than store and move assets, and they don’t have to be the end product for your users. They can be front and center in an application, or function invisibly in the background without revealing anything about Stellar to the end user. However you decide to surface the UI of the wallet, there are several basic considerations and common implementations, and the goal of this section of the docs is to cover those by showing you how to build a basic wallet UI.
It’s a step-by-step tutorial explaining how to construct a robust Stellar wallet following best practices. If you follow it to the end, you’ll have a fully functional Stellar interface, and a strong framework for continued development of your own use case.
Unlike real-world wallets, which hold real-world cash, Stellar wallets don’t hold digital cash. Not directly. Rather, they allow users to view the history and current state of the Stellar ledger, and to sign and submit transactions. Accounts, balances, and offers to buy and sell assets are kept on the ledger itself, which is shared by all the nodes that make up the network. A wallet may store references or caches to the Stellar database, but the actual record and the value it tracks are on chain.
What does this mean for the wallet we’re about to build? Good question. It means the wallet acts as a visual and interactive layer on top of Stellar rather than as an extension or storage mechanism. Our conversation moving forward will revolve around accessing Stellar and surfacing data in the network rather than “running” Stellar or storing something on our end.
A neat outflow of this is that most Stellar tools can operate almost entirely as client-side applications and services. There will certainly be server-side logic specific to your app, but the actual wallet interactions can operate openly on the client/browser.
Even though wallets can operate client-side, they deal with a user’s secret keys, which give direct access to their account, and to any value they hold in it. That’s why it’s essential to require all web traffic to flow over strong TLS methods. Even when developing locally, use a self-signed localhost certificate to develop secure habits from the very beginning. Stellar may be incredibly easy and intuitive, but it’s also powerful money-moving software. Don’t skimp on security. Your future self and all your users thank you. For more, check out our guide to securing web-based products.
Last updated Feb. 26, 2021