Introduction to Federation in Stellar Blockchain

By Dassi Orleando, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Prerequisites

  1. Basic knowledge of how cryptocurrency technologies.
  2. Have a Stellar account, you can easily create one from the stellar account viewer or with the Interstellar.exchange wallet.

Overview

In this article, we’ll be learning what is a federation in the Stellar network, its use case, how to actually benefit from it, and also how to deploy one into an Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu installed.

About Stellar

Stellar is one of the most used Blockchain network right now in terms of market capitalization and adoption. According to CoinMarkerCap, at the time of writing, Stellar is the ranked 6 out of 100 cryptocurrencies.

Federation: What and Why

One of the main goals of new Blockchain technologies nowadays is to make their features more accessible to the rest of the word, meaning to peoples with not clear understanding of all the mechanic that is happening behind although they would like to (or need to) take advantage of this technology.

Stellar Address

A Stellar address looks almost same like a normal email address, but with a simple addition here called the federation server link.

  1. domain.tld is the federation server link where you have created your stellar federation address, for technical persons it’s the server where we’ll look for the federation configurations (stellar.toml) link to query the real public key matching with the username.

Creating a Stellar Address

Creating a federation address is a very straightforward process where one only needs to submit a basic form with a username/email he would like to be assigned to one of his specific public key, this needs to be done from a Stellar federation server you trust or either building yours.

  1. https://interstellar.exchange
  2. https://stellarid.io/
Image for post
Image for post

Connecting to interstellar.exchange

After being logged in, here is the screen I see with my stellar account I have added.

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Sending Money (XLM) to a Stellar Address

Let’s assume that we’ve two Stellar accounts, the one we’ll send the money to has a federation address we have submitted in the previous section.

Image for post
Image for post
  1. XLM is the native currency of the Stellar Blockchain.
  2. As we’re on Interstellar itself (where we have created our federation address), there is no need to fill the second part of the address. It’s guessed to be *interstellar.exchange.

Setting Up a Federation Server

Let’s suppose you don’t trust anyone else than yourself. You can build your own federation server using this process. Technical (software developer) skills are needed to follow the whole process as it involves:

  1. Add the federation_url into your configuration file, similar to the Interstellar one shown in the image up here with the name FEDERATION_SERVER.
  2. Implement federation url HTTP endpoint, here we have two possibilities either building from scratch or start from the one open sourced by Stellar Development Foundation and accessible over on GitHub.
  1. Install Go tools, as the federation server has been built with Go programming language.
  2. Download and run the federation server

Install MySQL

Here are the terminal commands to type in order to install MySQL, the last one is to configure and make it more secured on our ECS:

sudo apt-get update
sudo apt-get install mysql-server
mysql_secure_installation

Install Go Tools

Go tools are required to run any Go program into a computer, let’s get the latest stable Linux binary release from the official page here and unzip it into the appropriate folder then configure the environment variables. The latest version at the time of writing this article is Go 1.11.1.

cd /usr/local : go into the right folder to install the binary
wget https://dl.google.com/go/go1.11.1.linux-386.tar.gz : to download our binary into the current directory
tar -C /usr/local -xzf go1.11.1.linux-386.tar.gz : unzip the downloaded binary

Download and Run the Federation Server

The federation server is provided by Stellar, just pick one from the releases here, especially the latest according to your operating system (ours is Ubuntu then we took the Linux one).

port = 8000[database]
type = "mysql"
dsn = "dbuser:dbpassword@/dbname"
[queries]
federation = "SELECT account_id as id FROM Users WHERE username = ? AND domain = ?"
reverse-federation = "SELECT username as name, domain FROM Users WHERE account_id = ?"

Conclusion

In this tutorial, we focused on how the famous stellar federation address work, how to install one into our ECS, how it simplifies the money sending operation as now there is no need to always look for the very long correspondent’s public key.

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store