Skip to content
TechPay
  • Website
  • GitHub
  • Discord
  • Twitter
Search
TechPay
  • betterdocs_homepage

Quick Start

  • Short Guide

Staking

  • Quick start
  • Overview
  • Stake on TechPay
  • Run a Validator Node
  • Run a Read-only node
  • Run a Testnet Validator
  • Testnet Faucet
  • Troubleshooting
  • Run a Full node
  • Run a Testnet read node

API

  • Public API endpoints
  • Getting Started
  • Installation
  • GraphQL Schema Basics
  • Schema Structure
  • Implementation Details and Notes
  • Covalent indexing and querying API

Tutorials

  • Set up metamask wallet
  • Deploy a Smart Contract
  • Set up Metamask (testnet)
  • Verify a Deployed Smart Contract
  • Create a Fixed-cap Asset
  • Create a Variable-cap Asset
  • Create a Local Test Network

Technology

  • Overview
  • Sirius pBFT
  • Proof of Stake
  • Transaction Fees
  • FAQ

How to use Ledger Nano with TechPay

  • Manage TechPay Assets with Ledger Nano S
  • How to Navigate techPay TPC
  • How to Check Your Account Balance
  • How to Receive TechPay Assets
  • How to Send TechPay Assets
  • Ledger FAQ
  • Home
  • Docs
  • API
  • Installation

Installation

Table of Contents
  • What you need
  • Building process
    • Configuration

What you need #

Please note that an official binary distribution is not available at the moment. To build your own TechPay GraphQL API, you need to have following:

  • Working MongoDB database installation.
  • Go version 1.13 or later configured and ready,
  • TechPay Sirius Full Node up and running on desired network.

You do have another option. For initial testing and development, you can use our own test playground. The API server is deployed at https://xapi2.techpay.io/api for regular GraphQL queries andhttps://xapi2.techpay.io/graphql for Web Socket subscriptions. Feel free to connect and try your queries. Fine tune your application before committing to deploy your own instance.

Building process #

Building your API server is a fairly straight forward process. First clone the repository to your local machine. Do not clone the project into $GOPATH, due to the Go modules. Instead, use any other location.

$ git clone https://github.com/TechPay-io/graphql-api.git

Once you have the copy on your machine, build the executable:

$ cd techpay-api-graphql
$ go build -o ./build/apiserver ./cmd/apiserver

The API server executable will be created in the <build> folder of the project. You can change the location by changing the output path in the Go building command above.

To run your copy of the API server, simply run:

$ build/apiserver

Configuration #

The API server already contains some most common configuration options as default values and you don’t have to change them most of the time. The default values are:

  • The network binding address is localhost.
  • Default listening port is 16761.
  • Default Sirius IPC interface is ~/.sirius/data/sirius.ipc.
  • MongoDB connection address is mongodb://localhost:27017.
  • Default logging level is INFO.

If you want to change one of the default values, you need to create a configuration file. The API server can read configuration options from several configuration formats, namely JSON, TOML, YAML, HCL, envfile and Java properties config files. Please choose the one you are most familiar with. The name of the configuration file is expected to be “apiserver” with extension which corresponds with the file format of your choosing.

Example YAML file looks like this:

server:
    bind: 127.0.0.1:16761    
sirius:
    url: /var/photon/data/sirius.ipc
log:
    level: Debug
mongo:
    url: mongodb://127.0.0.1:27017
cors:
    origins: *

You can keep the config file on with the API server executable, or you can save it on the home folder under the .techpayapi sub-folder. On MacOS the expected path is Library/TechPayApi.

What are your Feelings
Getting StartedGraphQL Schema Basics
Table of Contents
  • What you need
  • Building process
    • Configuration

Copyright © 2023 TechPay