The Stellar Stack
Fundamentally, Stellar is a collection of Stellar Core nodes, which are computers that keep a common ledger of accounts and balances, listen for incoming transactions, and, using the Stellar Consensus Protocol, agree to apply a valid set of those transactions to update the ledger. Each transaction applied to the ledger incurs a small fee — which is necessary to prevent bad actors from spamming the network — and the ledger is generally updated every 3-5 seconds.
However, most developers don’t interact directly with a Stellar Core node. Rather, they program using a Software Development Kit written in their preferred language, and those SDKs in turn interact with Horizon, the Stellar-network API. This three-tiered stack divides responsibilities so each piece of software can focus on a specific purpose. Stellar Core concentrates on transaction submission and consensus; Horizon handles queries and converts network data into a friendly format; SDKs abstract away complexity and offer ergonomic access in a variety of languages.
SDKs make it easy to craft code and handle network queries and transaction submissions. They’re linked to in the SDK section of the docs, and each is robust, and has its own documentation showing you how to request data and create and submit transactions. When you start developing on Stellar, the first step is usually to find the SDK in your language of choice and familiarize yourself with how it works.
Horizon is a RESTful HTTP API server that provides a straightforward way to submit transactions, check accounts, and subscribe to events. Because it’s HTTP, you can communicate with Horizon using an SDK, but you can also use your web browser, or simple command line tools like cURL. Everything there is to know about Horizon is documented in the API Reference section of the docs.
At the moment, Horizon requires access to Stellar Core’s database to function properly — so every Horizon instance connects to a Stellar Core node — but we are increasing its independence from Stellar Core, and soon developers will be able deploy the API without having to run their own node.
The Stellar Core software does the hard work of validating and agreeing with other instances of Core on the status of every transaction through the Stellar Consensus Protocol (SCP). The ledger, transactions, results, history, and even the messages passed between computers running Stellar Core are encoded using XDR, which is incredibly efficient, but not human readable. Stellar Core nodes make up the network — and running a node is crucial if you want to ensure constant access or contribute to the health and decentralization of the network — but most developers don’t work directly with Stellar Core. For more on how to set up a node, consult the Run a Core Node section.
There are two different versions of the Stellar network: one for testing and one for real-world deployments. The Stellar Development Foundation provides a free public Horizon instance for each, which you can use to submit transactions or query network data.
- https://horizon.stellar.org/ is for interacting with the public network
- https://horizon-testnet.stellar.org/ is for interacting with the testnet
Assets on the testnet don’t represent anything in the real world, and when you’re developing on the testnet, you can get free test XLM from a tool called Friendbot. On the testnet, you’re free to experiment, create, and troubleshoot without risking the loss of funds. It generally upgrades a month before the public network — so if you’re using it, you need to keep an eye out for major protocol releases — and unlike the public network — where data persists forever — the testnet gets reset every quarter. Additionally, it has a lower ledger limit than the public network: currently, the testnet tops out at 100 operations/ledger; the public network at 1,000 operations/ledger.
Other than that, the two networks are the same: they consist of Stellar Core nodes, support the Horizon API, and work with Stellar SDKs. Both support the same operations, process transactions in 3-5 seconds, and require the same fees and network minimum. In fact, if you build something on the testnet and decide you’re ready to deploy it on the public network, all you need to do is change the Network Passphrase. For more, check out our guide to best practices for building on the testnet.
Last updated Apr. 12, 2021