SterL / unchained

Unchained is a multi-blockchain backend interface

Home Page:https://api.ethereum.shapeshift.com/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

ShapeShift ShapeShift ShapeShift CircleCI

Unchained is a multi-blockchain backend interface with three main goals:

  1. Provide a common interface to multiple blockchains
  2. Provide additional information not always accessible from the node directly
  3. Provide realtime updates about blockchain transactions (pending and confirmed)

Table Of Contents

Helpful Docs

Project Structure

  • packages - shared internal packages across coinstacks
  • coinstacks/common - common coinstack logic to reduce duplication
  • coinstacks/{coin} - coin specific logic
  • **/pulumi - pulumi infrastructure logic for deployment

Coin Stack Components

  • Blockchain Full Node - coin specific daemon providing historical blockchain data (ie. bitcoind, geth, etc)
  • Indexer - indexes transaction and balance history by address (if not provided by the node directly)
  • Ingester - ingests blockchain data providing:
    • websocket notification of any newly confirmed or pending transactions
    • stream of historical transaction history
    • additional parsing logic not provided by the indexer or node
  • Common API - a REST API that provides necessary data to a client in a common format across all blockchains

Coin Stack Architecture

Dependencies

Notes

  • The ethereum coinstack is used in all examples. If you wish to run a different coinstack, just replace ethereum with the coinstack name you wish to run
  • All paths are relative to the root unchained directory (ex. unchained/{path})
  • All pulumi commands should be run in a pulumi/ directory (ex. pulumi/, coinstacks/ethereum/pulumi/)

Initial Setup

  • Install Node.js LTS
    • (Optional) use nvm to automatically install the node version specified in .nvmrc
      nvm use
  • Install Yarn
    npm install --global yarn
  • Install dependencies and build:
    yarn && yarn build

Ports

  • API: 31300
  • MongoDB: 27017
  • RabbitMQ: 30672
  • RabbitMQ Admin: 31672

Docker-Compose Local Dev Instructions

Lightweight local development environment

Prerequisites

  • Install docker-compose
  • Copy sample env file:
    cp coinstacks/ethereum/sample.env coinstacks/ethereum/.env
  • Fill out any missing environment variables

Running

  • To spin up a coinstack:
    • API only (watcher service is for hot reloading):
      COINSTACK=ethereum docker-compose up api watcher
    • API + Ingester (more resource intensive):
      COINSTACK=ethereum docker-compose up
  • To completely tear down the coinstack (including docker volumes):
    COINSTACK=ethereum docker-compose down -v

Toubleshooting: the api claims to be running on listening at http://localhost:3000; however in docker compose its actually running on http://localhost:31300

Kubernetes Local Dev Instructions

Mirrors production kubernetes environment as closely as possible


Docker Desktop (macOS)

Minikube (Linux)

About

Unchained is a multi-blockchain backend interface

https://api.ethereum.shapeshift.com/docs/

License:MIT License


Languages

Language:TypeScript 95.0%Language:Shell 4.0%Language:Dockerfile 0.6%Language:Makefile 0.3%Language:JavaScript 0.1%