Ontology Developer Center
DISCOVERCOMMUNITYSUPPORT
  • Introduction
  • Discover Ontology
  • Getting Started
  • Glossary
  • Decentralized Identity and Data
    • ONT ID
      • Decentralized Identifiers
        • Method Specification for Ontology
        • Method Specification for Ethereum
        • Method Specification for BSC
      • Verifiable Credentials
        • Anonymous Credentials
      • ONT Login
        • Scenarios
        • Protocol Specification
        • Front-end JavaScript SDK
          • Integration and Usage
          • API Reference
        • Front-end UI SDK
          • Integration and Usage
          • API Reference
        • Back-end Go SDK
          • Integration and Usage
          • API Reference
        • Back-end Java SDK
          • Integration and Usage
          • API Reference
      • ONT TAG
        • Workflow
        • API Reference
      • Mercury
      • OScore
    • DDXF
      • Components and Interfaces
      • GREP
      • Overall Scheme
      • Solutions
        • Marketplace
          • Deployment
          • Scenarios
          • SaaS Tenant
          • Java SDK
        • Data Storage
          • Deployment
          • Java SDK
        • Resource Auditor
        • Offline Judge
      • Use Cases
        • E-Shops
  • ONTOLOGY ELEMENTS
    • Smart Contracts
      • Types of smart contracts
    • Token Protocols
    • Consensus Mechanism
    • Ontology Oracle
      • Oracle Process Flow
  • GUIDES & TUTORIALS
    • Development Guides
      • dApp Development
        • Using the dAPI
        • Data Synchronization
      • Smart Contract Development
        • EVM Contract
          • Development Environment and Tools
          • Wallet Setup
          • Contract Development
          • How to Deploy a Smart Contract with GetBlock
        • NeoVM Contract
          • Development tools and environment
          • Launching the IDE
          • Writing and editing program logic
          • Deploying and testing on private net
        • WASM Contract
          • Development Environment
          • Project Initiation - Hello World
          • Creating your own project
          • Development using SmartX
          • Runtime API
          • Contract Fundamentals
          • Inter-contract Interaction
          • Developing Contracts in C++
        • Publish Contract Source Code
    • Integration Guides
      • dApp Integration
        • dAPI Integration
          • Chrome Plugin
          • Mobile wallet dApp
          • QR code mechanism
          • Wake call mechanism
        • Cocos 2D-x
        • Unity 3D applications
      • Mobile Wallet Integration
        • SDK integration
        • dAPI Integration
          • In-wallet applications
          • QR code mechanism
          • Wake call mechanism
        • Stake
      • Using ONT ID
      • Exchange Integration
        • Exchange Docking Guide
        • Exchange API
      • Ontology for dApp Stores
    • EVM & Token Decimals Upgrade
  • ONTOLOGY NODE
    • Abstract
    • Node Deployment
      • Standard Node
      • Rosetta Node
    • Interacting with a Public Node
  • DEVELOPER TOOLS
    • dApp Development Framework
      • Punica CLI
      • Punica boxes
      • Solo Chain
    • IDE
    • APIs
      • HTTP API
        • Restful
        • WebSocket
        • Remote Procedure Call (RPC)
      • Explorer v2 API
        • Block
        • Address
        • Contract
        • Token
        • Transactions
        • ONT ID
        • Summary
        • Node
      • Native Token API
        • ONT Contract API
        • ONG Contract API
      • ONT ID Contract API
      • Web3 API
      • OScore Open API
      • Rosetta Node API
        • Data API
        • Construction API
      • DToken Contract API
      • DDXF
        • Marketplace Contract API
        • Storage API
      • Governance API
    • Digital Wallet
      • Chrome Plugin provider
      • Chrome Plugin dAPI
      • Mobile version provider
      • Mobile version dAPI
    • SDKs
    • Signing Server
      • Installation
      • API reference
  • COMMUNITY
    • Ecosystem Programs
    • Community Libraries
    • Community Events
    • Community Channels
    • Core Contributors
  • SUPPORT
    • FAQ
      • Basic blockchain concepts
      • Ontology Nodes
      • Ontology token protocols
      • Smart contracts
      • SDKs and APIs
    • Contact Us
Powered by GitBook
On this page
  • Overview
  • Environment Setup
  • Node Deployment
  • Configuration
  • Integrating using the Construction API

Was this helpful?

  1. ONTOLOGY NODE
  2. Node Deployment

Rosetta Node

Deploying a Rosetta specification compliant node

PreviousStandard NodeNextInteracting with a Public Node

Last updated 3 years ago

Was this helpful?

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 .

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) available 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 TestNet, 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.

Integrating using the Construction API

1. Create an account

2. Derive an account from the public key

3. Construct a transfer transaction

4. Signing the payload

