• Stars
    star
    183
  • Rank 210,091 (Top 5 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created almost 9 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Home of the stellar/quickstart docker image for development and testing

Stellar Quickstart Docker Image

This docker image provides a simple way to run stellar-core and horizon locally for development and testing.

Looking for instructions for how to run stellar-core or horizon in production? Take a look at the docs here.

This image provides a default, non-validating, ephemeral configuration that should work for most developers. By configuring a container using this image with a host-based volume (described below in the "Usage" section) an operator gains access to full configuration customization and persistence of data.

The image uses the following software:

Usage

To use this project successfully, you should first decide a few things:

First, decide whether you want your container to be part of the public, production Stellar network (referred to as the pubnet) or the test network (called testnet) that we recommend you use while developing software because you need not worry about losing money on the testnet. Additionally, we have added a standalone network (called standalone) which allows you to run your own private Stellar network.

Next, you must decide whether you will use a docker volume or not. When not using a volume, we say that the container is in ephemeral mode, that is, nothing will be persisted between runs of the container. Persistent mode is the alternative, which should be used in the case that you need to either customize your configuration (such as to add a validation seed) or would like avoid a slow catchup to the Stellar network in the case of a crash or server restart. We recommend persistent mode for anything besides a development or test environment.

Finally, you must decide what ports to expose. The software in these images listen on 4 ports, each of which you may or may not want to expose to the network your host system is connected to. A container that exposes no ports isn't very useful, so we recommend at a minimum you expose the horizon http port. See the "Ports" section below for a more nuanced discussion regarding the decision about what ports to expose.

After deciding on the questions above, you can setup your container. Please refer to the appropriate section below based upon what mode you will run the container in.

Network Options

Provide either --pubnet, --testnet or --standalone as a command line flag when starting the container to determine which network (and base configuration file) to use.

--pubnet

In public network mode, the node will join the public, production Stellar network.

--testnet

In test network mode, the node will join the network that developers use while developing software. Use the Stellar Laboratory to create an account on the test network.

--futurenet

In futurenet network mode, the node will join the Soroban test network that developers use while developing smart contracts on Stellar.

--standalone

In standalone network mode, you can optionally pass --protocol-version {version} parameter to run a specific protocol version (defaults to latest version).

The network passphrase of the network defaults to:

Standalone Network ; February 2017

Set the network passphrase in the SDK or tool you're using. If an incorrect network passphrase is used in clients signing transactions, the transactions will fail with a bad authentication error.

The root account of the network is fixed to:

Public Key: GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI
Secret Key: SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L

The root account is derived from the network passphrase and if the network passphrase is changed the root account will change. To find out the root account when changing the network passphrase view the logs for stellar-core on its first start. See Viewing logs for more details.

In standalone network mode a ledger occurs every one second and so transactions are finalized faster than on deployed networks.

Note: The standalone network in this container is not suitable for any production use as it has a fixed root account. Any private network intended for production use would also required a unique network passphrase.

Soroban Development

For local development of smart contracts on Stellar using Soroban, run a standalone network and the Soroban stack locally via the stellar/quickstart:soroban-dev image:

$ docker run --rm -it \
    -p "8000:8000" \
    --name stellar \
    stellar/quickstart:soroban-dev \
    --standalone \
    --enable-soroban-rpc

This will run development versions of stellar-core, horizon, friendbot, and soroban-rpc server that are Soroban enabled.

Warning: The Soroban RPC Server is in early development and the version included in any quickstart image is a development release with no production capabilities and no API compatibility guarantee. Not recommended for use in production or any environment requiring stability or safety.

The Soroban RPC server is supported only with the --standalone and --futurenet network options.

To enable the Soroban RPC server provide the following command line flags when starting the container: --enable-soroban-rpc

The Soroban RPC Server will be avaialble on port 8000 of the container, and the base URL path for Soroban RPC will be http://<container_host>:8000/soroban/rpc. This endpoint uses JSON-RPC protocol. Refer to example usages in soroban-example-dapp.

To enable soroban rpc admin endpoint for access to metrics and Go pprof (profiling), include the --enable-soroban-rpc-admin-endpoint flag, the HTTP endpoint will be listening on container port 6061, which can be exposed with standard docker port rule -p "6061:6061", the published endpoints are:

http://<container_host>:6061/metrics
http://<container_host>:6061/debug/pprof/

Deploy to Digital Ocean

You can deploy the quickstart image to DigitalOcean by clicking the button below. It will by default create a container that can be used for development and testing, running the latest tag, in ephemeral mode, and on the standalone network.

Deploy to DO

After clicking the button above, the deployment can be configured to deploy a different variant of the image, or join a different network such as testnet or futurenet by changing environment variables.

Some example configurations that can be used are:

  • Standalone network matching pubnet: IMAGE: stellar/quickstart:latest NETWORK: standalone
  • Standalone network matching testnet: IMAGE: stellar/quickstart:testing NETWORK: standalone
  • Standalone network matching futurenet: IMAGE: stellar/quickstart:soroban-dev NETWORK: standalone ENABLE_SOROBAN_RPC: true
  • Futurenet node: IMAGE: stellar/quickstart:soroban-dev NETWORK: futurenet ENABLE_SOROBAN_RPC: true

Disclaimer: The DigitalOcean server is publicly accessible on the Internet. Do not put sensitive information on the network that you would not want someone else to know. Anyone with access to the network will be able to use the root account above.

Building Custom Images

To build a quickstart image with custom or specific versions of stellar-core, horizon, etc, use the Makefile. The following parameters can be specified to customize the version of each component, and for stellar-core the features it is built with.

  • TAG: The docker tag to assign to the build. Default dev.
  • CORE_REF: The git reference of stellar-core to build.
  • CORE_CONFIGURE_FLAGS: The CONFIGURE_FLAGS to configure the stellar-core build with. Typically include --disable-tests, and to enable the next protocol version that is still in development, add --enable-next-protocol-version-unsafe-for-production.
  • GO_REF: The git reference of stellar-horizon and stellar-friendbot to build.
  • SOROBAN_TOOLS_REF: The git reference of soroban-rpc to build.

For example, to build the latest soroban-dev variation:

make build \
  TAG=soroban-dev \
  CORE_REF=c0ad35aa19297e112d71fcc5755458495f99a237 \
  CORE_CONFIGURE_FLAGS='--disable-tests --enable-next-protocol-version-unsafe-for-production' \
  GO_REF=soroban-v0.0.4 \
  SOROBAN_TOOLS_REF=v0.4.0

Background vs. Interactive containers

Docker containers can be run interactively (using the -it flags) or in a detached, background state (using the -d flag). Many of the example commands below use the -it flags to aid in debugging but in many cases you will simply want to run a node in the background. It's recommended that you use the use the tutorials at docker to familiarize yourself with using docker.

Ephemeral mode

Ephermeral mode is provided to support development and testing environments. Every time you start a container in ephemeral mode, the database starts empty and a default configuration file will be used for the appropriate network.

Starting an ephemeral node is simple, just craft a docker run command to launch the appropriate image but do not mount a volume. To craft your docker command, you need the network name you intend to run against and the flags to expose the ports your want available (See the section named "Ports" below to learn about exposing ports). Thus, launching a testnet node while exposing horizon would be:

$ docker run --rm -it -p "8000:8000" --name stellar stellar/quickstart --testnet

As part of launching, an ephemeral mode container will generate a random password for securing the postgresql service and will output it to standard out. You may use this password (provided you have exposed the postgresql port) to access the running postgresql database (See the section "Accessing Databases" below).

Persistent mode

In comparison to ephemeral mode, persistent mode is more complicated to operate, but also more powerful. Persistent mode uses a mounted host volume, a directory on the host machine that is exposed to the running docker container, to store all database data as well as the configuration files used for running services. This allows you to manage and modify these files from the host system.

Starting a persistent mode container is the same as the ephemeral mode with one exception:

$ docker run --rm -it -p "8000:8000" -v "/home/scott/stellar:/opt/stellar" --name stellar stellar/quickstart --testnet

The -v option in the example above tells docker to mount the host directory /home/scott/stellar into the container at the /opt/stellar path. You may customize the host directory to any location you like, simply make sure to use the same value every time you launch the container. Also note: an absolute directory path is required. The second portion of the volume mount (/opt/stellar) should never be changed. This special directory is checked by the container to see if it is mounted from the host system which is used to see if we should launch in ephemeral or persistent mode.

Upon launching a persistent mode container for the first time, the launch script will notice that the mounted volume is empty. This will trigger an interactive initialization process to populate the initial configuration for the container. This interactive initialization adds some complications to the setup process because in most cases you won't want to run the container interactively during normal operation, but rather in the background. We recommend the following steps to setup a persistent mode node:

  1. Run an interactive session of the container at first, ensuring that all services start and run correctly.
  2. Shut down the interactive container (using Ctrl-C).
  3. Start a new container using the same host directory in the background.

Customizing configurations

To customize the configurations that both stellar-core and horizon use, you must use persistent mode. The default configurations will be copied into the data directory upon launching a persistent mode container for the first time. Use the diagram below to learn about the various configuration files that can be customized.

  /opt/stellar
  |-- core
  |   `-- etc
  |       `-- stellar-core.cfg  # Stellar core config
  |-- horizon
  |   `-- etc
  |       `-- horizon.env       # A shell script that exports horizon's config
  |-- postgresql
  |   `-- etc
  |       |-- postgresql.conf   # Postgresql root configuration file
  |       |-- pg_hba.conf       # Postgresql client configuration file
  |       `-- pg_ident.conf     # Postgresql user mapping file
  `-- supervisor
      `-- etc
  |       `-- supervisord.conf  # Supervisord root configuration

It is recommended that you stop the container before editing any of these files, then restart the container after completing your customization.

NOTE: Be wary of editing these files. It is possible to break the services started within this container with a bad edit. It's recommended that you learn about managing the operations of each of the services before customizing them, as you are taking responsibility for maintaining those services going forward.

Regarding user accounts

Managing UIDs between a docker container and a host volume can be complicated. At present, this image simply tries to create a UID that does not conflict with the host system by using a preset UID: 10011001. Currently there is no way to customize this value. All data produced in the host volume be owned by 10011001. If this UID value is inappropriate for your infrastructure we recommend you fork this project and do a find/replace operation to change UIDs. We may improve this story in the future if enough users request it.

Ports

Port Service Description
5432 postgresql database access port
8000 horizon, soroban-rpc, friendbot main http port
6060 horizon admin port
6061 soroban-rpc admin port
11625 stellar-core peer node port
11626 stellar-core main http port

Security Considerations

Exposing the network ports used by your running container comes with potential risks. While many attacks are preventable due to the nature of the stellar network, it is extremely important that you maintain protected access to the postgresql server that runs within a quickstart container. An attacker who gains write access to this DB will be able to corrupt your view of the stellar network, potentially inserting fake transactions, accounts, etc.

It is safe to open the horizon http port. Horizon is designed to listen on an internet-facing interface and provides no privileged operations on the port. At the same time admin port should only be exposed to a trusted network, as it provides no security itself.

The HTTP port for stellar-core should only be exposed to a trusted network, as it provides no security itself. An attacker that can make requests to the port will be able to perform administrative commands such as forcing a catchup or changing the logging level and more, many of which could be used to disrupt operations or deny service.

The peer port for stellar-core however can be exposed, and ideally would be routable from the internet. This would allow external peers to initiate connections to your node, improving connectivity of the overlay network. However, this is not required as your container will also establish outgoing connections to peers.

Accessing and debugging a running container

There will come a time when you want to inspect the running container, either to debug one of the services, to review logs, or perhaps some other administrative tasks. We do this by starting a new interactive shell inside the running container:

$ docker exec -it stellar /bin/bash

The command above assumes that you launched your container with the name stellar; Replace that name with whatever you chose if different. When run, it will open an interactive shell running as root within the container.

Restarting services

Services within the quickstart container are managed using supervisord and we recommend you use supervisor's shell to interact with running services. To launch the supervisor shell, open an interactive shell to the container and then run supervisorctl. You should then see a command prompt that looks like:

horizon                          RUNNING    pid 143, uptime 0:01:12
postgresql                       RUNNING    pid 126, uptime 0:01:13
stellar-core                     RUNNING    pid 125, uptime 0:01:13
supervisor>

From this prompt you can execute any of the supervisord commands:

# restart horizon
supervisor> restart horizon


# stop stellar-core
supervisor> stop stellar-core

You can learn more about what commands are available by using the help command.

Viewing logs

Logs can be found within the container at the path /var/log/supervisor/. A file is kept for both the stdout and stderr of the processes managed by supervisord. Additionally, you can use the tail command provided by supervisorctl.

Alternatively, to tail all logs into the container's output for all services, append the --logs option.

Accessing databases

The point of this project is to make running stellar's software within your own infrastructure easier, so that your software can more easily integrate with the stellar network. In many cases, you can integrate with horizon's REST API, but often times you'll want direct access to the database either horizon or stellar-core provide. This allows you to craft your own custom sql queries against the stellar network data.

This image manages two postgres databases: core for stellar-core's data and horizon for horizon's data. The username to use when connecting with your postgresql client or library is stellar. The password to use is dependent upon the mode your container is running in: Persistent mode uses a password supplied by you and ephemeral mode generates a password and prints it to the console upon container startup.

Example launch commands

Below is a list of various ways you might want to launch the quickstart container annotated to illustrate what options are enabled. It's also recommended that you should learn and get familiar with the docker command.

Launch an ephemeral pubnet node in the background:

$ docker run -d -p "8000:8000" --name stellar stellar/quickstart --pubnet

Launch an ephemeral testnet node in the foreground, exposing all ports:

$ docker run --rm -it \
    -p "8000:8000" \
    -p "11626:11626" \
    -p "11625:11625" \
    --name stellar \
    stellar/quickstart --testnet

Setup a new persistent node using the host directory /str:

$ docker run -it --rm \
    -v "/str:/opt/stellar" \
    --name stellar \
    stellar/quickstart --pubnet

Start a background persistent container for an already initialized host directory:

$ docker run -d \
    -v "/str:/opt/stellar" \
    -p "8000:8000" \
    --name stellar \
    stellar/quickstart --pubnet

Troubleshooting

Let us know what you're having trouble with! Open an issue or join us on our public slack channel.

More Repositories

1

stellar-core

Reference implementation for the peer-to-peer agent that manages the Stellar network.
C
3,098
star
2

go

Stellar's public monorepo of go code
Go
1,268
star
3

kelp

Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
Go
1,054
star
4

soroban-example-dapp

End-to-End Example Soroban Dapp
Rust
951
star
5

js-stellar-sdk

Main Stellar client library for the JavaScript language.
JavaScript
606
star
6

stellar-protocol

Developer discussion about possible changes to the protocol.
RPC
506
star
7

slingshot

A new blockchain architecture under active development, with a strong focus on scalability, privacy and safety
Rust
403
star
8

stellar-client

INACTIVE. Browser based client for stellard. This repository is inactive. It points to the stellard network, which is being replaced by stellar-core. Please refer to the replacement repository, interstellar-client, which points to the stellar-core network.
JavaScript
306
star
9

dashboard

JavaScript
215
star
10

java-stellar-sdk

Java
173
star
11

awesome-stellar

๐Ÿ‘จโ€๐Ÿš€ A curated list of Stellar applications, blog posts, educational resources, tools, and more.
159
star
12

js-stellar-base

The lowest-level stellar helper library. It consists of classes to read, write, hash, and sign Stellar xdr
JavaScript
103
star
13

stellar-wallet

Holds encrypted data. Used by stellar-client to store the user's key in a secure way.
JavaScript
103
star
14

django-polaris

An extendable Django app for building modular Stellar services
Python
95
star
15

rs-soroban-sdk

Rust SDK for Soroban contracts.
Rust
89
star
16

laboratory

JavaScript
77
star
17

freighter

Stellar chrome extension
TypeScript
72
star
18

new-docs

JavaScript
68
star
19

js-stellar-wallets

A library to make it easier to write wallets that interact with Stellar
TypeScript
62
star
20

rs-soroban-env

Rust environment for Soroban contracts.
Rust
57
star
21

stellar-demo-wallet

Provides a front-end interface to test SEP interoperability. Website at https://demo-wallet.stellar.org/
TypeScript
51
star
22

soroban-cli

CLI for Soroban contracts.
Rust
51
star
23

soroban-docs

Documentation for Soroban
MDX
50
star
24

soroban-examples

Example Soroban Contracts
Rust
47
star
25

packages

SDF - Packages
Shell
46
star
26

paper-wallet

HTML
43
star
27

os-projects

42
star
28

sorobanathon

Sorobanathon: First Light
42
star
29

starlight

Layer 2 payment channel protocol for the Stellar network.
Go
40
star
30

starbridge

Software that facilitates bridge builders who are connecting the Stellar network to other blockchains.
Go
39
star
31

account-viewer-v2

A simple tool to view an account on the Stellar network and make transactions from it.
TypeScript
37
star
32

stellar-docs

Documentation for Stellar
MDX
35
star
33

java-stellar-anchor-sdk

Java SDK for the Stellar network anchor development.
Kotlin
35
star
34

developers

Stellar developer portal site generator.
JavaScript
33
star
35

stellar-etl-airflow

Airflow DAGs for the Stellar ETL project
Python
31
star
36

stellar-disbursement-platform-backend

Stellar Disbursement Platform Backend
Go
28
star
37

stellar-etl

Stellar ETL will enable real-time analytics on the Stellar network
Go
28
star
38

js-xdr

Read/write XDR encoded data structures (RFC 4506)
JavaScript
24
star
39

js-soroban-client

Main Soroban client library for the Javascript language
TypeScript
23
star
40

xdrgen

A code generator for XDR
Rust
22
star
41

stellar-xdr

Staging area for future version of Stellar XDR.
RPC
18
star
42

rs-stellar-xdr

Rust lib for Stellar XDR.
Rust
18
star
43

docs-wallet

SCSS
17
star
44

stellar-disbursement-platform-frontend

Stellar Disbursement Platform Frontend
TypeScript
16
star
45

stellar-turrets

Reference implementation of the Stellar Turrets protocol
JavaScript
15
star
46

stellar-anchor-tests

A library and CLI tool for testing Stellar anchors.
TypeScript
13
star
47

typescript-wallet-sdk

Typescript Wallet SDK to build Stellar wallets
TypeScript
12
star
48

stories

JavaScript
12
star
49

hack-stellar

TypeScript
12
star
50

.github

11
star
51

moneygram-access-wallet-mvp

An MVP wallet integrated with MoneyGram Access
Python
11
star
52

stellar-tutorials

This repository holds tools and tutorials to help developers build on Stellar.
JavaScript
10
star
53

scaffold-soroban

Soroban example dapps
JavaScript
10
star
54

hackathon-get-started

๐Ÿ’ป All the resources you'll need to begin your Stellar project.
10
star
55

integration-tests

JavaScript
9
star
56

stellar-design-system

Components for Stellarโ€™s design system
TypeScript
9
star
57

supercluster

Stellar-core integration test automation tool
F#
9
star
58

bower-js-stellar-sdk

JavaScript
9
star
59

soroban-rpc

RPC server for Soroban contracts.
Go
9
star
60

react-starter

Stellar's starter kit for React projects.
TypeScript
9
star
61

stellar-core-prometheus-exporter

Stellar Core Prometheus Exporter
Python
8
star
62

scp-proofs

SCP proofs and models
Python
8
star
63

product-conventions

A layout of all conventions to be used by all Stellar frontend products
JavaScript
8
star
64

soroban-react-payment

Soroban example dapps
TypeScript
7
star
65

django-polaris-circle

A reusable Django app for Circle USDC custody support in django-polaris deployments
Python
6
star
66

fca00c-asteroids

Learn Soroban and compete for a top spot on the leaderboard in Fast, Cheap & Out of Control
Rust
6
star
67

sorobounty-spectacular

Sorobounty Spectacular
5
star
68

sep24-reference-ui

TypeScript
5
star
69

regulated-assets-poc

JavaScript
5
star
70

core-node-admin-panel

TypeScript
5
star
71

recoverysigner-firebase-auth

A simple demo frontend web app for performing Firebase phone auth for use with recoverysigner.
TypeScript
5
star
72

soroflare

The Soroban environment and vm running on a Cloudflare Worker. (a simplified version of the backend running fca00c.com)
Rust
5
star
73

kotlin-wallet-sdk

Kotlin Wallet SDK to build Stellar wallets
Kotlin
5
star
74

sorobounties

The Soroban content bounty program
5
star
75

stellar-community-fund-contracts

Rust
4
star
76

stellar-turrets-docs

Docs repo for the Stellar Turrets protocol
4
star
77

anchor-transfer-utils

Utilities for anchors and wallets implementing SEP6 transfer protocol
TypeScript
4
star
78

stellar-upgrade-web

JavaScript
4
star
79

stellar-upgrade

Go
4
star
80

convert-stellar-address

JavaScript
4
star
81

soroban-name-service

Soroban name service
Rust
4
star
82

soroban-react-atomic-swap

A react demo dapp for making an atomic swap on Soroban
TypeScript
4
star
83

recoverysigner-demo-client

A limited feature demo client for a SEP-30 Recoverysigner server.
JavaScript
4
star
84

soroban-quest

Soroban Quest is a gamified educational course where youโ€™ll learn Soroban and earn rewards!
Rust
4
star
85

solar-stellarorg

Stellar.org's Solar CSS framework theme
CSS
4
star
86

js-stellar-elements

Styled basic components for Stellar projects
JavaScript
3
star
87

solar-stellarorg-pages

CSS
3
star
88

golistcmp

A tool for comparing the output of 'go list -m -json all' executions.
Go
3
star
89

basic-payment-app

An example payments application demonstrating integrations of various features and SEPs in a user-facing product.
Svelte
3
star
90

soroban-dapps-challenge

Dapps for the Soroban Dapps Challenge
3
star
91

stellar-dbt-public

Public DBT instance to aid in data transformation for analytics purposes
Shell
3
star
92

bower-js-stellar-base

JavaScript
3
star
93

amm-reference-ui

A reference codebase to serve as a proof of concept for an AMM UI
TypeScript
3
star
94

helm-charts

Helm charts for deploying SDF maintained software
Smarty
3
star
95

stellar-account-prometheus-exporter

Stellar Account Prometheus Exporter - Monitor Stellar Network Accounts
Python
3
star
96

dts-xdr

A library for generating TypeScript declarations (.d.ts) for js-xdr auto-generated files.
JavaScript
3
star
97

crate-git-revision

Embed git revision into crates built and published.
Rust
2
star
98

actions

GitHub Actions for Stellar repositories.
TypeScript
2
star
99

project-viewer

Navigating projects on Stellar
Go
2
star
100

soroban-react-mint-token

An example dapp for minting tokens on Soroban
TypeScript
2
star