Skip to content
Steven Yuan edited this page Jul 29, 2021 · 22 revisions

Structure

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

Limitations

While this implementation aims to achieve Rosetta expectations as described here, there are some limitations to provide a better user experience when deploying the API:

  • No historical balances
  • No syncing from Genesis (use latest snapshot provided by Helium repos)

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 cannot be queried. If historic data is required, it is suggested to deploy an instance of blockchain-etl that contains the full historic record in a more performant database for complex historic queries.

Quick start

Build

docker build . -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 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:/var/data/log"  -p 8080:8080 -p 44158:44158 rosetta-helium:latest

*Please wait 5 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
reward_v1 Supported
reward_v2 Supported
security_coinbase_v1 Supported
security_exchange_v1 Supported
token_burn_v1 Supported
transfer_hotspot_v1 Supported
stake_validator_v1 Supported
unstake_validator_v1 Supported
transfer_validator_v1 Supported
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
dc_coinbase_v1 Pass through
state_channel_close_v1 Pass through
gen_gateway_v1 Pass through
poc_request_v1 Pass through
poc_receipt_v1 Pass through
consensus_group_v1 Pass through
vars_v1 Pass through
price_oracle_v1 Pass through