gitlab.com/SiaPrime/SiaPrime@v1.4.1/doc/api/HostDB.md (about)

     1  Host DB API
     2  ===========
     3  
     4  The Sia API documentation can be found here:
     5  [Sia API](https://sia.tech/docs/ "Sia API")
     6  
     7  <<<<<<< HEAD
     8  Updates to the API documentation can be made here:
     9  [Sia API markdown](./index.html.md "Sia API markdown")
    10  =======
    11  There may be functional API calls which are not documented. These are not
    12  guaranteed to be supported beyond the current release, and should not be used
    13  in production.
    14  
    15  Overview
    16  --------
    17  
    18  The hostdb maintains a database of all hosts known to the network. The database
    19  identifies hosts by their public key and keeps track of metrics such as price.
    20  
    21  Index
    22  -----
    23  
    24  | Request                                                       | HTTP Verb | Examples                      |
    25  | ------------------------------------------------------------- | --------- | ----------------------------- |
    26  | [/hostdb](#hostdb-get-example)                                | GET       | [HostDB Get](#hostdb-get)     |
    27  | [/hostdb/active](#hostdbactive-get-example)                   | GET       | [Active hosts](#active-hosts) |
    28  | [/hostdb/all](#hostdball-get-example)                         | GET       | [All hosts](#all-hosts)       |
    29  | [/hostdb/hosts/___:pubkey___](#hostdbhostspubkey-get-example) | GET       | [Hosts](#hosts)               |
    30  
    31  #### /hostdb [GET] [(example)](#hostdb-get)
    32  
    33  shows some general information about the state of the hostdb.
    34  
    35  ###### JSON Response 
    36  
    37  Either the following JSON struct or an error response. See [#standard-responses](#standard-responses).
    38  
    39  ```javascript
    40  {
    41      "initialscancomplete": false // indicates if all known hosts have been scanned at least once.
    42  }
    43  ```
    44  
    45  #### /hostdb/active [GET] [(example)](#active-hosts)
    46  
    47  lists all of the active hosts known to the renter, sorted by preference.
    48  
    49  ###### Query String Parameters
    50  ```
    51  // Number of hosts to return. The actual number of hosts returned may be less
    52  // if there are insufficient active hosts. Optional, the default is all active
    53  // hosts.
    54  numhosts
    55  ```
    56  
    57  ###### JSON Response
    58  ```javascript
    59  {
    60    "hosts": [
    61      {
    62        // true if the host is accepting new contracts.
    63        "acceptingcontracts": true,
    64  
    65        // The maximum amount of money that the host will put up as collateral
    66        // for storage that is contracted by the renter
    67        "collateral": "20000000000", // hastings / byte / block
    68  
    69        // The price that a renter has to pay to create a contract with the
    70        // host. The payment is intended to cover transaction fees
    71        // for the file contract revision and the storage proof that the host
    72        // will be submitting to the blockchain.
    73        "contractprice": "1000000000000000000000000", // hastings
    74  
    75        // The price that a renter has to pay when downloading data from the
    76        // host
    77        "downloadbandwidthprice": "35000000000000", // hastings / byte
    78  
    79        // Firstseen is the last block height at which this host was announced.
    80        "firstseen": 160000, // blocks
    81  
    82        // Total amount of time the host has been offline.
    83        "historicdowntime": 0,
    84  
    85        // Number of historic failed interactions with the host.
    86        "historicfailedinteractions": 0,
    87  
    88        // Number of historic successful interactions with the host.
    89        "historicsuccessfulinteractions": 5,
    90  
    91        // Total amount of time the host has been online.
    92        "historicuptime": 41634520900246576,
    93  
    94        // List of IP subnet masks used by the host. For IPv4 the /24 and for IPv6 the /54 subnet mask
    95        // is used. A host can have either one IPv4 or one IPv6 subnet or one of each. E.g. these
    96        // lists are valid: [ "IPv4" ], [ "IPv6" ] or [ "IPv4", "IPv6" ]. The following lists are 
    97        // invalid: [ "IPv4", "IPv4" ], [ "IPv4", "IPv6", "IPv6" ]. Hosts with an invalid list are ignored.
    98        "ipnets": [
    99          "1.2.3.0",
   100          "2.1.3.0"
   101        ],
   102  
   103        // The last time that the interactions within scanhistory have been compressed into the historic ones
   104        "lasthistoricupdate": 174900, // blocks
   105  
   106        // The last time the list of IP subnet masks was updated. When equal subnet masks are found for
   107        // different hosts, the host that occupies the subnet mask for a longer time is preferred.
   108        "lastipnetchange": "2015-01-01T08:00:00.000000000+04:00",
   109  
   110        // The maximum amount of collateral that the host will put into a
   111        // single file contract.
   112        "maxcollateral": "1000000000000000000000000000", // hastings
   113  
   114        // Maximum number of bytes that the host will allow to be requested by a
   115        // single download request.
   116        "maxdownloadbatchsize": 17825792, // bytes
   117  
   118        // Maximum duration in blocks that a host will allow for a file contract.
   119        // The host commits to keeping files for the full duration under the
   120        // threat of facing a large penalty for losing or dropping data before
   121        // the duration is complete. The storage proof window of an incoming file
   122        // contract must end before the current height + maxduration.
   123        //
   124        // There is a block approximately every 10 minutes.
   125        // e.g. 1 day = 144 blocks
   126        "maxduration": 25920, // blocks
   127  
   128        // Maximum size in bytes of a single batch of file contract
   129        // revisions. Larger batch sizes allow for higher throughput as there is
   130        // significant communication overhead associated with performing a batch
   131        // upload.
   132        "maxrevisebatchsize": 17825792, // bytes
   133  
   134        // Remote address of the host. It can be an IPv4, IPv6, or hostname,
   135        // along with the port. IPv6 addresses are enclosed in square brackets.
   136        "netaddress": "123.456.789.0:4282",
   137  
   138        // Public key used to identify and verify hosts.
   139        "publickey": {
   140          // Algorithm used for signing and verification. Typically "ed25519".
   141          "algorithm": "ed25519",
   142  
   143          // Key used to verify signed host messages.
   144          "key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
   145        },
   146  
   147        // The string representation of the full public key, used when calling
   148        // /hostdb/hosts.
   149        "publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
   150  
   151        // Number of recent failed interactions with the host.
   152        "recentfailedinteractions": 0,
   153  
   154        // Number of recent successful interactions with the host.
   155        "recentsuccessfulinteractions": 0,
   156  
   157        // Unused storage capacity the host claims it has.
   158        "remainingstorage": 35000000000, // bytes
   159  
   160        // The revision number indicates to the renter what iteration of
   161        // settings the host is currently at. Settings are generally signed.
   162        // If the renter has multiple conflicting copies of settings from the
   163        // host, the renter can expect the one with the higher revision number
   164        // to be more recent.
   165        "revisionnumber": 12733798,
   166  
   167        // Measurements that have been taken on the host. The most recent measurements
   168        // are kept in full detail.
   169        "scanhistory": [
   170          {
   171            "success": true,
   172            "timestamp": "2018-09-23T08:00:00.000000000+04:00"
   173          },
   174          {
   175            "success": true,
   176            "timestamp": "2018-09-23T06:00:00.000000000+04:00"
   177          },
   178          {
   179            "success": true,
   180            "timestamp": "2018-09-23T04:00:00.000000000+04:00"
   181          }
   182        ],
   183  
   184        // Smallest amount of data in bytes that can be uploaded or downloaded to
   185        // or from the host.
   186        "sectorsize": 4194304, // bytes
   187  
   188        // The price that a renter has to pay to store files with the host.
   189        "storageprice": "14000000000", // hastings / byte / block
   190  
   191        // Total amount of storage capacity the host claims it has.
   192        "totalstorage": 35000000000, // bytes
   193  
   194        // Address at which the host can be paid when forming file contracts.
   195        "unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
   196  
   197        "uploadbandwidthprice": "3000000000000", // hastings / byte
   198  
   199        // The version of the host.
   200        "version": "1.3.8",
   201  
   202        // A storage proof window is the number of blocks that the host has to
   203        // get a storage proof onto the blockchain. The window size is the
   204        // minimum size of window that the host will accept in a file contract.
   205        "windowsize": 144 // blocks
   206      }
   207    ]
   208  }
   209  ```
   210  
   211  #### /hostdb/all [GET] [(example)](#all-hosts)
   212  
   213  lists all of the hosts known to the renter. Hosts are not guaranteed to be in
   214  any particular order, and the order may change in subsequent calls.
   215  
   216  ###### JSON Response
   217  ```javascript
   218  {
   219    "hosts": [
   220      {
   221        // true if the host is accepting new contracts.
   222        "acceptingcontracts": true,
   223  
   224        // The maximum amount of money that the host will put up as collateral
   225        // for storage that is contracted by the renter
   226        "collateral": "20000000000", // hastings / byte / block
   227  
   228        // The price that a renter has to pay to create a contract with the
   229        // host. The payment is intended to cover transaction fees
   230        // for the file contract revision and the storage proof that the host
   231        // will be submitting to the blockchain.
   232        "contractprice": "1000000000000000000000000", // hastings
   233  
   234        // The price that a renter has to pay when downloading data from the
   235        // host
   236        "downloadbandwidthprice": "35000000000000", // hastings / byte
   237  
   238        // Firstseen is the last block height at which this host was announced.
   239        "firstseen": 160000, // blocks
   240  
   241        // Total amount of time the host has been offline.
   242        "historicdowntime": 0,
   243  
   244        // Number of historic failed interactions with the host.
   245        "historicfailedinteractions": 0,
   246  
   247        // Number of historic successful interactions with the host.
   248        "historicsuccessfulinteractions": 5,
   249  
   250        // Total amount of time the host has been online.
   251        "historicuptime": 41634520900246576,
   252  
   253        // List of IP subnet masks used by the host. For IPv4 the /24 and for IPv6 the /54 subnet mask
   254        // is used. A host can have either one IPv4 or one IPv6 subnet or one of each. E.g. these
   255        // lists are valid: [ "IPv4" ], [ "IPv6" ] or [ "IPv4", "IPv6" ]. The following lists are 
   256        // invalid: [ "IPv4", "IPv4" ], [ "IPv4", "IPv6", "IPv6" ]. Hosts with an invalid list are ignored.
   257        "ipnets": [
   258          "1.2.3.0",
   259          "2.1.3.0"
   260        ],
   261  
   262        // The last time that the interactions within scanhistory have been compressed into the historic ones
   263        "lasthistoricupdate": 174900, // blocks
   264  
   265        // The last time the list of IP subnet masks was updated. When equal subnet masks are found for
   266        // different hosts, the host that occupies the subnet mask for a longer time is preferred.
   267        "lastipnetchange": "2015-01-01T08:00:00.000000000+04:00",
   268  
   269        // The maximum amount of collateral that the host will put into a
   270        // single file contract.
   271        "maxcollateral": "1000000000000000000000000000", // hastings
   272  
   273        // Maximum number of bytes that the host will allow to be requested by a
   274        // single download request.
   275        "maxdownloadbatchsize": 17825792, // bytes
   276  
   277        // Maximum duration in blocks that a host will allow for a file contract.
   278        // The host commits to keeping files for the full duration under the
   279        // threat of facing a large penalty for losing or dropping data before
   280        // the duration is complete. The storage proof window of an incoming file
   281        // contract must end before the current height + maxduration.
   282        //
   283        // There is a block approximately every 10 minutes.
   284        // e.g. 1 day = 144 blocks
   285        "maxduration": 25920, // blocks
   286  
   287        // Maximum size in bytes of a single batch of file contract
   288        // revisions. Larger batch sizes allow for higher throughput as there is
   289        // significant communication overhead associated with performing a batch
   290        // upload.
   291        "maxrevisebatchsize": 17825792, // bytes
   292  
   293        // Remote address of the host. It can be an IPv4, IPv6, or hostname,
   294        // along with the port. IPv6 addresses are enclosed in square brackets.
   295        "netaddress": "123.456.789.0:4282",
   296  
   297        // Public key used to identify and verify hosts.
   298        "publickey": {
   299          // Algorithm used for signing and verification. Typically "ed25519".
   300          "algorithm": "ed25519",
   301  
   302          // Key used to verify signed host messages.
   303          "key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
   304        },
   305  
   306        // The string representation of the full public key, used when calling
   307        // /hostdb/hosts.
   308        "publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
   309  
   310        // Number of recent failed interactions with the host.
   311        "recentfailedinteractions": 0,
   312  
   313        // Number of recent successful interactions with the host.
   314        "recentsuccessfulinteractions": 0,
   315  
   316        // Unused storage capacity the host claims it has.
   317        "remainingstorage": 35000000000, // bytes
   318  
   319        // The revision number indicates to the renter what iteration of
   320        // settings the host is currently at. Settings are generally signed.
   321        // If the renter has multiple conflicting copies of settings from the
   322        // host, the renter can expect the one with the higher revision number
   323        // to be more recent.
   324        "revisionnumber": 12733798,
   325  
   326        // Measurements that have been taken on the host. The most recent measurements
   327        // are kept in full detail.
   328        "scanhistory": [
   329          {
   330            "success": true,
   331            "timestamp": "2018-09-23T08:00:00.000000000+04:00"
   332          },
   333          {
   334            "success": true,
   335            "timestamp": "2018-09-23T06:00:00.000000000+04:00"
   336          },
   337          {
   338            "success": true,
   339            "timestamp": "2018-09-23T04:00:00.000000000+04:00"
   340          }
   341        ],
   342  
   343        // Smallest amount of data in bytes that can be uploaded or downloaded to
   344        // or from the host.
   345        "sectorsize": 4194304, // bytes
   346  
   347        // The price that a renter has to pay to store files with the host.
   348        "storageprice": "14000000000", // hastings / byte / block
   349  
   350        // Total amount of storage capacity the host claims it has.
   351        "totalstorage": 35000000000, // bytes
   352  
   353        // Address at which the host can be paid when forming file contracts.
   354        "unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
   355  
   356        "uploadbandwidthprice": "3000000000000", // hastings / byte
   357  
   358        // The version of the host.
   359        "version": "1.3.8",
   360  
   361        // A storage proof window is the number of blocks that the host has to
   362        // get a storage proof onto the blockchain. The window size is the
   363        // minimum size of window that the host will accept in a file contract.
   364        "windowsize": 144 // blocks
   365      }
   366    ]
   367  }
   368  ```
   369  
   370  #### /hostdb/hosts/___:pubkey___ [GET] [(example)](#hosts)
   371  
   372  fetches detailed information about a particular host, including metrics
   373  regarding the score of the host within the database. It should be noted that
   374  each renter uses different metrics for selecting hosts, and that a good score on
   375  in one hostdb does not mean that the host will be successful on the network
   376  overall.
   377  
   378  ###### Path Parameters
   379  ```
   380  // The public key of the host. Each public key identifies a single host.
   381  //
   382  // Example Pubkey: ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
   383  :pubkey
   384  ```
   385  
   386  ###### JSON Response
   387  ```javascript
   388  {
   389    "entry": {
   390      // true if the host is accepting new contracts.
   391      "acceptingcontracts": true,
   392  
   393      // The maximum amount of money that the host will put up as collateral
   394      // for storage that is contracted by the renter
   395      "collateral": "20000000000", // hastings / byte / block
   396  
   397      // The price that a renter has to pay to create a contract with the
   398      // host. The payment is intended to cover transaction fees
   399      // for the file contract revision and the storage proof that the host
   400      // will be submitting to the blockchain.
   401      "contractprice": "1000000000000000000000000", // hastings
   402  
   403      // The price that a renter has to pay when downloading data from the
   404      // host
   405      "downloadbandwidthprice": "35000000000000", // hastings / byte
   406  
   407      // Firstseen is the last block height at which this host was announced.
   408      "firstseen": 160000, // blocks
   409  
   410      // Total amount of time the host has been offline.
   411      "historicdowntime": 0,
   412  
   413      // Number of historic failed interactions with the host.
   414      "historicfailedinteractions": 0,
   415  
   416      // Number of historic successful interactions with the host.
   417      "historicsuccessfulinteractions": 5,
   418  
   419      // Total amount of time the host has been online.
   420      "historicuptime": 41634520900246576,
   421  
   422      // List of IP subnet masks used by the host. For IPv4 the /24 and for IPv6 the /54 subnet mask
   423      // is used. A host can have either one IPv4 or one IPv6 subnet or one of each. E.g. these
   424      // lists are valid: [ "IPv4" ], [ "IPv6" ] or [ "IPv4", "IPv6" ]. The following lists are 
   425      // invalid: [ "IPv4", "IPv4" ], [ "IPv4", "IPv6", "IPv6" ]. Hosts with an invalid list are ignored.
   426      "ipnets": [
   427        "1.2.3.0",
   428        "2.1.3.0"
   429      ],
   430  
   431      // The last time that the interactions within scanhistory have been compressed into the historic ones
   432      "lasthistoricupdate": 174900, // blocks
   433  
   434      // The last time the list of IP subnet masks was updated. When equal subnet masks are found for
   435      // different hosts, the host that occupies the subnet mask for a longer time is preferred.
   436      "lastipnetchange": "2015-01-01T08:00:00.000000000+04:00",
   437  
   438      // The maximum amount of collateral that the host will put into a
   439      // single file contract.
   440      "maxcollateral": "1000000000000000000000000000", // hastings
   441  
   442      // Maximum number of bytes that the host will allow to be requested by a
   443      // single download request.
   444      "maxdownloadbatchsize": 17825792, // bytes
   445  
   446      // Maximum duration in blocks that a host will allow for a file contract.
   447      // The host commits to keeping files for the full duration under the
   448      // threat of facing a large penalty for losing or dropping data before
   449      // the duration is complete. The storage proof window of an incoming file
   450      // contract must end before the current height + maxduration.
   451      //
   452      // There is a block approximately every 10 minutes.
   453      // e.g. 1 day = 144 blocks
   454      "maxduration": 25920, // blocks
   455  
   456      // Maximum size in bytes of a single batch of file contract
   457      // revisions. Larger batch sizes allow for higher throughput as there is
   458      // significant communication overhead associated with performing a batch
   459      // upload.
   460      "maxrevisebatchsize": 17825792, // bytes
   461  
   462      // Remote address of the host. It can be an IPv4, IPv6, or hostname,
   463      // along with the port. IPv6 addresses are enclosed in square brackets.
   464      "netaddress": "123.456.789.0:4282",
   465  
   466      // Public key used to identify and verify hosts.
   467      "publickey": {
   468        // Algorithm used for signing and verification. Typically "ed25519".
   469        "algorithm": "ed25519",
   470  
   471        // Key used to verify signed host messages.
   472        "key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
   473      },
   474  
   475      // The string representation of the full public key, used when calling
   476      // /hostdb/hosts.
   477      "publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
   478  
   479      // Number of recent failed interactions with the host.
   480      "recentfailedinteractions": 0,
   481  
   482      // Number of recent successful interactions with the host.
   483      "recentsuccessfulinteractions": 0,
   484  
   485      // Unused storage capacity the host claims it has.
   486      "remainingstorage": 35000000000, // bytes
   487  
   488      // The revision number indicates to the renter what iteration of
   489      // settings the host is currently at. Settings are generally signed.
   490      // If the renter has multiple conflicting copies of settings from the
   491      // host, the renter can expect the one with the higher revision number
   492      // to be more recent.
   493      "revisionnumber": 12733798,
   494  
   495      // Measurements that have been taken on the host. The most recent measurements
   496      // are kept in full detail.
   497      "scanhistory": [
   498        {
   499          "success": true,
   500          "timestamp": "2018-09-23T08:00:00.000000000+04:00"
   501        },
   502        {
   503          "success": true,
   504          "timestamp": "2018-09-23T06:00:00.000000000+04:00"
   505        },
   506        {
   507          "success": true,
   508          "timestamp": "2018-09-23T04:00:00.000000000+04:00"
   509        }
   510      ],
   511  
   512      // Smallest amount of data in bytes that can be uploaded or downloaded to
   513      // or from the host.
   514      "sectorsize": 4194304, // bytes
   515  
   516      // The price that a renter has to pay to store files with the host.
   517      "storageprice": "14000000000", // hastings / byte / block
   518  
   519      // Total amount of storage capacity the host claims it has.
   520      "totalstorage": 35000000000, // bytes
   521  
   522      // Address at which the host can be paid when forming file contracts.
   523      "unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
   524  
   525      "uploadbandwidthprice": "3000000000000", // hastings / byte
   526  
   527      // The version of the host.
   528      "version": "1.3.8",
   529  
   530      // A storage proof window is the number of blocks that the host has to
   531      // get a storage proof onto the blockchain. The window size is the
   532      // minimum size of window that the host will accept in a file contract.
   533      "windowsize": 144 // blocks
   534    },
   535  
   536    // A set of scores as determined by the renter. Generally, the host's final
   537    // final score is all of the values multiplied together. Modified renters may
   538    // have additional criteria that they use to judge a host, or may ignore
   539    // certin criteia. In general, these fields should only be used as a loose
   540    // guide for the score of a host, as every renter sees the world differently
   541    // and uses different metrics to evaluate hosts.
   542    "scorebreakdown": {
   543      // The multiplier that gets applied to the host based on how long it has
   544      // been a host. Older hosts typically have a lower penalty.
   545      "ageadjustment": 0.1234,
   546  
   547      // The multiplier that gets applied to the host based on how much
   548      // proof-of-burn the host has performed. More burn causes a linear increase
   549      // in score.
   550      "burnadjustment": 23.456,
   551  
   552      // The multiplier that gets applied to a host based on how much collateral
   553      // the host is offering. More collateral is typically better, though above
   554      // a point it can be detrimental.
   555      "collateraladjustment": 23.456,
   556  
   557      // conversionrate is the likelihood that the host will be selected 
   558      // by renters forming contracts.
   559      "conversionrate": 9.12345,
   560  
   561      // The multipler that gets applied to a host based on previous interactions
   562      // with the host. A high ratio of successful interactions will improve this
   563      // hosts score, and a high ratio of failed interactions will hurt this
   564      // hosts score. This adjustment helps account for hosts that are on
   565      // unstable connections, don't keep their wallets unlocked, ran out of
   566      // funds, etc.
   567      "interactionadjustment": 0.1234,
   568  
   569      // The multiplier that gets applied to a host based on the host's price.
   570      // Lower prices are almost always better. Below a certain, very low price,
   571      // there is no advantage.
   572      "pricesmultiplier": 0.1234,
   573  
   574      // The overall score for the host. Scores are entriely relative, and are
   575      // consistent only within the current hostdb. Between different machines,
   576      // different configurations, and different versions the absolute scores for
   577      // a given host can be off by many orders of magnitude. When displaying to a
   578      // human, some form of normalization with respect to the other hosts (for
   579      // example, divide all scores by the median score of the hosts) is
   580      // recommended.
   581      "score": 123456,
   582  
   583      // The multiplier that gets applied to a host based on how much storage is
   584      // remaining for the host. More storage remaining is better, to a point.
   585      "storageremainingadjustment": 0.1234,
   586  
   587      // The multiplier that gets applied to a host based on the uptime percentage
   588      // of the host. The penalty increases extremely quickly as uptime drops
   589      // below 90%.
   590      "uptimeadjustment": 0.1234,
   591  
   592      // The multiplier that gets applied to a host based on the version of SiaPrime
   593      // that they are running. Versions get penalties if there are known bugs,
   594      // scaling limitations, performance limitations, etc. Generally, the most
   595      // recent version is always the one with the highest score.
   596      "versionadjustment": 0.1234
   597    }
   598  }
   599  ```
   600  
   601  Examples
   602  --------
   603  
   604  #### HostDB Get
   605  
   606  ###### Request
   607  ```
   608  /hostdb
   609  ```
   610  
   611  ###### Expected Response Code
   612  ```
   613  200 OK
   614  ```
   615  
   616  ###### Example JSON Response
   617  ```javascript
   618  {
   619      "initialscancomplete": false
   620  }
   621  ```
   622  
   623  #### Active hosts
   624  
   625  ###### Request
   626  ```
   627  /hostdb/active?numhosts=2
   628  ```
   629  
   630  ###### Expected Response Code
   631  ```
   632  200 OK
   633  ```
   634  
   635  ###### Example JSON Response
   636  ```javascript
   637  {
   638    "hosts": [
   639      {
   640        "acceptingcontracts": true,
   641        "collateral": "20000000000",
   642        "contractprice": "1000000000000000000000000",
   643        "downloadbandwidthprice": "35000000000000",
   644        "firstseen": 160000,
   645        "historicdowntime": 0,
   646        "historicfailedinteractions": 0,
   647        "historicsuccessfulinteractions": 5,
   648        "historicuptime": 41634520900246576,
   649        "lasthistoricupdate": 174900,
   650        "maxcollateral": "1000000000000000000000000000",
   651        "maxdownloadbatchsize": 17825792,
   652        "maxduration": 25920,
   653        "maxrevisebatchsize": 17825792,
   654        "netaddress": "123.456.789.0:4282",
   655        "publickey": {
   656          "algorithm": "ed25519",
   657          "key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
   658        },
   659        "publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
   660        "recentfailedinteractions": 0,
   661        "recentsuccessfulinteractions": 0,
   662        "remainingstorage": 35000000000,
   663        "revisionnumber": 12733798,
   664        "scanhistory": [
   665          {
   666            "success": true,
   667            "timestamp": "2018-09-23T08:00:00.000000000+04:00"
   668          },
   669          {
   670            "success": true,
   671            "timestamp": "2018-09-23T06:00:00.000000000+04:00"
   672          },
   673          {
   674            "success": true,
   675            "timestamp": "2018-09-23T04:00:00.000000000+04:00"
   676          }
   677        ],
   678        "sectorsize": 4194304,
   679        "storageprice": "14000000000",
   680        "totalstorage": 35000000000,
   681        "unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
   682        "uploadbandwidthprice": "3000000000000",
   683        "version": "1.3.8",
   684        "windowsize": 144
   685      },
   686      {
   687        "acceptingcontracts": true,
   688        "collateral": "20000000000",
   689        "contractprice": "1000000000000000000000000",
   690        "downloadbandwidthprice": "35000000000000",
   691        "firstseen": 160000,
   692        "historicdowntime": 0,
   693        "historicfailedinteractions": 0,
   694        "historicsuccessfulinteractions": 5,
   695        "historicuptime": 41634520900246576,
   696        "lasthistoricupdate": 174900,
   697        "maxcollateral": "1000000000000000000000000000",
   698        "maxdownloadbatchsize": 17825792,
   699        "maxduration": 25920,
   700        "maxrevisebatchsize": 17825792,
   701        "netaddress": "123.456.789.0:4282",
   702        "publickey": {
   703          "algorithm": "ed25519",
   704          "key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
   705        },
   706        "publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
   707        "recentfailedinteractions": 0,
   708        "recentsuccessfulinteractions": 0,
   709        "remainingstorage": 35000000000,
   710        "revisionnumber": 12733798,
   711        "scanhistory": [
   712          {
   713            "success": true,
   714            "timestamp": "2018-09-23T08:00:00.000000000+04:00"
   715          },
   716          {
   717            "success": true,
   718            "timestamp": "2018-09-23T06:00:00.000000000+04:00"
   719          },
   720          {
   721            "success": true,
   722            "timestamp": "2018-09-23T04:00:00.000000000+04:00"
   723          }
   724        ],
   725        "sectorsize": 4194304,
   726        "storageprice": "14000000000",
   727        "totalstorage": 35000000000,
   728        "unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
   729        "uploadbandwidthprice": "3000000000000",
   730        "version": "1.3.8",
   731        "windowsize": 144
   732      }
   733    ]
   734  }
   735  ```
   736  
   737  #### All hosts
   738  
   739  ###### Request
   740  ```
   741  /hostdb/all
   742  ```
   743  
   744  ###### Expected Response Code
   745  ```
   746  200 OK
   747  ```
   748  
   749  ###### Example JSON Response
   750  ```javascript
   751  {
   752    "hosts": [
   753      {
   754        "acceptingcontracts": true,
   755        "collateral": "20000000000",
   756        "contractprice": "1000000000000000000000000",
   757        "downloadbandwidthprice": "35000000000000",
   758        "firstseen": 160000,
   759        "historicdowntime": 0,
   760        "historicfailedinteractions": 0,
   761        "historicsuccessfulinteractions": 5,
   762        "historicuptime": 41634520900246576,
   763        "lasthistoricupdate": 174900,
   764        "maxcollateral": "1000000000000000000000000000",
   765        "maxdownloadbatchsize": 17825792,
   766        "maxduration": 25920,
   767        "maxrevisebatchsize": 17825792,
   768        "netaddress": "123.456.789.0:4282",
   769        "publickey": {
   770          "algorithm": "ed25519",
   771          "key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
   772        },
   773        "publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
   774        "recentfailedinteractions": 0,
   775        "recentsuccessfulinteractions": 0,
   776        "remainingstorage": 35000000000,
   777        "revisionnumber": 12733798,
   778        "scanhistory": [
   779          {
   780            "success": true,
   781            "timestamp": "2018-09-23T08:00:00.000000000+04:00"
   782          },
   783          {
   784            "success": true,
   785            "timestamp": "2018-09-23T06:00:00.000000000+04:00"
   786          },
   787          {
   788            "success": true,
   789            "timestamp": "2018-09-23T04:00:00.000000000+04:00"
   790          }
   791        ],
   792        "sectorsize": 4194304,
   793        "storageprice": "14000000000",
   794        "totalstorage": 35000000000,
   795        "unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
   796        "uploadbandwidthprice": "3000000000000",
   797        "version": "1.3.8",
   798        "windowsize": 144
   799      },
   800      {
   801        "acceptingcontracts": true,
   802        "collateral": "20000000000",
   803        "contractprice": "1000000000000000000000000",
   804        "downloadbandwidthprice": "35000000000000",
   805        "firstseen": 160000,
   806        "historicdowntime": 0,
   807        "historicfailedinteractions": 0,
   808        "historicsuccessfulinteractions": 5,
   809        "historicuptime": 41634520900246576,
   810        "lasthistoricupdate": 174900,
   811        "maxcollateral": "1000000000000000000000000000",
   812        "maxdownloadbatchsize": 17825792,
   813        "maxduration": 25920,
   814        "maxrevisebatchsize": 17825792,
   815        "netaddress": "123.456.789.0:4282",
   816        "publickey": {
   817          "algorithm": "ed25519",
   818          "key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
   819        },
   820        "publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
   821        "recentfailedinteractions": 0,
   822        "recentsuccessfulinteractions": 0,
   823        "remainingstorage": 35000000000,
   824        "revisionnumber": 12733798,
   825        "scanhistory": [
   826          {
   827            "success": true,
   828            "timestamp": "2018-09-23T08:00:00.000000000+04:00"
   829          },
   830          {
   831            "success": true,
   832            "timestamp": "2018-09-23T06:00:00.000000000+04:00"
   833          },
   834          {
   835            "success": true,
   836            "timestamp": "2018-09-23T04:00:00.000000000+04:00"
   837          }
   838        ],
   839        "sectorsize": 4194304,
   840        "storageprice": "14000000000",
   841        "totalstorage": 35000000000,
   842        "unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
   843        "uploadbandwidthprice": "3000000000000",
   844        "version": "1.3.8",
   845        "windowsize": 144
   846      },
   847      {
   848        "acceptingcontracts": true,
   849        "collateral": "20000000000",
   850        "contractprice": "1000000000000000000000000",
   851        "downloadbandwidthprice": "35000000000000",
   852        "firstseen": 160000,
   853        "historicdowntime": 0,
   854        "historicfailedinteractions": 0,
   855        "historicsuccessfulinteractions": 5,
   856        "historicuptime": 41634520900246576,
   857        "lasthistoricupdate": 174900,
   858        "maxcollateral": "1000000000000000000000000000",
   859        "maxdownloadbatchsize": 17825792,
   860        "maxduration": 25920,
   861        "maxrevisebatchsize": 17825792,
   862        "netaddress": "123.456.789.0:4282",
   863        "publickey": {
   864          "algorithm": "ed25519",
   865          "key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
   866        },
   867        "publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
   868        "recentfailedinteractions": 0,
   869        "recentsuccessfulinteractions": 0,
   870        "remainingstorage": 35000000000,
   871        "revisionnumber": 12733798,
   872        "scanhistory": [
   873          {
   874            "success": true,
   875            "timestamp": "2018-09-23T08:00:00.000000000+04:00"
   876          },
   877          {
   878            "success": true,
   879            "timestamp": "2018-09-23T06:00:00.000000000+04:00"
   880          },
   881          {
   882            "success": true,
   883            "timestamp": "2018-09-23T04:00:00.000000000+04:00"
   884          }
   885        ],
   886        "sectorsize": 4194304,
   887        "storageprice": "14000000000",
   888        "totalstorage": 35000000000,
   889        "unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
   890        "uploadbandwidthprice": "3000000000000",
   891        "version": "1.3.8",
   892        "windowsize": 144
   893      }
   894    ]
   895  }
   896  ```
   897  
   898  #### Hosts
   899  
   900  ###### Request
   901  ```
   902  /hostdb/hosts/ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
   903  ```
   904  
   905  ###### Expected Response Code
   906  ```
   907  200 OK
   908  ```
   909  
   910  ###### Example JSON Response
   911  ```javascript
   912  {
   913    "entry": {
   914      "acceptingcontracts": true,
   915      "collateral": "20000000000",
   916      "contractprice": "1000000000000000000000000",
   917      "downloadbandwidthprice": "35000000000000",
   918      "firstseen": 160000,
   919      "historicdowntime": 0,
   920      "historicfailedinteractions": 0,
   921      "historicsuccessfulinteractions": 5,
   922      "historicuptime": 41634520900246576,
   923      "lasthistoricupdate": 174900,
   924      "maxcollateral": "1000000000000000000000000000", 
   925      "maxdownloadbatchsize": 17825792,
   926      "maxduration": 25920,
   927      "maxrevisebatchsize": 17825792,
   928      "netaddress": "123.456.789.0:4282",
   929      "publickey": {
   930        "algorithm": "ed25519",
   931        "key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
   932      },
   933      "publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
   934      "recentfailedinteractions": 0,
   935      "recentsuccessfulinteractions": 0,
   936      "remainingstorage": 35000000000,
   937      "revisionnumber": 12733798,
   938      "scanhistory": [
   939        {
   940          "success": true,
   941          "timestamp": "2018-09-23T08:00:00.000000000+04:00"
   942        },
   943        {
   944          "success": true,
   945          "timestamp": "2018-09-23T06:00:00.000000000+04:00"
   946        },
   947        {
   948          "success": true,
   949          "timestamp": "2018-09-23T04:00:00.000000000+04:00"
   950        }
   951      ],
   952      "sectorsize": 4194304,
   953      "storageprice": "14000000000",
   954      "totalstorage": 35000000000,
   955      "unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
   956      "uploadbandwidthprice": "3000000000000", 
   957      "version": "1.3.8",
   958      "windowsize": 144
   959    },
   960    "scorebreakdown": {
   961      "ageadjustment": 0.1234,
   962      "burnadjustment": 23.456,
   963      "collateraladjustment": 23.456,
   964      "conversionrate": 9.12345,
   965      "interactionadjustment": 0.1234,
   966      "pricesmultiplier": 0.1234,
   967      "score": 123456,
   968      "storageremainingadjustment": 0.1234,
   969      "uptimeadjustment": 0.1234,
   970      "versionadjustment": 0.1234
   971    }
   972  }
   973  ```
   974  >>>>>>> siaprime/master