unchained
unchained copied to clipboard
Unchained is a multi-blockchain backend interface
Introduction
Unchained is a multi-blockchain backend interface with three main goals:
- Provide a common interface to multiple blockchains
- Provide additional information not always accessible from the node directly
- Provide realtime updates about blockchain transactions (pending and confirmed)
Table Of Contents
- Project Details
- Helpful Docs
- Coin Stack Components
- Notes
- Local Networking
- Docker-Compose Local Dev Instructions
- Prerequisites
- Running
- Kubernetes Local Dev Instructions
- Docker Desktop (macOS)
- Minikube (Linux)
Helpful Docs
Coin Stack Components
- Node - coin specific node daemon providing historical blockchain data (ex. bitcoind, geth, etc)
- Indexer - optional service that indexes transaction and balance history by address, or any other applicable information, if not provided by the node directly
- API - provides a base set of functionality via REST and WebSocket that can be extended with coin specific logic
Architecture Diagrams
| With Indexer | No Indexer |
|---|---|
Notes
- The ethereum coinstack is used in all examples. If you wish to run a different coinstack, just replace
ethereumwith the coinstack name you wish to run - All paths are relative to the root unchained project directory (ex.
unchained/[go|node]/{path}) - All
pulumicommands should be run in apulumi/directory (ex.pulumi/,coinstacks/ethereum/pulumi/)
Local Networking
We use traefik as a reverse-proxy to expose all of our docker containers. Traefik is exposed at port 80. Traefik Dashboard is exposed at port 8080
Traefik routes requests based on host name. which includes the coinstack name. For Example:
api.ethereum.localhost
Setup
- Each language subdirectory has setup requirements before running a coinstack locally
- Go -
unchained/go - Node -
unchained/node
- Go -
- Both
goandnodemodule have linter installed in git pre-commit hook. To set up the hook:cd node && yarn
Docker-Compose Local Dev Instructions
Lightweight local development environment
Prerequisites
- Install docker-compose
Running
-
unchained/node/packages/clientgenerates a typescript client for each coinstack using the generatedswagger.jsonfiles. To ensure everything successfully builds, make the golang coinstacks first:cd go && make -
Start the reverse proxy and any common service (ex. hot reloading):
docker-compose up -dNote:
-druns the containers in daemon (background) mode. If you want to see logs,-dcan be omitted. -
Start a coinstack:
cd node/coinstacks/ethereum && docker-compose up -
Visit http://api.ethereum.localhost/docs to view the OpenAPI documentation for the API
-
Tear down a coinstack (including docker volumes):
cd node/coinstacks/ethereum && docker-compose down -v
Common Issues
- If you are running Docker Desktop and see any
SIGKILLerrors, increase your resource limits in the Resources Tab. - To fix the error:
Run the following command to force building the local image from the rootError response from daemon: pull access denied for unchained-local, repository does not exist or may require 'docker login': denied: requested access to the resource is deniedunchained/directory:docker-compose up unchained-local