HOW TO RUN STELLAR API SERVER?

Stellar is a decentralized and free network for moving and storing funds. Jed McCaleb, the founder of Stellar created Stellar with the intention of providing users with a method of sharing their fiat currency with digital currencies easily.

Developers who create applications on foundation of Stellar network software by using Stellar SDKs that they use in their programming languages of choice. SDKs then communicate with Horizon the Stellar-network API. Horizon offers a means to monitor accounts, sign up to events and make transactions.

Stellar ecosystem runs an API server dubbed Horizon. Horizon acts in the role of an interfacing with Stellar Core and the applications that are part of the Stellar network. It also offers HTTP API for data within Stellar Core. Stellar network. It collects information from data in the Stellar network and serves the data in a format that is simple to use.

There are numerous benefits of Horizon's operation: Horizon on your infrastructure

  • Complete operational control, without any dependence from any of Stellar Development Foundation
  • Create multiple instances to ensure capacity and redundancy
  • Enable rate-limiting of requests to ensure network access

Prerequisites

Horizon relies in the PostgreSQL server to store the data that is processed and ingested by Stellar Core. The PostgreSQL Version 9.5 or greater is required to run Horizon.

The additional RAM required is to host Captive Core's memory database, which would amount to about 3 GB. The other requirement is contingent on the volume of history of the network that is served by the Horizon instance. It can range from a few gigabytes to hundreds of TBs to cover the entire ledger history ingested.

Installation

Primarily, prebuilt binaries from Stellar repositories should be installed prior to installing Horizon. If you do not want to install prebuilt releases there's a different option. Horizon must be built Horizon from scratch. Some developers tools are required for this purpose:

  • OS similar to Unix that uses common basic commands such as mkdir, bash, cp, etc.
  • Go1.15 or later
  • Git

Configuration

Parameters

Both command line flags and environmental variables can affect Horizon's configuration. Use the following command to look up the available command-line flags as well as their default values, and their associated environment variables:

Horizon -help

The command you are using will display numerous flags, however only a few are needed. The three most crucial parameters are:

  • -db-url: It indicates Horizon database, and the value must be an authentic PostgreSQL link URL.
  • -captive-core-config-append-path: It points to a Captive Core configuration stub.
  • -stellar-core-binary-path: It is a file system path to a Stellar Core binary. Horizon scans PATH to find stellar-core on default. If the environment is properly configured then there is no need to specify the path manually.

Make the database

Make the Horizon database prior to operating the server. The database needs to store all Horizon information, mostly historic information about transactions made on the Stellar network. A brand new database was created using the PostgreSQL server exclusively to be used by Horizon. Next, you need to set up the schema by running Horizon db init. In Postgre configuration set random_page_cost=1. This will enable queries planners make greater use of indices, particularly for queries using JOIN. Additionally, this setting dramatically speeds up certain queries.

Read More : https://www.leewayhertz.com/run-stellar-api-server/

Comments

Popular posts from this blog

HOW CAN STELLAR BLOCKCHAIN SIMPLIFY CROSS-BORDER PAYMENTS?

Stellar Consulting Services

HOW TO SETUP AND RUN STELLAR CORE NODE?