In this chapter we’ll send blockchain related requests to our NIS instance on the testnet.
The response to this request just contains the height of the blockchain as known by our NIS instance. If you repeat this query just after starting your node, you will see the height returned vary rapidly. Note that it takes some time for your NIS instance to got through the whole blockchain after start up.l v
Here is a sample run:
$ http :7890/chain/heightGET /chain/height HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Connection: keep-alive Host: localhost:7890 User-Agent: HTTPie/0.9.2 HTTP/1.1 200 OK Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Origin: * Content-Encoding: gzip Content-Type: application/json Server: Jetty(9.2.11.v20150529) Transfer-Encoding: chunked Vary: Accept-Encoding, User-Agent { "height": 35811 }
The response to this request holds the last block known by the NIS instance interrogated.
$ http :7890/chain/last-blockGET /chain/last-block HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Connection: keep-alive Host: localhost:7890 User-Agent: HTTPie/0.9.2 HTTP/1.1 200 OK Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Origin: * Content-Encoding: gzip Content-Type: application/json Server: Jetty(9.2.11.v20150529) Transfer-Encoding: chunked Vary: Accept-Encoding, User-Agent { "height": 88611, "prevBlockHash": { "data": "1fdc88a8d4077f39cffc382934b60d9cc9a8a36c9836c944b930cc3ed88f1bd1" }, "signature": "4fe78e41c6b5f497b4f2d45d2d049dbde6fb46eb8eb076bbedcf50c77c2bf5349ef42e83183ffae9f2fbafe38b57c76485c11f2434e40c84c2e83bd276bb8e00", "signer": "f60ab8a28a42637062e6ed43a20793735c58cb3e8f3a0ab74148d591a82eba4d", "timeStamp": 6193224, "transactions": [], "type": 1, "version": -1744830463 }
However, as is the case here, the probability to get an empty list of transactions on the testnet is quite high. We can repeat this query on the mainnet, using another server than the one running in our docker container:
$ http 85.25.36.97:7890/chain/last-blockGET /chain/last-block HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Connection: keep-alive Host: 85.25.36.97:7890 User-Agent: HTTPie/0.9.2 HTTP/1.1 200 OK Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Origin: * Content-Encoding: gzip Content-Type: application/json Server: Jetty(9.2.11.v20150529) Transfer-Encoding: chunked Vary: Accept-Encoding, User-Agent { "height": 1051051, "prevBlockHash": { "data": "35e2b73c979f733ac401c78efdf8d7e8fbd951f766d7334bc8a2fd5ebc8815ce" }, "signature": "58c9f1324fed656dfe5539b60e1116c19a1414386475957eda9108c6bdfbe35a7e7ffc413e963bf690e0612b750004f66e12b11656bd53a3326cae3fc9c99e0c", "signer": "14a9611f2913233fc74d97654ae88626a816249bd77e0bd9b3f53276ac6bed9e", "timeStamp": 63656860, "transactions": [ { "amount": 57713397132, "deadline": 63657452,