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:
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:
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.
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.
In case you wish to connect to the TestNet, set the NETWORK_ID
to 2 as such:
Configuration
The default configuration in the rosetta-config.json
file is as follows:
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.
Rosetta Node APIIntegrating using the Construction API
Integrating Ontology using the Rosetta node construction API involves the following procedure:
1. Create an account
You can create an Ontology wallet account using the Node CLI or the Ontology SDKs.
2. Derive an account from the public key
The public key of a wallet account can be used to invoke the construction/derive
API method to fetch the corresponding account address in hex
or base58
format.
3. Construct a transfer transaction
The construction/payload
API method can be invoked to create an unsigned transaction and the signing payload.
The construction/preprocess
and construction/metadata
API methods can be called to create a request and fetch transaction metadata respectively. The construction/parse
method can be used to parse transaction details and to check and verify the transaction parameters.
4. Signing the payload
The signing payload from the previous step needs to be signed. This can be done using Ontology's SDKs or the signing server.
A signing payload looks something like:
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:
5. Constructing a signed transaction
The construction/combine
method can be invoked with a request such as the one illustrated in the previous step in order to obtain a signed transaction.
6. Sending a transaction
A signed_transaction
can be submitted to the node using the construction/submit
API method.
7. Fetching a transaction hash
The construction/hash
method can be used to fetch the transaction hash for a signed transaction. The transaction status can can then be checked by invoking the block/transaction
or mempool/transaction
API methods with the obtained hash.
Last updated