From 2fda97b4905d3b3501771c7a9b05f69cca2b4c1e Mon Sep 17 00:00:00 2001 From: satoshi Date: Fri, 14 Aug 2020 16:51:26 -0400 Subject: [PATCH 1/2] added bitcoin core rpc gettxoutsetinfo --- api_auth_docker/api-sample.properties | 1 + .../templates/gatekeeper/api.properties | 1 + doc/API.v0.md | 24 +++++++++++++++++++ proxy_docker/app/script/blockchainrpc.sh | 8 +++++++ proxy_docker/app/script/requesthandler.sh | 7 ++++++ 5 files changed, 41 insertions(+) diff --git a/api_auth_docker/api-sample.properties b/api_auth_docker/api-sample.properties index 27ddfd65f..f8c4f0607 100644 --- a/api_auth_docker/api-sample.properties +++ b/api_auth_docker/api-sample.properties @@ -6,6 +6,7 @@ action_getblockchaininfo=stats action_installation_info=stats action_getmempoolinfo=stats action_getblockhash=stats +action_gettxoutsetinfo=stats # Watcher can do what the stats can do, plus: action_watch=watcher diff --git a/cyphernodeconf_docker/templates/gatekeeper/api.properties b/cyphernodeconf_docker/templates/gatekeeper/api.properties index d22c2f5b3..0cb5c7deb 100644 --- a/cyphernodeconf_docker/templates/gatekeeper/api.properties +++ b/cyphernodeconf_docker/templates/gatekeeper/api.properties @@ -9,6 +9,7 @@ action_getblockchaininfo=stats action_installation_info=stats action_getmempoolinfo=stats action_getblockhash=stats +action_gettxoutsetinfo=stats # Watcher can: action_watch=watcher diff --git a/doc/API.v0.md b/doc/API.v0.md index a4d899b82..5a4c33b3a 100644 --- a/doc/API.v0.md +++ b/doc/API.v0.md @@ -313,6 +313,29 @@ Proxy response: "minrelaytxfee": 1e-05 } ``` +## Get the unspent transaction output set statistics + +Returns statistics about the unspent transaction output set. +Note this call may take some time. + +```http +GET http://cyphernode:8888/gettxoutsetinfo +``` + +Proxy response: + +```json +{ + "height": 1486864, + "bestblock": "000000000000002fb99d683e64bbfc2b7ad16f9a425cf7be77b481fb1afa363b", + "transactions": 9197804, + "txouts": 24041190, + "bogosize": 1803311256, + "hash_serialized_2": "ffc1fb007587596f9183154a613843e5b55b1d285b16d7e3b0cb7cbe6b2cba06", + "disk_size" : 23647567017, + "total_amount": 20941947.16577759, +} +``` ### Get the blockchain information (called by application) @@ -325,6 +348,7 @@ GET http://cyphernode:8888/getblockchaininfo Proxy response: ```json + { "chain": "test", "blocks": 1486864, diff --git a/proxy_docker/app/script/blockchainrpc.sh b/proxy_docker/app/script/blockchainrpc.sh index 7d85aec5f..37a147f9b 100644 --- a/proxy_docker/app/script/blockchainrpc.sh +++ b/proxy_docker/app/script/blockchainrpc.sh @@ -103,3 +103,11 @@ validateaddress() { send_to_watcher_node "${data}" return $? } + +gettxoutsetinfo() { + trace "Entering gettxoutsetinfo()..." + + local data='{"method":"gettxoutsetinfo"}' + send_to_watcher_node "${data}" | jq ".result" + return $? +} \ No newline at end of file diff --git a/proxy_docker/app/script/requesthandler.sh b/proxy_docker/app/script/requesthandler.sh index 63f63a131..bd0f5ae5a 100644 --- a/proxy_docker/app/script/requesthandler.sh +++ b/proxy_docker/app/script/requesthandler.sh @@ -217,6 +217,13 @@ main() { response=$(get_blockchain_info) response_to_client "${response}" ${?} ;; + gettxoutsetinfo) + # http://192.168.111.152:8080/gettxoutsetinfo + + response=$(gettxoutsetinfo) + response_to_client "${response}" ${?} + break + ;; gettransaction) # curl (GET) http://192.168.111.152:8080/gettransaction/af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648 From a8915dd9d88add2df3dfc392f7b41a45bf09fc27 Mon Sep 17 00:00:00 2001 From: satoshi Date: Tue, 18 Aug 2020 14:31:52 -0400 Subject: [PATCH 2/2] added txoutsetinfo to api.yaml --- doc/openapi/v0/cyphernode-api.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/openapi/v0/cyphernode-api.yaml b/doc/openapi/v0/cyphernode-api.yaml index 408a9bc5d..d8b0ed642 100644 --- a/doc/openapi/v0/cyphernode-api.yaml +++ b/doc/openapi/v0/cyphernode-api.yaml @@ -803,6 +803,30 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiResponseTemporarilyUnavailable' + /gettxoutsetinfo: + get: + tags: + - "stats" + summary: "Show UTXO set info" + description: "Returns detailed unspent transaction output set information." + operationId: "getTxoutsetInfo" + responses: + '200': + description: "successful operation" + content: + application/json: + schema: + $ref: '#/components/schemas/TxoutsetInfo' + '403': + $ref: '#/components/schemas/ApiResponseNotAllowed' + '404': + $ref: '#/components/schemas/ApiResponseNotFound' + '503': + description: "Resource temporarily unavailable" + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponseTemporarilyUnavailable' /getinstallation_info: get: tags: