Decentralized network

decentralization

A decentralized network consists of peers that can run independently of each other. The power to transmit information is distributed among a network of servers, instead of being driven from one primary source.

This means that the Stellar network does not depend on any single entity. The idea is to have as many independent servers participate in the Stellar network as possible, so that the network will still run successfully even if some servers fail.


Ledger

ledger

Like a traditional ledger, the Stellar ledger records a list of all the balances and transactions belonging to every single account on the network. A complete copy of the global Stellar ledger is hosted on each server that runs the Stellar software. Any entity can run a Stellar server.

These servers form a decentralized Stellar network, allowing the ledger to be distributed as widely as possible. The servers sync and validate the ledger by a mechanism known as consensus.


Consensus

consensus

The Stellar servers communicate and sync with each other to ensure that transactions are valid and get applied successfully to the global ledger.

For example, if you want to send $5 to a friend on the network, a list of trusted servers will begin a process to agree on the validity of your $5 payment to your friend. The majority of these servers will have to agree that you do in fact own $5 worth of credit on the network before they will mark the transaction as valid.

This entire process of coming to consensus on the Stellar network occurs approximately every 2-5 seconds.

Prof. David Mazières describes the technical process of consensus in his white paper, The Stellar Consensus Protocol (SCP). You can also explore other resources explaining SCP.


Anchors, trust, and credit

anchor

Anchors are simply entities that people trust to hold their deposits and issue credits into the Stellar network for those deposits. They act as a bridge between different currencies and the Stellar network. All money transactions in the Stellar network (except the native digital currency of lumens) occur in the form of credit issued by anchors.

Anchors do two simple things:

  1. They take your deposit and issue the corresponding credit to your account address on the Stellar ledger.
  2. You can make a withdrawal by bringing them credit they issued.

You have to trust the anchor to honor your deposits and withdrawals of credit it has issued.

Anchors exist in the pre-stellar world now. For example, to use Paypal, you deposit money in from your bank account. Paypal then gives you credit in your Paypal account. You can now send that Paypal credit to anyone that trusts Paypal (anyone with a Paypal account). Someone that received your Paypal credit can convert it to real money using Paypal by withdrawing it to the bank.

Anchors perform the same function in Stellar. The difference is, all the “Paypals” and other anchors are operating on the same network so they can all transact with each other now – this makes the system way more powerful. People can now easily send and exchange all these different anchor credits with each other.


Distributed Exchange

distributed-exchange

The Stellar ledger is able to store offers that people have made to buy or sell currencies. Offers are public commitments to exchange one type of credit for another at a pre-determined rate. The ledger becomes a global marketplace for offers.

All these offers form what is called an orderbook. There is an orderbook for each currency/issuer pair. So if you are wanting to exchange Virgin Bank/EUR for bitstamp/BTC you look at that particular order book in the ledger to see what people are buying and selling it for.

This allows people to not only buy and sell currencies in a foreign exchange like manner but also to convert currencies seamlessly during transactions.


Multi-currency transactions

multicurrency

Stellar allows you to send any currency you hold to anyone else in a different currency through the built-in distributed exchange. People can receive any currency through an anchor they added.

For example, Amy wants to send Bob euros, using her USD balance. Stellar automatically submits an offer to the distributed exchange selling USD for EUR. The network finds the best exchange rate for the transaction.

Here’s a few possible ways the transaction can happen:

Conversion through an offer

Stellar finds an offer on the internal USD/EUR exchange for someone wanting to buy EUR for USD and automatically makes the exchange between the two parties.

Using lumens as an intermediary currency

Stellar looks for offers on the network asking for USD in exchange for lumens (the native — purely digital — currency). It simultaneously looks for an offer asking for lumens in exchange for euros. The network makes those exchanges and sends Bob the resulting euro credit.

Chain of conversions

If there are no explicit relationship between offers to buy and sell, Stellar tries to find offers from the network that will lead a chain of conversions from EUR to USD. For example, EUR to AUD, AUD to BTC, BTC to XLM, XLM to USD.