A Primer on the Stellar Network

[Updated 2019-11-17]

On September 10, 2019 while I was in London, UK at the Python core dev sprints, I got a message from a user named "spacedrop" on Keybase. The message said I was being given 356.2904939 XLM as a surprise gift of "free Lumens worth $20.98 USD" from the Stellar Development Foundation. All of that screamed "cryptocurrency" which isn't my thing, so my initial reaction was this was some scam by someone who randomly messaged me on Keybase trying to get me to buy into some new cryptocurrency. But then I realized that Keybase wouldn't let a random person message me like that. Curious, I read the rest of the message and found a link to Keybase's "airdrop" announcement which explained that Keybase was actually facilitating the message. Trusting that Keybase wasn't getting into anything nefarious,  that enticed me enough to dig a little deeper into Stellar and find their overview page which has the following summary:

Stellar is a multi-currency payment backend that tens of thousands of people  use every day. It’s decentralized, open-source, and developer-friendly,  so anyone can issue assets, settle payments, and trade.
Stellar is a blockchain, but it works more like cash—Stellar is much faster and  cheaper than bitcoin, for example. And it uses far less electricity.

Okay, that sounds nice. But when I was poking around the web site and I found a code of conduct and a roadmap that both seemed reasonable, that's when I decided to dive into Stellar and I came out thinking that's it's actually a rather cool piece of technology for people to track "what they own ... and and what they want to do with what they own".

