Skip to content

6. Data API Reference

syuan100 edited this page Jul 29, 2021 · 1 revision

Network

Reference: https://www.rosetta-api.org/docs/NetworkApi.html


/network/list

https://www.rosetta-api.org/docs/NetworkApi.html#networklist

Request:

{}

Response:

Schema

{
    "network_identifiers": [
        {
            "blockchain": "Helium",
            "network": "Mainnet"
        }
    ]
}

/network/options

https://www.rosetta-api.org/docs/NetworkApi.html#networkoptions

Request:

Schema

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

Response:

Schema

{
    "version": {
        "rosetta_version": "1.4.10",
        "node_version": "1.1.23"
    },
    "allow": {
        "operation_statuses": [
            {
                "status": "SUCCESS",
                "successful": true
            },
            {
                "status": "FAILURE",
                "successful": false
            }
        ],
        "operation_types": [
            "add_gateway_op",
            "assert_location_op",
            "create_htlc_op",
            "credit_op",
            "debit_op",
            "redeem_htlc_op"
        ],
        "errors": [
            {
                "code": 0,
                "message": "Endpoint not implemented",
                "retriable": false
            },
            {
                "code": 1,
                "message": "Object not found",
                "retriable": false
            },
            {
                "code": 2,
                "message": "Endpoint failed",
                "retriable": false
            },
            {
                "code": 3,
                "message": "Invalid parameter",
                "retriable": false
            },
            {
                "code": 4,
                "message": "InvalidPassword",
                "retriable": false
            },
            {
                "code": 5,
                "message": "Unable to derive address",
                "retriable": false
            },
            {
                "code": 6,
                "message": "Unable to parse intent",
                "retriable": false
            },
            {
                "code": 7,
                "message": "Unable to parse intermediate result",
                "retriable": false
            },
            {
                "code": 11,
                "message": "Unable to parse transaction into valid operations",
                "retriable": false
            },
            {
                "code": 8,
                "message": "Unable to decode address",
                "retriable": false
            },
            {
                "code": 9,
                "message": "Signature invalid",
                "retriable": false
            },
            {
                "code": 10,
                "message": "Environment variable missing",
                "retriable": false
            }
        ],
        "historical_balance_lookup": false,
        "call_methods": null,
        "balance_exemptions": null,
        "mempool_coins": false
    }
}

/network/status

https://www.rosetta-api.org/docs/NetworkApi.html#networkstatus

Request:

Schema

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

Response:

Schema

Helium specific notes:

Object Type Description
genesis_block_identifier BlockIdentifier Earliest available block (usually the latest snapshot)
oldest_block_identifier BlockIdentifier Same as genesis_block_identifier
sync_status SyncStatus current_index is the local head, target_index is the remote head, synced is true if current_index is within 100 blocks of target_index
peers []Peers Peers identified by their p2p multiaddr
{
    "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": "..."
        },
        {
            "peer_id": "..."
        },
        {
            "peer_id": "..."
        }
    ]
}

Account

Reference: https://www.rosetta-api.org/docs/AccountApi.html

/account/balance

https://www.rosetta-api.org/docs/AccountApi.html#accountbalance

Request:

Schema

{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "account_identifier": {
        "address": "..."
    }
}

Response:

Schema

{
    "block_identifier": {
        "index": 910762,
        "hash": "DHHmEkNYZ_eh5E_FqQrMpqGWcR0cFLSJlTvp9fXPeRI"
    },
    "balances": [
        {
            "value": "11580567966",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        {
            "value": "0",
            "currency": {
                "symbol": "HST",
                "decimals": 8
            }
        }
    ]
}

Block

Reference: https://www.rosetta-api.org/docs/BlockApi.html

/block

https://www.rosetta-api.org/docs/BlockApi.html#block

Request

Schema

{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "block_identifier": {
        "index": 912081,
        "hash": "Ut8CyGiruO31fRdeymzH4nbhYXTZX7dtZCq3SHCvQvE"
    }
}

Response

Schema

{
    "block": {
        "block_identifier": {
            "index": 912081,
            "hash": "Ut8CyGiruO31fRdeymzH4nbhYXTZX7dtZCq3SHCvQvE"
        },
        "parent_block_identifier": {
            "index": 912080,
            "hash": "YGjLIevh0P4DLibDM6vXqJwmNooGPBPLGYSBRXfasFQ"
        },
        "timestamp": 1625872925568,
        "transactions": [
            {
                "transaction_identifier": {
                    "hash": "..."
                },
                "operations": [
                    {
                        "operation_identifier": {
                            "index": 0
                        },
                        "type": "debit_op",
                        "status": "SUCCESS",
                        "account": {
                            "address": "..."
                        },
                        "amount": {
                            "value": "-2500000000",
                            "currency": {
                                "symbol": "HNT",
                                "decimals": 8
                            }
                        },
                        "metadata": {
                            "debit_category": "payment"
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 1
                        },
                        "type": "credit_op",
                        "status": "SUCCESS",
                        "account": {
                            "address": "..."
                        },
                        "amount": {
                            "value": "2500000000",
                            "currency": {
                                "symbol": "HNT",
                                "decimals": 8
                            }
                        },
                        "metadata": {
                            "credit_category": "payment"
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 2
                        },
                        "type": "debit_op",
                        "status": "SUCCESS",
                        "account": {
                            "address": "..."
                        },
                        "amount": {
                            "value": "-2812136",
                            "currency": {
                                "symbol": "HNT",
                                "decimals": 8
                            }
                        },
                        "metadata": {
                            "implicit_burn": true
                        }
                    }
                ]
            },
            {
                "transaction_identifier": {
                    "hash": "..."
                },
                "operations": [
                    {
                        "operation_identifier": {
                            "index": 0
                        },
                        "type": "debit_op",
                        "status": "SUCCESS",
                        "account": {
                            "address": "..."
                        },
                        "amount": {
                            "value": "0",
                            "currency": {
                                "symbol": "HNT",
                                "decimals": 8
                            }
                        },
                        "metadata": {
                            "base_fee": 55000,
                            "dc_fee": 55000,
                            "implicit_burn": false,
                            "staking_fee": 0
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 1
                        },
                        "type": "assert_location_op",
                        "status": "SUCCESS",
                        "metadata": {
                            "elevation": 37,
                            "gain": 23,
                            "gateway": "...",
                            "location": "...",
                            "owner": "..."
                        }
                    }
                ]
            }
        ]
    }
}

/block/transaction/

https://www.rosetta-api.org/docs/BlockApi.html#blocktransaction

Request

Schema

{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "block_identifier": {
        "index": 912081,
        "hash": "Ut8CyGiruO31fRdeymzH4nbhYXTZX7dtZCq3SHCvQvE"
    },
    "transaction_identifier": {
        "hash": "..."
    }
}

Response

Schema

{
    "transaction": {
        "transaction_identifier": {
            "hash": "..."
        },
        "operations": [
            {
                "operation_identifier": {
                    "index": 0
                },
                "type": "debit_op",
                "status": "SUCCESS",
                "account": {
                    "address": "..."
                },
                "amount": {
                    "value": "-2500000000",
                    "currency": {
                        "symbol": "HNT",
                        "decimals": 8
                    }
                },
                "metadata": {
                    "debit_category": "payment"
                }
            },
            {
                "operation_identifier": {
                    "index": 1
                },
                "type": "credit_op",
                "status": "SUCCESS",
                "account": {
                    "address": "..."
                },
                "amount": {
                    "value": "2500000000",
                    "currency": {
                        "symbol": "HNT",
                        "decimals": 8
                    }
                },
                "metadata": {
                    "credit_category": "payment"
                }
            },
            {
                "operation_identifier": {
                    "index": 2
                },
                "type": "debit_op",
                "status": "SUCCESS",
                "account": {
                    "address": "..."
                },
                "amount": {
                    "value": "-2812136",
                    "currency": {
                        "symbol": "HNT",
                        "decimals": 8
                    }
                },
                "metadata": {
                    "implicit_burn": true
                }
            }
        ]
    }
}