ayeowch / bitnodes

Bitnodes estimates the relative size of the Bitcoin peer-to-peer network by finding all of its reachable nodes.

Home Page:https://bitnodes.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API & Named Fields

mkohlhaas opened this issue · comments

Hi Addy,

would it be possible to name all the fields in the API? It would make JSON handling so much easier!

E.g. List Nodes.

Instead of:

{
    "timestamp": 1656291918,
    "total_nodes": 15037,
    "latest_height": 742491,
    "nodes": {
        "qp6ro3mnogsi7manj3gdt5xhic43n45fumvg527z5uvtoy3vyp7re6yd.onion:8333": [
            70016,
            "/Satoshi:22.0.0/",
            1656188302,
            1037,
            742491,
            null,
            null,
            null,
            0.0,
            0.0,
            null,
            "TOR",
            "Tor network"
        ],
        ...
        "93.138.52.93:8333": [
            70016,
            "/Satoshi:22.0.0/",
            1656217338,
            1032,
            742491,
            "93-138-52-93.adsl.net.t-com.hr",
            "Zagreb",
            "HR",
            45.8293,
            15.9793,
            "Europe/Zagreb",
            "AS5391",
            "Hrvatski Telekom d.d."
        ]
    }
}

something like this:

{
    "timestamp": 1656291918,
    "total_nodes": 15037,
    "latest_height": 742491,
    "nodes": {
        "qp6ro3mnogsi7manj3gdt5xhic43n45fumvg527z5uvtoy3vyp7re6yd.onion:8333": {
           "protocol_version" :       70016,
           "user_agent" :             "/Satoshi:22.0.0/",
           "connected_since" :        1656188302,
           "services" :               1037,
           "height" :                 742491,
           "hostname" :               null,
           "city" :                   null,
           "country_code" :           null,
           "latitude" :               0.0,
           "longitude" :              0.0,
           "timezone" :               null,
           "asn" :                    "TOR",
           "organization_name" :      "Tor network"
        },
        ...
        "93.138.52.93:8333": {
           "protocol_version" :     70016,
           "user_agent" :           "/Satoshi:22.0.0/",
           "connected_since" :      1656217338,
           "services" :             1032,
           "height" :               742491,
           "hostname" :             "93-138-52-93.adsl.net.t-com.hr",
           "city" :                 "Zagreb",
           "country_code" :         "HR",
           "latitude" :             45.8293,
           "longitude" :            15.9793,
           "timezone" :             "Europe/Zagreb",
           "asn" :                  "AS5391",
           "organization_name" :    "Hrvatski Telekom d.d."
        }
    }
}

or even better imo nodes as a list of JSON node objects:

{
    "timestamp": 1656291918,
    "total_nodes": 15037,
    "latest_height": 742491,
    "nodes": [
         {
           "protocol_version" :       70016,
           "user_agent" :             "/Satoshi:22.0.0/",
           "connected_since" :        1656188302,
           "services" :               1037,
           "height" :                 742491,
           "hostname" :               null,
           "city" :                   null,
           "country_code" :           null,
           "latitude" :               0.0,
           "longitude" :              0.0,
           "timezone" :               null,
           "host" :                   "qp6ro3mnogsi7manj3gdt5xhic43n45fumvg527z5uvtoy3vyp7re6yd.onion:8333"
           "asn" :                    "TOR",
           "organization_name" :      "Tor network"
        },
        ...
        {
           "protocol_version" :     70016,
           "user_agent" :           "/Satoshi:22.0.0/",
           "connected_since" :      1656217338,
           "services" :             1032,
           "height" :               742491,
           "hostname" :             "93-138-52-93.adsl.net.t-com.hr",
           "city" :                 "Zagreb",
           "country_code" :         "HR",
           "latitude" :             45.8293,
           "longitude" :            15.9793,
           "timezone" :             "Europe/Zagreb",
           "host" :                 "93.138.52.93:8333"
           "asn" :                  "AS5391",
           "organization_name" :    "Hrvatski Telekom d.d."
        }
    ]
}

This may be possible in future API version but not for current version as it has been around for over a decade and I'd like to keep it in the current compressed state.