|
|
|
@ -681,7 +681,8 @@ Result:
|
|
|
|
|
Examples:
|
|
|
|
|
> bitcoin-cli getblockhash 1000
|
|
|
|
|
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest",
|
|
|
|
|
"method": "getblockhash", "params": [1000]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
|
|
|
|
|
"method": "getblockhash",
|
|
|
|
|
"params": [1000]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
|
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
At the end of the help information you will see two examples of the RPC
|
|
|
|
@ -984,7 +985,8 @@ client to construct one of these JSON-RPC calls:
|
|
|
|
|
|
|
|
|
|
----
|
|
|
|
|
$ curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest",
|
|
|
|
|
"method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
|
|
|
|
|
"method": "getblockchaininfo",
|
|
|
|
|
"params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
|
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
This command shows that +curl+ submits an HTTP request to the local host
|
|
|
|
@ -1007,10 +1009,18 @@ $ cat .bitcoin/.cookie
|
|
|
|
|
__cookie__:17c9b71cef21b893e1a019f4bc071950c7942f49796ed061b274031b17b19cd0
|
|
|
|
|
|
|
|
|
|
$ curl
|
|
|
|
|
--user __cookie__:17c9b71cef21b893e1a019f4bc071950c7942f49796ed061b274031b17b19cd0 --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
|
|
|
|
|
--user __cookie__:17c9b71cef21b893e1a019f4bc071950c7942f49796ed061b274031b17b19cd0
|
|
|
|
|
--data-binary '{"jsonrpc": "1.0", "id":"curltest",
|
|
|
|
|
"method": "getblockchaininfo",
|
|
|
|
|
"params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
|
|
|
|
|
|
|
|
|
|
{"result":{"chain":"main","blocks":799278,"headers":799278,
|
|
|
|
|
"bestblockhash":"000000000000000000018387c50988ec705a95d6f765b206b6629971e6978879","difficulty":53911173001054.59,"time":1689703111,"mediantime":1689701260,"verificationprogress":0.9999979206082515,"initialblockdownload":false,"chainwork":"00000000000000000000000000000000000000004f3e111bf32bcb47f9dfad5b","size_on_disk":563894577967,"pruned":false,"warnings":""},"error":null,"id":"curltest"}
|
|
|
|
|
"bestblockhash":"000000000000000000018387c50988ec705a95d6f765b206b6629971e6978879",
|
|
|
|
|
"difficulty":53911173001054.59,"time":1689703111,"mediantime":1689701260,
|
|
|
|
|
"verificationprogress":0.9999979206082515,"initialblockdownload":false,
|
|
|
|
|
"chainwork":"00000000000000000000000000000000000000004f3e111bf32bcb47f9dfad5b",
|
|
|
|
|
"size_on_disk":563894577967,"pruned":false,"warnings":""},"error":null,
|
|
|
|
|
"id":"curltest"}
|
|
|
|
|
----
|
|
|
|
|
====
|
|
|
|
|
|
|
|
|
|