Select Page

How to setup a Stellar Horizon Server on AWS?

set_up_stellar_horizon_server_on_aws

Have you ever heard about the term Stellar? If not then, you are at the right place. This article will take you on a knowledgeable and woke ride to Stellar and its setting up procedure on AWS. Stellar is one of the fast-paced, low in cost payment technology that is open-sourced in nature. Stellar technology is also similar to a ripple in terms of certain transaction attributes, and interestingly co-founder of Ripple, Jed McCaleb, is also the founder of Stellar.

Stellar defines itself as the platform that allows bank connectivity, the system of payments, and the people. It is designed to allow the money flow and transaction smoothly and quickly along with the benefits of trust and minimal cost.

What do you understand by a Stellar Horizon Server? 

Horizon can be defined as an API server for the ecosystem of Stellar. It works as an interface linking the applications wanting to access the Stellar network and stellar-core. Horizon allows you to give in transactions to the Stellar network, track the account status, and helps in event streams subscribing, etc. Horizon is accounted for providing an HTTP API to data in the Stellar network. It ingests and reserves the data produced by the Stellar network in a form that is easier to consume by the average application relative to the performance-oriented data representations used by Stellar Core. You do not need to run your own Horizon instance to create on Stellar network: there are two Horizon servers as run by the Stellar development foundation, namely test network and public network:

  • https://horizon-testnet.stellar.org./
  •  https://horizon.stellar.org/

These are free servers that anyone can use and are convenient for development and projects on a small scale. However, their demand rate is limited, and they are not suggested in the case of services involving production, which in turn demands reliability and assurance.

How to set up a Stellar Horizon Server on AWS?

There are various steps to set up a Stellar Horizon Server on AWS, as mentioned below:

Set up Stellar Server on AWS

Step 1

The first step is to make an example of EC2 on AWS. Amazon’s Linux AMI will be used to create an EC2 instance — there will be posts that might give some suggestions regarding the need for some powerful instances; in that case, you should try it out with t2.micro. While adding a storage space of 20GB, assure that port 8000 is open in your security group and for your ssh access port 22.

Step 2

The second step is to install Git.

Install Git using apt-get from your shell:

$ Sudo apt-get update
$ Sudo apt-get install git

By typing git –version, verify that the installation was successful:

$ Git –version
git version 2.9.2

Using the following commands, substituting Emma’s name with your own configure your Git username and email. Any commits that you create will be associated with these details:

$ git config –global user.name “”Emma Paris””

You can use your gateway if you want to.

Step 3

The next step is the need to set up a docker on the server. Use the public key and the public DNS. Connect via SSH to the server. To install Docker, use yum configuration manager.

sudo yum update -y
sudo yum install -y docker

Begin the docker service.

sudo service docker start

You need to add ec2-user to the docker group to access the docker command without root benefits easily.

sudo usermod -aG docker ec2-user

To make all these changes, you should log out of the instance & ssh back inside. Verify that the Docker is correctly installed once you’ve ssh’d back inside using the command:

docker info

 

Stellar Blockchain Development

Build Stellar-powered decentralized global financial systems with LeewayHertz

Step 4

Process the installation of Stellar Quickstart Docker Image. This is the most effective and proven way to run your Stellar Horizon Server. The Stellar Github account assures the maintenance of a compatible Quickstart image.

  • Start with creating a server that runs in constant mode, is based on using a host volume mounted, a directory exposed to the running docker container on the host machine, to store all configuration files used for running services like the database data. This allows you to modify and manage these host system files.
  • Switching to the test network can be performed conveniently if you wish to do the same by running off the live public network.

Below mentioned is a command code to begin the run of a Quickstart image.

docker run -it –rm -v “/str:/opt/stellar” –name stellar stellar/quickstart –pubnet

After this, a Github repo image will come out after submitting a passcode for the Postgres database.

After seeing the complete installation, servers will flash that the Horizon server has entered the state of running.

Then, press the Ctrl + C button to take an exit from the process of running.

Step 5 

The next step is about running the docker image as a process in the background.

As the docker image ran in the foreground previously, in this process, you have to run it in the persistent background container. It will eventually help log out and let you leave your Horizon Server on the running mode on the instance.

To perform the background run process, follow the below-mentioned command code:

docker run -d -v “/str:/opt/stellar” -p “8000:8000” –name stellar stellar/quickstart –pubnet

After this, you now have to log in to the running docker image and check if your services are associated with the below mentioned two commands:

docker exec -it stellar /bin/bash
supervisorctl

Finally, your Stellar Horizon Server will start running!

You will be able to watch their Horizon server now — as per the dynamic address that is public of one’s AWS instance is as mentioned:

ec2–5–4–3–2.ap-southeast-1.compute.amazonaws.com” then start up the URL “ec2–5–4–3–2.ap-southeast-1.compute.amazonaws.com:8000” in the web browser.

Setting up Process of DNS and https certification

The nature of blockchain is intrinsically “encrypted,” and as stellar being an open-sourced network, it makes the cross-asset transactions very convenient. It is also distributed and community-owned which adds on to its growing demand. The stellar platform is also backed with the help of Stellar Consensus Protocol concerning the security of the decentralized network. The truth is that Stellar works as a public ledger — the setup of https has never found much attention.

That is a major concern to be worked upon— directing from the mobile applications the users are accessing their wallets, and non-encrypted URLs allowance is refused by iOS. There are ample methods to solve this, one of which is mentioned below:

Setting up an AWS Load Balancer
Start and choose the Classic Load Balancer. Map the HTTPS port 443 to instances’ HTTP port 8000 on the next page, which is the location of your Horizon server running. Make a new security group that in turn allows ports 443 via the Load Balancer. Then continue by creating a free SSL certificate in your AWS console. It is a very basic process that will navigate you to the Certificate Manager page. Lastly, add your page to the Load Balancer, which will eventually get live in the next consecutive minutes.

Configure DNS using Route53
Lastly, make a new record set in your Route 53 zone records for your domain:

  • Specify your subdomain such as stellar-horizon.your domain.com
  • Type = A-IPv4 Address
  • Alias = Yes
  • Alias Target — look under the ELB Classic Load Balancers and choose your new load balancer.

Save and take a look at https://stellar-horizon.your-domain.com/or whatever you set up.

Stellar’s popularity is growing because of its unique consensus mechanism, financial infrastructure integration, and built-in order books. The ever-increasing popularity of Stellar necessitates an understanding of its creation and execution. Many large corporations have already incorporated Stellar into their operations.

Contact our skilled Stellar blockchain developers and team for better guidance.

 

Webinar Details

Author’s Bio

Akash Takyar
Akash Takyar
CEO LeewayHertz
Akash Takyar is the founder and CEO at LeewayHertz. The experience of building over 100+ platforms for startups and enterprises allows Akash to rapidly architect and design solutions that are scalable and beautiful.
Akash's ability to build enterprise-grade technology solutions has attracted over 30 Fortune 500 companies, including Siemens, 3M, P&G and Hershey’s. Akash is an early adopter of new technology, a passionate technology enthusiast, and an investor in AI and IoT startups.

Start a conversation by filling the form

Once you let us know your requirement, our technical expert will schedule a call and discuss your idea in detail post sign of an NDA.
All information will be kept confidential.

Insights

Follow Us