Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added bitcoin core rpc gettxoutsetinfo #196

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api_auth_docker/api-sample.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cyphernodeconf_docker/templates/gatekeeper/api.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions doc/API.v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -325,6 +348,7 @@ GET http://cyphernode:8888/getblockchaininfo
Proxy response:

```json

{
"chain": "test",
"blocks": 1486864,
Expand Down
24 changes: 24 additions & 0 deletions doc/openapi/v0/cyphernode-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add TxoutsetInfo definition in the components:schemas: section below (starting line 2021)

'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:
Expand Down
8 changes: 8 additions & 0 deletions proxy_docker/app/script/blockchainrpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $?
}
7 changes: 7 additions & 0 deletions proxy_docker/app/script/requesthandler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down