Skip to content

DigiByte Server implementation using Coinbase's Rosetta (NodeJS) SDK

Notifications You must be signed in to change notification settings

SmartArray/digibyte-rosetta-server

Repository files navigation

Rosetta

DigiByte Rosetta Server (beta)

Node Version: 1.0.0
Rosetta Version: 1.4.1

DigiByte Rosetta Node offering a unified API according to the standard proposed by Coinbase.

This implementation is a Proof-of-Concept implementation for the NodeJS Rosetta SDK developed by DigiByte

Prerequisites

  1. Install docker and git for your system

Docker Build Steps

  1. Clone the container using git
git clone https://github.com/SmartArray/digibyte-rosetta-server.git
  1. Build the docker image
# Build the docker image for testnet (may take a while).
# Other build args are documented in ./Dockerfile
cd digibyte-rosetta-server
docker build -t digibyte/rosetta:latest --build-arg use_testnet=1 .
  1. Start the docker container
# This command will start the docker container.
# In this example, docker will forward two ports: 8080, and 12026.
# Port 8080/tcp is the port of the rosetta api server.
# Port 12026/tcp is the p2p testnet port.
# If you are using mainnet, make sure you replace the port 12026 with 12024.
docker run -p 12026:12026 -p 8080:8080 digibyte/rosetta:latest

Test

Run npm run test in order to run js unit tests. Run npm run test-api in order to test the data api and construction api in an online/offline environment built with docker-compose.

Several example requests to test the reachability of your node using curl are shown in this document: Example Requests. An example on how to validate a mainnet account balance is shown here: Validation

Current State

Currently, only the Rosetta Data API is implemented by this node. The Construction API will be completed soon.

Implementation Details

This node implementation is using the experimental Rosetta Node SDK.

A UTXO-Indexing Middleware was implemented to enable balance lookups. Historical balance lookups are supported as well. By using the Syncer class of the Rosetta SDK, the sync has become exceptionally reliable and even reorgs are supported very well. LevelDB (the same database that is being used in Bitcoin and its forks) is used to store the UTXO data. A space efficient encoding was chosen in order to avoid redundancy and to save some disk space (usage: 6.7G, as of 08th September, 2020), as described here.

  • Fast, reliable sync
  • Space efficient, non-redundant implementation
  • Tested with addresses that have more than 399k transactions (historical balance calculation may take several seconds for these accounts)
  • Balances are subtracted and UTXOs removed on reorgs (which happen several times a day)

Note, that the addition of an UTXO database is heavily discussed in the official Bitcoin Mailgroup. As soon as this feature is added, many altcoins will probably apply the changes too, and the above UTXO middleware will most likely become obsolete.

ToDos

  • Implement Construction API for Offline and Online Environments
  • Test the node using coinbase's rosetta-cli (Results)
  • Run the mainnet node and wait for full sync
  • Test some utxo balance checks (Results)
  • Setup Continious Integration

About

DigiByte Server implementation using Coinbase's Rosetta (NodeJS) SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published