A signing payload looks something like:

{
    "unsigned_transaction": "00d1fb2f5b77204e000000000000c409000000000000ffe723aefd01bac311d8b16ff8bfd594d77f31ee7100c66b14092118e0112274581b60dfb6fedcbfdcfc044be76a7cc814ffe723aefd01bac311d8b16ff8bfd594d77f31ee6a7cc8516a7cc86c51c1087472616e736665721400000000000000000000000000000000000000010068164f6e746f6c6f67792e4e61746976652e496e766f6b650000",
    "payloads": [
        {
            "hex_bytes": "732b2e24ac4966f4b43ab565499f09b676eca1c96d6d039d21cf9c8338ee008e",
            "address": "AGc9NrdF5MuMJpkFfZ3MWKa67ds6H2fzud",
            "signature_type": "ecdsa"
        },
        {
            "hex_bytes": "732b2e24ac4966f4b43ab565499f09b676eca1c96d6d039d21cf9c8338ee008e",
            "address": "Af6xrG7WB9wUKQ3aRDXnfba2G5DXjqejMS",
            "signature_type": "ecdsa"
        }
    ]
}

The content in the hex_bytes field is signed using the address and based on the the signature_type specified. You can create a request as follows:

{
	    "network_identifier":  {
            "blockchain": "ont",
            "network": "testnet"
        },
        "unsigned_transaction":"00d12981cfeec409000000000000204e000000000000ffe723aefd01bac311d8b16ff8bfd594d77f31ee7100c66b14092118e0112274581b60dfb6fedcbfdcfc044be76a7cc814ffe723aefd01bac311d8b16ff8bfd594d77f31ee6a7cc8516a7cc86c51c1087472616e736665721400000000000000000000000000000000000000010068164f6e746f6c6f67792e4e61746976652e496e766f6b650000",
        "signatures":[
        		{
	        	"signing_payload":{
	        		"address":"Af6xrG7WB9wUKQ3aRDXnfba2G5DXjqejMS",
	        		"hex_bytes":"14d840eb85340de4d7bcdc4b66d66c716a228e4c5ec5189c5ebfbd003b0528bb",
	        		"signature_type":"ecdsa"
	        	},
	        	"public_key":{
	        		"hex_bytes":"02263e2e1eecf7a45f21e9e0f865510966d4e93551d95876ecb3c42acf2b68aaae",
	        		"curve_type":"secp256k1"
	        	},
	        	"signature_type":"ecdsa",
	        	"hex_bytes":"0d92482c51240b7b8497ec8c1efb41d1d94e434433fb0b3642e4483ecd2083c672b9e73ff4194d84cc84012db78c2d283a4bb1dbec5dc66015a42dac0042f8d7"
        	},
        	{
	        	"signing_payload":{
	        		"address":"AGc9NrdF5MuMJpkFfZ3MWKa67ds6H2fzud",
	        		"hex_bytes":"14d840eb85340de4d7bcdc4b66d66c716a228e4c5ec5189c5ebfbd003b0528bb",
	        		"signature_type":"ecdsa"
	        	},
	        	"public_key":{
	        		"hex_bytes":"03944e3ff777b14add03a76fd6767aaf4a65c227ec201375d9118d4e6b272494c7",
	        		"curve_type":"secp256k1"
	        	},
	        	"signature_type":"ecdsa",
	        	"hex_bytes":"637fdd1ac4b0cc5f36334b48b5fcd9494531ba88b5ec3e6ceb0fc49461e0e856f8a3aa4394be2c4a15a0358767a66d1acbf9a2ac9a12e4c628c9f8762db353db"
        	}
        ]
}

5. Constructing a signed transaction

6. Sending a transaction

7. Fetching a transaction hash

Integrating Ontology using the Rosetta node involves the following procedure:

You can create an Ontology wallet account using the or the Ontology SDKs.

The public key of a wallet account can be used to invoke the API method to fetch the corresponding account address in hex or base58 format.

The API method can be invoked to create an unsigned transaction and the signing payload.

The and API methods can be called to create a request and fetch transaction metadata respectively. The method can be used to parse transaction details and to check and verify the transaction parameters.

The signing payload from the previous step needs to be signed. This can be done using Ontology's SDKs or the .

The method can be invoked with a request such as the one illustrated in the previous step in order to obtain a signed transaction.

A signed_transaction can be submitted to the node using the API method.

The method can be used to fetch the transaction hash for a signed transaction. The transaction status can can then be checked by invoking the or API methods with the obtained hash.

download Docker
Rosetta Node API
construction API
Node CLI
signing server
block/transaction
mempool/transaction
construction/derive
construction/payload
construction/preprocess
construction/metadata
construction/parse
construction/combine
construction/submit
construction/hash