Rosetta Node

Deploying a Rosetta specification compliant node

Overview

Here we lay out the procedure one needs to follow to deploy an Ontology node that adheres to Rosetta's blockchain standards. By complying to the Rosetta blockchain specifications, we at Ontology aim to streamline the development process for blockchain developers by ensuring certain aspects of the system are structured in a manner such that basic operations such as the deployment process, communication, and certain data formats are standardized, thus increasing the overall flexibility of the system.

Environment Setup

Before running any of the commands specified below, please ensure that you are running the latest version of Docker. If you don't have it installed on your system already, please follow this link to download Docker.

Next, clone the Ontology Rosetta node source code library using the following command:

git clone https://github.com/ontio/ontology-rosetta.git

We will be building the node directly from the source code.

The Dockerfile already contains all the necessary dependencies. Within the directory, please run the following command to build the docker image:

make docker

Node Deployment

First, we create a new directory where all the node details will be stored.

Please ensure that you have enough disk space (at least 100GB free) to store the chain and operation data. This establishes the smoothness of node operation and lowers the need for maintenance over time.

mkdir Chain

Next, run the ont-rosetta image using the command specified below. Note that we mount three volumes into the container. The three volumes store log data, block data, and allow access to the host configuration file.

# you are using the default config in this repo
docker run --name ont-rosetta -d -v $(realpath Log):/data/Log -v $(realpath Chain):/data/Chain -v $(realpath rosetta-config.json):/data/rosetta-config.json -p 9090:8080 ontology-rosetta:latest

In case you wish to connect to the test net, set the NETWORK_ID to 2 as such:

docker run --name ont-rosetta -d --env NETWORK_ID=2 -v $(realpath Log):/data/Log -v $(realpath Chain):/data/Chain -v $(realpath rosetta-config.json):/data/rosetta-config.json -p 9090:8080 ontology-rosetta:latest

Configuration

The default configuration in the rosetta-config.json file is as follows:

{
"rosetta": {
"version": "1.3.1",
"port": 8080,
"block_wait_time": 1
},
"monitorOEP4ScriptHash": []
}

Field

Description

version

Rosetta SDK version

port

Rosetta restful API port

block_wait_time

Time between subsequent block scans (in seconds)

monitorOEP4ScriptHash

OEP4 token contract hash to be monitored

Please follow the link below for Rosetta node API reference.