Skip to content

Commit c2c7340

Browse files
Extend API docs to reflect new tools endpoints
1 parent 2acffa2 commit c2c7340

1 file changed

Lines changed: 94 additions & 11 deletions

File tree

Developers/API.md

Lines changed: 94 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ METHOD| PATH | DESCRIPTION
5858
`GET` |`/peers/connected`| Show info of connected peers
5959
`GET` |`/peers/endpoints`| Show known peer endpoints
6060
`GET` |`/peers/connect_timers`| Show timers used for reconnect
61-
`GET` |`/tools/encode16bit/from_e8/:feeE8`| Round raw 64 integer to closest 16 bit representation (for fee specification)
61+
`GET` |`/tools/encode16bit/from_e8/:feeE8`| Round raw 64 integer to closest 16 bit representation (for fee specification)
6262
`GET` |`/tools/encode16bit/from_string/:feestring`| Round coin amount string to closest 16 bit representation (for fee specification)
63-
`GET` | `/tools/janushash_number/:headerhex`| Show number interpretation of a header's janushash
64-
`GET` |`/tools/wallet/new`| Create a new wallet
65-
`GET` | `/tools/wallet/from_privkey/:privkey`| Restore wallet from a private key
63+
`GET` | `/tools/parse_price/:price/:precision` | Parse price adjusted for asset precision
64+
`GET` | `/tools/info` | Print information about this node
65+
`GET` | `/tools/wallet/new`| Create a new wallet
66+
`GET` | `/tools/wallet/from_privkey/:privkey`| Restore wallet from a private key
67+
`GET` | `/tools/janushash_number/:headerhex`| Show number interpretation of a header's Janushash.
68+
`GET` | `/tools/sample_verified_peers/:number`| List verified peers
6669
`WEBSOCKET` |`/ws/chain_delta`| Get chain delta events
6770
6871
## Detailed Description
@@ -492,18 +495,66 @@ Example output of `/chain/hashrate/100`
492495
}
493496
```
494497
495-
### `GET /tools/janushash_number/:headerhex`
498+
### `GET /tools/parse_price/:price/:precision`
496499
497-
Show number interpretation of a header's janushash. Header is specified in hexadecimal encoding.
500+
Parse price adjusted for asset precision.
498501
499-
Example output of `/tools/janushash_number/<some 160 character hex string>`:
502+
Example output of `/tools/parse_price/0.123456/3`:
500503
501504
```json
502-
0.06597094470635056
505+
{
506+
"code": 0,
507+
"data": {
508+
"assetPrecision": 3,
509+
"ceil": {
510+
"doubleAdjusted": 0.12345750000000001,
511+
"doubleRaw": 12345.75,
512+
"exponent2": -2,
513+
"hex": "c0e74d",
514+
"mantissa": 49383,
515+
"precExponent10": 5
516+
},
517+
"floor": {
518+
"doubleAdjusted": 0.12345500000000001,
519+
"doubleRaw": 12345.5,
520+
"exponent2": -2,
521+
"hex": "c0e64d",
522+
"mantissa": 49382,
523+
"precExponent10": 5
524+
}
525+
}
526+
}
527+
```
528+
### `GET /tools/info`
529+
530+
Print information about this node.
531+
532+
Example output of `/tools/info`:
533+
534+
```json
535+
{
536+
"code": 0,
537+
"data": {
538+
"chainDBPath": "/home/user/.warthog/chain_defi.db3",
539+
"dbSize": 3058028544,
540+
"peersDBPath": "/home/user/.warthog/peers_v2.db3",
541+
"rxtxDBPath": "/home/user/.warthog/rxtx.db3",
542+
"uptime": {
543+
"formatted": "0d 0h 6m 8s",
544+
"seconds": 368,
545+
"sinceTimestamp": 1763453691,
546+
"sinceUTC": "2025-11-18 08:14:51 UTC"
547+
},
548+
"version": {
549+
"commit": "4da03e4",
550+
"major": 0,
551+
"minor": 10,
552+
"name": "v0.10.3 \"4da03e4\"",
553+
"patch": 3
554+
}
555+
}
556+
}
503557
```
504-
!!!info Info
505-
We do not use JSON encoding in this endpoint for performance reasons to support use of this endpoint by pool share validation. If the input `:headerhex` cannot be parsed, the result is an empty string.
506-
!!!
507558
508559
### `GET /tools/wallet/new`
509560
@@ -542,6 +593,38 @@ Example output of `/tools/wallet/from_privkey/d3ce2210adf0fccabe31b61309e2b80c02
542593
}
543594
```
544595
596+
### `GET /tools/janushash_number/:headerhex`
597+
Show number interpretation of a header's Janushash. Mining corresponds to finding headers with this number smaller than some threshold dictated by the header difficulty.
598+
599+
Example output of `/tools/janushash_number/b4e91160d990b7b679234fc7cdc1aefbe11afe9823d6d8d1da7067e9ab0c8d380af405022613b56b379d0b071a4829cc27875f19bb0cb493f3f15aaedade1080e433874b0000000265ce0eb452f36e59`:
600+
601+
```json
602+
{
603+
"code": 0,
604+
"data": {
605+
"janushashNumber": 4.315032866502006e-14
606+
}
607+
}
608+
```
609+
### `GET /tools/sample_verified_peers/:number`
610+
List verified peers.
611+
612+
Example output of `/tools/wallet/from_privkey/d3ce2210adf0fccabe31b61309e2b80c029a7e4e305aeed29432edd428d35c3d`:
613+
614+
```json
615+
{
616+
"code": 0,
617+
"data": [
618+
"51.75.21.134:9186",
619+
"172.241.31.200:19110",
620+
"51.68.155.69:9186",
621+
"148.251.181.254:19110",
622+
"149.102.187.227:9186"
623+
]
624+
}
625+
```
626+
627+
545628
### `WEBSOCKET /stream`
546629
This websocket endpoint allows real-time data streams on several topics such as `chain`, `account` and `connection` related information. Subscribe with a message containing `"action": "subscribe"` and unsubscribe similarly with `"action": "unsubscribe"`, as shown below.
547630

0 commit comments

Comments
 (0)