go-apla

command module
v0.0.0-...-8e17a21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2020 License: GPL-2.0 Imports: 2 Imported by: 0

README

Throughput Graph

PRs Welcome Go Report Card Build Status Documentation API Reference Gitter Slack Status

About Apla

Apla blockchain platform is a secure, simple and compliant blockchain infrastructure for the fast-growing global collaborative economy. It was developed for building digital ecosystems. The platform includes an integrated application development environment with a multi-level system of access rights to data, interfaces and smart contracts.

For more information about Apla, visit Apla website.

We are open to new ideas and contributions and will be happy to see you among our active contributors to the source code, documentation, or whatever part you find inspiring in Apla. See our Contribution Guide for more information.

Getting started

You can get started with Apla in several ways.

Apla Testnet

Apla Testnet is the network for testing purposes. You can explore Apla features, build apps from scratch and test your apps in the real network environment.

You can explore Apla testnet from your browser. You don't need to install anything to do so. Just visit https://testapla0.apla.io/.

If you want to install Apla frontend (Molis) on your computer:

  1. Download the latest apla-front release for testnet.

  2. Follow the instructions in apla-front repository README.

Apla Quickstart

Apla Quickstart is a compact software package that you can use to deploy the Apla blockchain network on a local computer. Quickstart installs 1 to 5 nodes alongside the platform’s client software.

Quickstart is aimed at providing end users with an idea of how Apla blockchain works and includes usage examples of graphical interface elements as well as smart-contracts.

Quickstart is available for computers running MacOS and Linux.

Apla Quickstart for Linux and MacOS

Deploying the Apla blockchain platform

Ready to deploy your own network? You can find out how to do that using our Apla blockchain network deployment guide.

About the backend components

Apla's backend has the following components:

  • go-apla service

    • TCP server
    • API server
  • PostgreSQL database system

  • Centrifugo notification service

PostgreSQL database system

Each Apla node use PostgreSQL database system to store its current state database.

Testing and production environment considerations:

  • Testing environment. You can deploy a single instance of PostgreSQL database system for all nodes. In this case, you must create PostgreSQL databases for each node. All nodes will connect to their databases located on one PostgreSQL instance.

  • Production environment. It is recommended to use a separate instance of PostgreSQL database system for each node. Each node must connect only to its own PostgreSQL database instance. It is not requred to deploy this instance on the same host with other backend components.

Centrifugo notification server

Centrifugo is a notification service that receives notifications from go-apla TCP-server and sends them to the frontend (Molis client) so that users can see status of their transactions.

Centrifugo is a unified notification service for all nodes in an Apla blockchain platform. When Molis client connects to a go-apla API service, it receives the IP-address of Centrifugo host and connects to it via a websocket.

Testing and production environment considerations:

  • Testing environment. You can deploy centrifugo service on the same host with other backend components. It can be a single centrifugo service for all nodes, or each node may connect to its own centrifugo instance.

  • Production environment. You must have at least several dedicated centrifugo hosts.

Go-apla

Go-apla is the kernel of an Apla node. It consists of two services: TCP-server and API-server.

  • TCP-server supports the interaction between Apla nodes.
  • API-server supports the interaction between Molis clients and Apla nodes.

Testing and production environment considerations:

  • Testing environment. You can deploy go-apla service with other backend components on one host.

  • Production environment. You must deploy go-apla services on dedicated hosts.

Installation instructions

For a detailed guide, see Apla blockchain network deployment guide.

Directories

In this example, backend components are locatesd in the following directories:

  • /opt/apla/go-apla go-apla.
  • /opt/apla/go-apla/node1 node data directory.
  • /opt/apla/centrifugo centrifugo.

Prerequisites and dependencies

  • Go versions 1.10.x and above
  • Centrifugo version 1.8
  • Postgresql versions 10 and above

Postgres database

  1. Change user's password postgres to Apla's default password.
    sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'apla'"
  1. Create a node current state database.
    sudo -u postgres psql -c "CREATE DATABASE apladb"

Centrifugo configuration

  1. Specify Centrifugo secret in the Centrifugo configuration file.
    echo '{"secret":"CENT_SECRET"}' > config.json

Installing go-apla

  1. Download and build the latest release:
    go get -v github.com/AplaProject/go-apla
  1. Copy the go-apla binary from the Go workspace to the destination directory (/opt/apla/go-apla in this example).
    cp $HOME/go/bin/go-apla /opt/apla/go-apla

Configure the node

  1. Create the node configuration file:
    /opt/apla/go-apla/go-apla config \
        --dataDir=/opt/apla/go-apla/node1 \
        --dbName=apladb \
        --centSecret="CENT_SECRET" --centUrl=http://10.10.99.1:8000 \
        --httpHost=10.10.99.1 \
        --httpPort=7079 \
        --tcpHost=10.10.99.1 \
        --tcpPort=7078
  1. Generate node keys:
    /opt/apla/go-apla/go-apla generateKeys \
        --config=/opt/apla/go-apla/node1/config.toml
  1. Genereate the first block. If you are creating your own blockchain network. you must use the --test=true option. Otherwise you will not be able to create new accounts.
    /opt/apla/go-apla/go-apla generateFirstBlock \
        --config=/opt/apla/go-apla/node1/config.toml \
        --test=true
  1. Initialize the database.

    /opt/apla/go-apla/go-apla initDatabase \
        --config=/opt/apla/go-apla/node1/config.toml

Starting go-apla

To start the first node backend, you must start two services: centrifugo and go-apla.

  1. Run centrifugo:
    /opt/apla/centrifugo/centrifugo \
        -a 10.10.99.1 -p 8000 \
        --config /opt/apla/centrifugo/config.json
  1. Run go-apla:
    /opt/apla/go-apla/go-apla start \
        --config=/opt/apla/go-apla/node1/config.toml

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL