Skip to content

Latest commit

Β 

History

History
672 lines (490 loc) Β· 13.1 KB

blockchain.md

File metadata and controls

672 lines (490 loc) Β· 13.1 KB

Node and Blockchain

List of endpoints useful in work with ADAMANT blockchain in general.

Get Peers List

GET /api/peers
  • Description

    Get list of connected peer nodes using endpoint /api/peers.

    Node's information includes:

    • ip β€” IPv4 address of node

    • port β€” port number of ADAMANT node. 36666 for mainnet or 36667 for testnet.

    • state β€” state of the peer.

      Available values:

      • 2 β€” Connected
      • 1 β€” Disconnected
      • 0 β€” Banned
    • os β€” node's operating system

    • version β€” ADAMANT node software version

    • broadhash β€” broadhash on the peer node. Broadhash is established as an aggregated rolling hash of the past five blocks present in the database.

    • height β€” current node's blockchain height

    • updated β€” Unix timestamp based in ms, when peer updated

    • nonce β€” unique Identifier for the peer. Random string.

    Available parameters:

    • limit β€” how many nodes to retrieve
    • offset β€” offset value for results
    • You can use os, ip, and other parameters for filtering results
  • Example

    Request:

    GET https://endless.adamant.im/api/peers

    Response:

    {
      "success": true,
      "nodeTimestamp": 58052600,
      "peers": [
        {
          "ip": "194.32.79.175",
          "port": 36666,
          "state": 2,
          "os": "linux4.15.0-36-generic",
          "version": "0.4.0",
          "broadhash": "3dfdf6c7bbaf7537eac9c70432f7ba1cae835b9b15e4ecd97e147616dde67e62",
          "height": 10146365,
          "clock": null,
          "updated": 1562424199553,
          "nonce": "jxXV6g0sHJhmDubq"
        },
        {
          "ip": "144.217.93.8",
          "port": 36666,
          "state": 2,
          "os": "linux4.4.0-141-generic",
          "version": "0.4.0",
          "broadhash": "febfb2ac6fbf0a456fdb6a22d08e37dbe514e547ec7772a1f46c2d2595c89baa",
          "height": 10146364,
          "clock": null,
          "updated": 1562424195742,
          "nonce": "YngSDjA5MeUNk2iZ"
        }
      ]
    }

Get Peers Stats

GET /api/peers/count
  • Description

    Endpoint /api/peers/count returns count of connected, disconnected and banned peers for the requested node.

    ::: warning Each node maintains its own states for peers and may have discovered a different set of peers, so results can vary between nodes. :::

  • Example

    Request:

    GET https://endless.adamant.im/api/peers/count

    Response:

    {
      "success": true,
      "nodeTimestamp": 239414812,
      "connected": 136,
      "disconnected": 3,
      "banned": 0
    }

Get peer by IP and port

GET /api/peers/get
  • Description

    Finds and returns the known peer of the node. See Get Peers List to learn peer's properties.

    Required parameters:

    • ip β€” peer's IPv4 address
    • port β€” peer's port
  • Example

    Request:

    GET https://endless.adamant.im/api/peers/get?ip=138.201.152.191&port=36666

    Response:

    {
      "success": true,
      "nodeTimestamp": 239415353,
      "peer": {
        "ip": "138.201.152.191",
        "port": 36666,
        "state": 1,
        "os": "linux5.15.0-86-generic",
        "version": "0.8.3",
        "dappid": null,
        "broadhash": "15f6beddb5f68854618f0e06f35addadaeee067efd3cdaaae90f5beaf15cd370",
        "height": 38723235,
        "clock": null,
        "updated": 1713630137277,
        "nonce": "YWXG1LsX0QUw4tFD"
      }
    }

Get Loading Status

GET /api/loader/status
  • Description

    Endpoint /api/loader/status returns information on node's loading process.

  • Example

    Request:

    GET https://endless.adamant.im/api/loader/status

    Response for node on actual blockchain height:

    {
      "success": true,
      "nodeTimestamp": 58052355,
      "loaded": true,
      "now": 10144343,
      "blocksCount": 0
    }

    Response for node in sync process:

    {
      "success": true,
      "nodeTimestamp": 66424794,
      "loaded": true,
      "now": 1,
      "blocksCount": 1
    }

Get Synchronization Status

GET /api/loader/status/sync
  • Description

    Endpoint /api/loader/status/sync returns information on node's sync process with other peers:

    • syncing β€” true if node is still in sync process
    • blocks β€” current blockchain height to achieve if in sync process; 0 if syncing is done
    • height β€” node's blockchain height
    • broadhash β€” broadhash on the peer node. Broadhash is established as an aggregated rolling hash of the past five blocks present in the database.
    • consensus β€” consensus percentage with other nodes
  • Example

    Request:

    GET https://endless.adamant.im/api/loader/status/sync

    Response:

    {
      "success": true,
      "nodeTimestamp": 58052432,
      "syncing": false,
      "blocks": 0,
      "height": 10146332,
      "broadhash": "09f2f5614cf7209979dc1df2dd92d16aade904dae6c9b68bccaeb234647b3c18",
      "consensus": 94.32
    }

Get Ping Status

GET /api/loader/status/ping
  • Description

    Ping /api/loader/status/ping to check if the node is alive.

  • Example

    Request:

    GET https://endless.adamant.im/api/loader/status/ping

    Response:

    {
      "success": true
    }

Get Node Version

GET /api/peers/version
  • Description

    Endpoint /api/peers/version returns node's software information: version, build, and commit.

  • Example

    Request:

    GET https://endless.adamant.im/api/peers/version

    Response:

    {
      "success": true,
      "nodeTimestamp": 58052984,
      "build": "",
      "commit": "b07aaf9580dffb5cc95cc65f303f6f1e5fca7d9c",
      "version": "0.5.2"
    }

Get Blockchain Broadhash

GET /api/blocks/getBroadhash
  • Description

    Endpoint /api/blocks/getBroadhash returns broadhash on the node. Broadhash is established as an aggregated rolling hash of the past five blocks present in the database.

  • Example

    Request:

    GET https://endless.adamant.im/api/blocks/getBroadhash

    Response:

    {
      "success": true,
      "nodeTimestamp": 58645139,
      "broadhash": "e1aedd2818679c174e3f6e31891c34f4069927f33f145e1b81fe5d978733e794"
    }

Get Blockchain Epoch

GET /api/blocks/getEpoch
  • Description

    Endpoint /api/blocks/getEpoch returns the time when blockchain epoch starts. Value 2017-09-02T17:00:00.000Z is for ADAMANT mainnet.

  • Example

    Request:

    GET https://endless.adamant.im/api/blocks/getEpoch

    Response:

    {
      "success": true,
      "nodeTimestamp": 58646306,
      "epoch": "2017-09-02T17:00:00.000Z"
    }

Get Blockchain Height

GET /api/blocks/getHeight
  • Description

    Endpoint /api/blocks/getHeight returns current node's blockchain height.

  • Example

    Request:

    GET https://endless.adamant.im/api/blocks/getHeight

    Response:

    {
      "success": true,
      "nodeTimestamp": 58047354,
      "height": 10145318
    }

Get Blockchain Fee

GET /api/blocks/getFee
  • Description

    Endpoint /api/blocks/getFee returns the current fee value for type 0 (token transfer) transactions. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000).

  • Example

    Request:

    GET https://endless.adamant.im/api/blocks/getFee

    Response:

    {
      "success": true,
      "nodeTimestamp": 58046803,
      "fee": 50000000
    }

Get Blockchain Fees

GET /api/blocks/getFees
  • Description

    Endpoint /api/blocks/getFees returns current fee values for different transaction types:

    • send β€” token transfer, type 0
    • vote β€” voting for delegate, type 3
    • delegate β€” registration of a new delegate, type 2
    • old_chat_message β€” sending a message (not used for now)
    • chat_message β€” sending a message, type 8
    • state_store β€” storing data in KVS, type 9
    • profile_update β€” not used for now
    • avatar_upload β€” not used for now

    All values are integer amounts of 1/10^8 ADM tokens (1 ADM = 100000000).

    More information about blockchain fees: Transaction Fees.

  • Example

    Request:

    GET http://endless.adamant.im/api/blocks/getFees

    Response:

    {
      "success": true,
      "nodeTimestamp": 58046908,
      "fees": {
        "send": 50000000,
        "vote": 5000000000,
        "delegate": 300000000000,
        "old_chat_message": 500000,
        "chat_message": 100000,
        "state_store": 100000,
        "profile_update": 5000000,
        "avatar_upload": 10000000
      }
    }

Get Blockchain Nethash

GET /api/blocks/getNethash
  • Description

    Endpoint /api/blocks/getNethash describes the network. The nethash describes e.g. the Mainnet or the Testnet, that the node is connecting to.

  • Example

    Request:

    GET https://endless.adamant.im/api/blocks/getNethash

    Response:

    {
      "success": true,
      "nodeTimestamp": 58047702,
      "nethash": "bd330166898377fb28743ceef5e43a5d9d0a3efd9b3451fb7bc53530bb0a6d64"
    }

Get Blockchain Milestone

GET /api/blocks/getMilestone
  • Description

    Endpoint /api/blocks/getMilestone returns milestone β€” current slot height, which determines the reward a delegate will get for forging a block.

    More information about blockchain milestones: Milestones.

  • Example

    Request:

    GET https://endless.adamant.im/api/blocks/getMilestone

    Response:

    {
      "success": true,
      "nodeTimestamp": 58047777,
      "milestone": 1
    }

Get Blockchain Reward

GET /api/blocks/getReward
  • Description

    Endpoint /api/blocks/getReward returns reward β€” the reward a delegate will get for forging a block. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000). Depends on the current slot height (milestone).

  • Example

    Request:

    GET https://endless.adamant.im/api/blocks/getReward

    Response:

    {
      "success": true,
      "nodeTimestamp": 58047028,
      "reward": 45000000
    }

Get Total Supply of ADAMANT Tokens

GET /api/blocks/getSupply
  • Description

    Endpoint /api/blocks/getSupply returns total current supply of ADM tokens in the network. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000). Total supply increases with every new forged block.

  • Example

    Request:

    GET https://endless.adamant.im/api/blocks/getSupply

    Response:

    {
      "success": true,
      "nodeTimestamp": 58047218,
      "supply": 10198038140000000
    }

Get ADAMANT Blockchain Network Info

GET /api/blocks/getStatus
  • Description

    Integrative endpoint /api/blocks/getStatus returns ADAMANT blockchain network information with a single request:

  • Example

    Request:

    GET https://endless.adamant.im/api/blocks/getStatus

    Response:

    {
      "success": true,
      "nodeTimestamp": 58047435,
      "broadhash": "4a28272c915f74d118120bb47db547a18a7512e1d48092c48be86939a6d45b89",
      "epoch": "2017-09-02T17:00:00.000Z",
      "height": 10145334,
      "fee": 50000000,
      "milestone": 1,
      "nethash": "bd330166898377fb28743ceef5e43a5d9d0a3efd9b3451fb7bc53530bb0a6d64",
      "reward": 45000000,
      "supply": 10198040075000000
    }

Get Blockchain and Network Status

GET /api/node/status
  • Description

    Integrative endpoint /api/node/status returns both ADAMANT blockchain network information and Node information with a single request. Result includes network, version, loader and wsClient info.

    wsClient describes if node allows socket connections and port to connect.

  • Example

    Request:

    GET https://endless.adamant.im/api/node/status

    Response:

    {
      "success": true,
      "nodeTimestamp": 230021386,
      "loader": {
        "loaded": true,
        "now": 1031082,
        "syncing": false,
        "consensus": 100,
        "blocks": 0,
        "blocksCount": 0
      },
      "network": {
        "broadhash": "2d94f9070fe4ca236aaee9fd9a6863fd0b9291a80b96ac9e470408a852f0f3d8",
        "epoch": "2017-09-02T17:00:00.000Z",
        "height": 1034307,
        "fee": 50000000,
        "milestone": 0,
        "nethash": "38f153a81332dea86751451fd992df26a9249f0834f72f58f84ac31cceb70f43",
        "reward": 0,
        "supply": 9800000000000000
      },
      "version": {
        "build": "",
        "commit": "c32e740a83ef3ac6fdf7e579f7175b21be5c95e5",
        "version": "0.8.4"
      },
      "wsClient": {
        "enabled": true,
        "port": 36668
      }
    }