Stellar, the powerful open-source blockchain for payments, announced today the release of Horizon 1.0, the first major release of its open-source API. Horizon was first originated back in 2015, and since then has had 24 minor release versions.
Horizon is an HTTP API server that makes it easy for users to interact with the Stellar network without having to worry about low-level details. It exposes multiple endpoints that are optimized to allow users to perform actions such as:
- Submitting a transaction to the network
- Read information about the current state of the ledger (like an account’s balance)
- Explore historical data (like the transactions an account has submitted to the network)
Horizon sits between services on Stellar (wallet, asset issuer, payment provider) and a Stellar Core node:
Horizon is designed to allow developers to submit transactions and efficiently consume network data. It takes XDR data from Stellar-Core and decodes it into JSON. Stellar SDKs are typically set up to poll Horizon endpoints; sp projects building on Stellar aren’t constantly asking Stellar-Core questions. That means Stellar-Core can focus on the hard work of consensus and ledger ratification. Horizon, meanwhile, can focus on providing answers that are efficient and ergonomic.
Submitting a transaction to the network via Horizon is actually pretty straightforward: you send the transaction to Horizon and it proxies the transaction to a Stellar Core node. Making it easy to read the current state of the ledger or exploring historical data requires more orchestration, and that’s where Horizon offers the most value to its users. Through a process Stellar calls ingestion, Horizon takes data from the ledger and normalizes it so it’s easier to access and consume.
What makes this a major release?
Back in August, Stellar introduced a new system for handling ingestion. It has big advantages over the old ingestion system; it’s more consistent and developer-friendly, allows user configuration, and doesn’t overtax Stellar-Core. Eventually, the plan is to move over to it completely.
The new ingestion system is a pretty big departure from the old one, and after months of refinement and road testing—first behind a feature flag, then in alpha and beta releases—it’s ready for production deployment. With Horizon 1.0, Stellar switches off the old ingestion system and switches on the new one.
The new ingestion system introduces some breaking changes, which is part of why this is a major release. It also makes Horizon a lot nimbler, according to Stellar’s release notes, here’s why:
Switching Horizon’s guts means it can do more without disturbing Stellar-Core…
As a result, queries are faster and data is more consistent. Those two advantages are covered at length in a previous blog post from Stellar. The new ingestion system also allows Stellar to do more with Horizon, and this release includes some new endpoints that take advantage of that fact.
Examples:
- In the past, it was impossible to use Horizon to list all the accounts with a trustline to a given asset. For a lot of asset issuers that was a problem: in the course of ordinary accounting, dividend payments, or KYC tracking, they needed to know how to identify relevant addresses, and there wasn’t an easy way to do that.
- Previously, it also was impossible to use Horizon to list all the accounts a given public key can sign for. That makes things difficult if you have multiple multi-sig accounts: a business with several hot wallets and a cold wallet had to manually keep track of each address, with no way to ensure they didn’t overlook one.
- Finally, the new `/offers` endpoint allows users to find all offers on the network, and to filter results by selling an asset, or buying an asset. If wanting to see specific pairs for a given asset, or wanting to take offers from a particular account, this can now be done. Use it to find out which accounts are trading on a given market, or bake it into a trading strategy that keeps closed loops of assets priced correctly.
Road Ahead
“We’re planning to switch our public Horizon instances to 1.0 on 03/20/20. You can track that upgrade and sign up for notifications on our statuspage. If you’re running your own Horizon, you can find all the details on how to migrate in our testing guide. Please make sure to take a look at the release notes for information about breaking changes, and to update your SDK so it’s compatible with the new version. Working on this rewrite was our number one priority over the last couple of months. Now that it’s finally out, we’re going to continue to improve and add features to Horizon, and to use the new ingestion system to explore new solutions to all kinds of problems. For example: Until now Horizon has been in an unstable 0.x phase so breaking changes between versions were allowed. However, moving to 1.0 and a more mature deprecation scheme has been long overdue.”
– The Stellar Team