Skip to content
Steven Yuan edited this page Dec 9, 2021 · 22 revisions

Structure

This implementation of the Rosetta API for the Helium blockchain consists of three components wrapped within a docker environment:

  • Core Rosetta API interface (golang)
  • Blockchain node (erlang)
  • Transaction constructor (nodejs)

Limitations

While this implementation aims to achieve Rosetta expectations as described here, we do not currently support syncing from Genesis for Mainnet. Instead, it is best practice on the Helium network to use latest snapshot agreed upon by validators.

The reason for the above is so that syncing nodes can be much quicker and much lighter than processing the entire blockchain. Because of this, historic information past the starting block cannot be queried.

Quick start

Build

Mainnet:

docker build . -t rosetta-helium:latest

Testnet:

docker build . -f Dockerfile_testnet -t rosetta-helium:latest

Run*

Local data is stored in helium-data

docker run -d --rm --init --ulimit "nofile=1000000:1000000" -v "$(pwd)/helium-data:/data" -p 8080:8080 -p 44158:44158 rosetta-helium:latest

If you would like to easily access the blockchain_node logs, use the command below. Logs will be stored in helium-logs

docker run -d --rm --init --ulimit "nofile=1000000:1000000" -v "$(pwd)/helium-data:/data" -v "$(pwd)/helium-logs:/opt/blockchain_node/log"  -p 8080:8080 -p 44158:44158 rosetta-helium:latest

Otherwise, you can run the container with out the daemon flag -d as all logs will be ported to the container's STDOUT.

docker run --rm --init --ulimit "nofile=1000000:1000000" -v "$(pwd)/helium-data:/data" -p 8080:8080 -p 44158:44158 rosetta-helium:latest

*Please wait 10-15 minutes for the node to boot up, connect to peers, and expose necessary endpoints before using.

Usage

The Rosetta API lives at port 8080 for both the Data API and Construction API. Click the links below to view specific implementations and supported operations for each endpoint below:

As a quick test, you can try posting the JSON below to localhost:8080/network/status to see if the node is ready to use:

{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    }
}

If you see something similar to the output below, you're good to go:

{
    "current_block_identifier": {
        "index": 912081,
        "hash": "Ut8CyGiruO31fRdeymzH4nbhYXTZX7dtZCq3SHCvQvE"
    },
    "current_block_timestamp": 1625780220000,
    "genesis_block_identifier": {
        "index": 910531,
        "hash": "XDnrsImMJCyEKB6JtcS7VCBPrJbQAD4GsFQIv4VzZT8"
    },
    "oldest_block_identifier": {
        "index": 910531,
        "hash": "XDnrsImMJCyEKB6JtcS7VCBPrJbQAD4GsFQIv4VzZT8"
    },
    "sync_status": {
        "current_index": 912081,
        "target_index": 913827,
        "synced": false
    },
    "peers": [
        {
            "peer_id": "/p2p/1123Uv91jSzGAyksPkyphLf7vp6VnWRVTcZfi9kS1Hgr7GArYKzf"
        },
        {
            "peer_id": "/p2p/1123wkBL6LuPSGHhmNP8A1s8LcfdNLbzMcXj9G6ZdwjHYthvY3t8"
        },
        {
            "peer_id": "/p2p/1125PK3KHz3w8BSvQnTVKNgpP78Rz1fMd9BiypqVzfyRfnzXBNwU"
        }
    ]
}

Now you're ready to learn how to construct a transaction!

Supported Transactions (At-a-glance)

Transaction Data API Construction API
payment_v1 Supported
payment_v2 Supported Supported
rewards_v1 Supported
rewards_v2 Supported
security_coinbase_v1 Supported
security_exchange_v1 Supported
token_burn_v1 Supported
transfer_hotspot_v1 Supported
transfer_hotspot_v2 TBD
stake_validator_v1 Supported
unstake_validator_v1 Supported
transfer_validator_v1 Supported
transfer_validator_stake_v1 TBD
create_htlc_v1 Supported
redeem_htlc_v1 Supported
add_gateway_v1 Supported
assert_location_v1 Supported
assert_location_v2 Supported
oui_v1 Supported
routing_v1 Supported
state_channel_open_v1 Supported
update_gateway_oui_v1 TBD
coinbase_v1 Supported (Testnet only)
dc_coinbase_v1 Pass through
security_coinbase_v1 Pass through
state_channel_close_v1 Pass through
gen_gateway_v1 Pass through
gen_validator_v1 Pass through
gen_price_oracle_v1 Pass through
poc_request_v1 Pass through
poc_receipt_v1 Pass through
consensus_group_v1 Pass through
consensus_group_failure_v1 Pass through
vars_v1 Pass through
price_oracle_v1 Pass through
token_burn_exchange_rate_v1 Pass through
validator_heartbeat_v1 Pass through