Skip to content
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
2 changes: 1 addition & 1 deletion api_auth_docker/api-sample.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ action_helloworld=stats
action_getblockchaininfo=stats
action_installation_info=stats
action_getmempoolinfo=stats
action_getblockhash=stats
action_getrawmempool=stats
Copy link
Contributor

Choose a reason for hiding this comment

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

do not overwrite existing actions please


# 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 @@ -8,6 +8,7 @@ action_helloworld=stats
action_getblockchaininfo=stats
action_installation_info=stats
action_getmempoolinfo=stats
action_getrawmempool=stats

# Watcher can:
action_watch=watcher
Expand Down
77 changes: 76 additions & 1 deletion doc/API.v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ When cyphernode receives a transaction confirmation (/conf endpoint) on a watche

### Get mempool information

Returns the mempool information of the Bitcoin node.
Returns the mempool information of the Bitcoin node.
```http
GET http://cyphernode:8888/getmempoolinfo
```
Expand All @@ -312,6 +312,81 @@ Proxy response:
}
```

### Get raw mempool

Returns raw mempool information of the Bitcoin node.
```http
POST http://cyphernode:8888/getrawlinfo/true
```

Proxy response:

```json
{
"a20b97e2ee7f576700055d2a1594e7ce25dd6d90f8d8e094af9d043af5d44c98": {
"fees": {
"base": 5.7e-05,
"modified": 5.7e-05,
"ancestor": 5.7e-05,
"descendant": 5.7e-05
},
"size": 283,
"fee": 5.7e-05,
"modifiedfee": 5.7e-05,
"time": 1570808521,
"height": 1582368,
"descendantcount": 1,
"descendantsize": 283,
"descendantfees": 5700,
"ancestorcount": 1,
"ancestorsize": 283,
"ancestorfees": 5700,
"wtxid": "a20b97e2ee7f576700055d2a1594e7ce25dd6d90f8d8e094af9d043af5d44c98",
"depends": [],
"spentby": [],
"bip125-replaceable": false
},
"87969069267cae47dc029843e9f5cecfa783b5917a128b8d9206fc014b10eb49": {
"fees": {
"base": 0.00016791,
"modified": 0.00016791,
"ancestor": 0.00016791,
"descendant": 0.00016791
},
"size": 166,
"fee": 0.00016791,
"modifiedfee": 0.00016791,
"time": 1570808524,
"height": 1582369,
"descendantcount": 1,
"descendantsize": 166,
"descendantfees": 16791,
"ancestorcount": 1,
"ancestorsize": 166,
"ancestorfees": 16791,
"wtxid": "61150ab11f62840beeba3c48fcab8a01e0a1089efa5537180f3121a10328d92e",
"depends": [],
"spentby": [],
"bip125-replaceable": false
}
}
```

```http
POST http://cyphernode:8888/getrawlinfo/false
```

Proxy response:

```json
[
"147fbd9ebd3c1ff4d3d3ac5ab28757ddbc72bf9642de4f3e08be099053381420",
"d73f1f773775508ab1f9545e6f54a9184d9b2653d58c6cf845fad9c69dfc2f9c",
"d507bbc0bff5eb2a3adec6b754c637ede84873b8185d6373cb59c7de7cd1595f",
"9e8854196061ce0da4ce1d528f6482393ef8c873f31fb323fb46bc38fd030035"
]
```

### Get the blockchain information (called by application)

Returns the blockchain information of the Bitcoin node. Used for example by the welcome app to get syncing progression.
Expand Down
74 changes: 74 additions & 0 deletions doc/openapi/v0/cyphernode-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,33 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
/getrawmempool:
get:
tags:
- "stats"
- "core features"
summary: "Show raw mempool"
description: "Returns mempool raw information."
operationId: "getrawmempool"
responses:
'200':
description: "successful operation"
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/RawMempool'
- $ref: '#/components/schemas/RawMempoolVerbose'
'403':
$ref: '#/components/schemas/ApiResponseNotAllowed'
'404':
$ref: '#/components/schemas/ApiResponseNotFound'
'503':
description: "Resource temporarily unavailable"
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
/ln_getinfo:
get:
tags:
Expand Down Expand Up @@ -1846,6 +1873,53 @@ components:
type: "number"
minrelaytxfee:
type: "integer"
RawMempool:
type: "array"
items:
type: "string"
properties:
txid:
type: "string"
RawMempoolVerbose:
type: "object"
properties:
fees:
type: "object"
properties:
base: "integer"
modified: "integer"
ancestor: "integer"
descendant: "integer"
size:
type: "integer"
fee:
type: "number"
modifiedfee:
type: "integer"
time:
type: "integer"
height:
type: "integer"
descendantcount:
type: "integer"
descendantsize:
type: "integer"
descendantfees:
type: "integer"
ancestorcount:
type: "integer"
ancestorsize:
type: "integer"
ancestorfees:
type: "integer"
wtxid:
type: "string"
depends:
type: "array"
spentby:
type: "array"
bip125-replaceable:
type: "boolean"
TypeHexString:
description: "variable length hex string"
type: "string"
Expand Down
10 changes: 6 additions & 4 deletions proxy_docker/app/script/blockchainrpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ get_mempool_info() {
send_to_watcher_node "${data}" | jq ".result"
return $?
}
get_blockhash() {
trace "Entering get_blockhash()..."
local blockheight=${1}
local data="{\"method\":\"getblockhash\",\"params\":[${blockheight}]}"

get_raw_mempool() {
trace "Entering get_raw_mempool()..."

local verbose=${1}
local data="{\"method\":\"getrawmempool\",\"params\":${verbose}}"
send_to_watcher_node "${data}" | jq ".result"
return $?
}
9 changes: 8 additions & 1 deletion proxy_docker/app/script/requesthandler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,18 @@ main() {
;;
getmempoolinfo)
# curl GET http://192.168.111.152:8080/getmempoolinfo

response=$(get_mempool_info)
response_to_client "${response}" ${?}
break
;;
getrawmempool)
# curl GET http://192.168.111.152:8080/getrawmempool

response=$(get_raw_mempool ${line})
response_to_client "${response}" ${?}
break
;;
ln_getinfo)
# GET http://192.168.111.152:8080/ln_getinfo

Expand Down