Skip to content
Steven Yuan edited this page Jul 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, 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 --ulimit "nofile=100000:100000" -v "$(pwd)/helium-data:/app/blockchain-node/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 --ulimit "nofile=100000:100000" -v "$(pwd)/helium-data:/app/blockchain-node/data" -v "$(pwd)/helium-logs:/app/blockchain-node/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:

  • Helium Data API
  • Helium Construction API

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"
        },
        {
            "peer_id": "/p2p/1129HSVxRtFxCqQSeQmMAnUaHcZwJZ1QL9MkUpjaNRAiotHVXvHp"
        },
        {
            "peer_id": "/p2p/1129VDpEVoDToAJM9qrxTLGnWMxjbUqfdGaV37r6vFQFPn5hZJhp"
        },
        {
            "peer_id": "/p2p/112Nn1GuhjrUfCengXGMwkhz7mhxSqy7hiMSxYM978aqs8AWUCrv"
        },
        {
            "peer_id": "/p2p/112RGsh8FK8Q2rs1UPPG9rsiGUw7xi2wVt863QMwpC8n8o1SXz65"
        },
        {
            "peer_id": "/p2p/112n8jCK1vypLwX5iToKgfXMii2u9RAs3XnchJDEC9Ms5LRV7hmN"
        },
        {
            "peer_id": "/p2p/11AZPAJk78uW3nRoochBSUABuxwMDNU1Gqb7mvUEGJveboaXkVt"
        },
        {
            "peer_id": "/p2p/11nDRpmkJMZeHYfYkE5hp9G1UPNU1BzhYBiniExptvsSnSTQM4d"
        },
        {
            "peer_id": "/p2p/11zvnDe19AhzDfZfw6cLhKurs1vJ9i4YYDEn5c89y2PJkJrsxf2"
        }
    ]
}