So this blog post is basically me writing down what I learned about Stellar and why I found it interesting from the perspective of trying to find a cheap, secure way to send remittance to the United States from Canada (which, spoiler alert, Stellar can't do for me yet, but the technology is there if someone would let me get CAD on to the Stellar network).

What is Stellar for?

I will go into more detail later, but to help motivate reading the rest of the blog post, I want to quickly outline what Stellar is. Basically it's a public ledger that tracks ownership of assets. Those assets do not need to be inherent to Stellar, and in fact a key part of Stellar is that 3rd-parties can provide their own assets to have managed on the network. Or put another way, Stellar is trying to become a global payments network.

On Stellar you can trade assets. Stellar lets you put out buy and sell orders on assets and the network will figure out the necessary orders for you to get the best price for your assets. This is just like a stock market with buy and sell orders, but instead of stock certificates it's assets on the Stellar network. But one extra twist is that since Stellar lets anyone put assets on to the network, the network will do up to 6 different exchanges to try to get you the best value for your assets. For instance, if you're trying to buy spam with bacon, but people are only selling bacon for eggs and buying spam for eggs, the network will do the bacon → eggs → spam trade for you to get you the best result.

Now substitute "bacon" for "CAD" and "USD" for "spam" and you start to see how Stellar might be really handy for global payments.

Lumens (yes, there's a digital currency)

To start discussing Stellar you need to know about lumens (or XLM for short). There's 50,000,000,000 lumens in existence with no mining new ones like with Bitcoin. The smallest unit of lumens is called a stroop and it's 0.0000001 of a lumen which is 1/10,000,000 (and they are named after stroopwafels which my wife and I like, and stroopwafels are Dutch which just makes the Pythonista in me smile 😊).

Now when I read that Stellar had lumens, I 🙄 like this was yet another cryptocurrency that people are just speculating with (which some people are), but when I began to read about what lumens are used for I realized it's actually an anti-spam mechanism and baseline asset more than a play to make money from lumens themselves (although they are how the Stellar Development Foundation is funding itself).

Accounts

Accounts on Stellar are a public key and a private seed. Nothing crazy, but also nothing terribly difficult to calculate either. So how does Stellar prevent people from creating a ton of accounts to spam the network?

By having a minimum account balance required to even create an account. Since lumens are the original asset on Stellar they are what you need to open an account (and keep it open). As of today it's 1 XLM which is about $0.07275 USD as I write this. In other words it shouldn't be a financial hardship for nearly anyone in the world to have a single lumen to open an account, but it also won't lead to everyone creating 1 billion accounts on their own either.

Trading

So now you have your account, how do you do something as simple as send or receive an asset? Once again, lumens are used as an anti-spam mechanism for trading.

Every change you want to make to the Stellar network is an operation. All the operations you want to do as a single unit is a transaction (just like with databases). All the transactions that get resolved end up in a new version of the ledger which tracks the state of the network at that point in time.

Each transaction costs at least the base fee of 100 stroops per operation (0.00001 XLM or 1/100,000) contained in that transaction. That way you can't flood the network with operations without having to at least pay a little bit for it.

And what exactly are you paying for? Well, there's a limit to how many new operations can occur on the Stellar network per ledger update. Protocol 11 made it so the network votes on what the maximum number of operations per ledger should be, and as of right now it's sitting at 1000 operations/ledger (if you look at any ledger like ledger 25923589 you will see max_tx_set_size and that shows the network's current operations/ledger rate). Even with ledgers resolving every 5 seconds, that still means there's limited capacity if the network gets backed up (i.e. it's about 200 operations/second). In those instances where there's not enough capacity there's surge pricing.

You specify the maximum base fee you're willing to pay when you create a transaction. An auction is held where your maximum base fee is offered to fund resolving your transaction. In the end, though, you end up paying only what was required for you to get your transaction resolved (e.g. you might offer to pay a total of 1000 stroops as a maximum base fee for your one operation, but if all it took was 150 stroops for your transaction to get resolved during surge pricing then that's all you end up paying).

So you're paying to prevent spam, and you're paying to potentially prioritize your transaction in case the network is backed up. Now currently the network is not at capacity so worrying about surge pricing isn't a big deal, but even if it did increase we're talking about minuscule amounts of XLM. With the price for 1 XLM that I quoted above, 100 stroop is $0.0000007275 USD, so even if you had to go up by several orders of magnitude to get your operation resolved it wouldn't exactly be expensive.

Anchors (or what makes Stellar interesting)

So up to this point you're probably wondering how to heck remittance from Canada to the United States might work if everything is being done in lumens and I said they are not meant to act as investment vehicles. And the answer to that is assets and anchors.

Basically anchors join the network and offer tokens which represent assets that the anchor holds. The anchor can then send those assets as tokens to other accounts on the Stellar network, expressing the fact that an account owns those tokens representing that asset. While lumens is the asset we have talked about up until now, anything can be an asset on the network.

Let's say I run a bank and it acts as an anchor on the Stellar network that will generate tokens representing CAD. What that would mean is customers could withdraw CAD cash from their bank accounts and exchange them for CAD tokens on Stellar. My bank would hold the physical CAD in escrow to back the tokens in circulation. This allows people to then exchange their CAD tokens for real/fiat currency at my bank by sending the tokens to their account, whereby my bank would destroy the token so there isn't double-counting of the money in the world.

To take this bank analogy a little farther, think of physical cash as tokens, your wallet as your Stellar account, and the world of Canadian money as the Stellar network. When you withdraw money from the ATM, you are exchanging money in your bank account for a different format; in this case it's physical cash. You can then transact with it at stores, etc. And then eventually that physical cash comes back out of circulation when you deposit money into your bank account and becomes bits in some bank database.

And this is how anchors that back fiat currency work. For instance, AnchorUSD takes money in USD from you and then converts it 1:1 into a token on Stellar for you to send to whomever. It also lets you receive those USD tokens and then convert them back into USD money by destroying the token. Basically it's a gateway between the USD money and Stellar.

In order to prevent people from trusting any random anchor, Stellar has the concept of trustlines. Basically it's a way to say on the network, "we both agree that this token represents what the anchor says it does". That way you enter into an agreement with the anchor to avoid getting ripped off. You also must pay into your trustline, once again acting as an anti-spam mechanism so people can't fake trust of an anchor by opening a ton of accounts that all trust a single anchor.

An example of sending money

Pretending for a moment that I live in the eurozone, what would it take to send €50 to someone in the United States?

  1. I create a Stellar account with 1 XLM
  2. I open a trustline to an anchor that will take € and give me tokens on Stellar as an equivalent asset (e.g. EURT) for 0.5 XLM
  3. I convert €50 to 50 EURT on the Stellar network via the anchor I trust
  4. My friend in the US also opens a Stellar account  for 1 XLM
  5. My friend opens a trustline to an anchor that will let them receive their tokens as an asset and exchange it for real USD (e.g. USD) for 0.5 XLM
  6. I put in a payment of 50 EURT to USD on Stellar to my friend
  7. Assuming the liquidity is high enough for both token types, the transaction completes in at worst 10 seconds (assuming I just missed the last ledger and have to wait for the next one)
  8. My friend exchanges the resulting USD tokens for actual USD via the anchor they trust and has them deposited into their bank account

So for the cost of 3.00001 XLM between me and my friend, I just sent money across the world in less than 10 seconds at the best exchange rate available to me on Stellar for less than $0.22 USD. Now there's no guarantee that the exchange rate will be better than what my bank will give me nor that the fees the anchors on either end charge won't eat into how much this whole transaction costs, but you can see the potential here.

Why this interests me

When I realized that the Stellar network was set up so that it would be feasible for a CAD-equivalent of AnchorUSD to exist such that I could send family in the United States actual USD that they could deposit into their bank accounts from CAD money in my bank account, that got me excited. Typically I use TransferWise (which I have a referral link for that gets me and the first couple of people who use it some money), but it takes a few days for the money to arrive and I have to go through some hoops to get the cheapest fee with the fastest result by letting them log into my bank account to check I actually have the funds which has always bugged me from a security perspective.

Add on to that the fact that PayPal is about the only solution I know of for sending small amounts of money internationally – which happens regularly to me when I'm at a conference outside of Canada and the restaurant won't split the cheque – and you start to wonder why there aren't more potential solutions out there for sending money internationally in a fast, cheap manner.

And apparently I'm not the only one who thinks this: IBM has a service called World Wire built on the Stellar network specifically for moving money quickly and cheaply between banks. So now I'm just waiting for someone to set up a CAD-based anchor which acts as an Interac e-Transfer bridge between my Stellar account and my Canadian chequing account so I can send money to the United States cheaply and easily.

The Stellar Development Foundation (SDF) has laid out a 10 year plan to get Stellar to a good spot where it is self-sustaining. They have their funding set aside for this and have discussed how they plan to go about trying to make Stellar attractive enough to get appropriate anchors on side to support various currencies around the world. They are also trying to make sure that Stellar can survive on its own without the SDF needing to prop it up in any way (i.e. the network is fully decentralized and self-sustaining).

Interesting Links

Stellar - an open network for money
Stellar lets you hold, send, and swap digital versions of everyday currencies. Dozens of financial institutions issue assets and settle payments on Stellar.
Stellar Dashboard
Stellar Dashboard.
StellarExpert | Stellar XLM block explorer and analytics platform.
Explore detailed stats, price history, and analytic reports for all assets on Stellar Network. View comprehensive account history, search transactions and payments, examine well-known accounts, analyze XLM and Stellar Network performance.
Stellarbeat.io - Stellar network visibility
Giving insight into the Stellar public network through various tools & visualizations.
Keybase Stellar Space Drop, 2 Billion Lumens for the World
Keybase is for keeping everyone’s chats and files safe, from families to communities to companies. MacOS, Windows, Linux, iPhone, and Android.
If you were a Keybase user before September 9, 2019 you might as well go and collect your lumens and sign up to get the monthly disbursement they are going to be doing for the next 20 months. You may also qualify if you live in a qualifying country and are willing to validate your phone number with Keybase.

https://www.coinbase.com/earn/stellar/

(If you want to watch some videos from Coinbase and get some free lumens if you have a Coinbase account. If you don't have a Coinbase account and you want to sign up for one, you can use this referral link which will give me some extra lumens.)