From 14bd3890dcf6c5dc9fbe25992710c80c9ff107c7 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Wed, 10 Aug 2022 19:05:52 +0200 Subject: [PATCH] doc: add an API.md documenting the JSONRPC API. Co-Authored-By: Edouard Paris --- doc/API.md | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 doc/API.md diff --git a/doc/API.md b/doc/API.md new file mode 100644 index 00000000..3370b8c4 --- /dev/null +++ b/doc/API.md @@ -0,0 +1,66 @@ +# Minisafe API + +`minisafe` exposes a [JSON-RPC 2.0](https://www.jsonrpc.org/specification) +interface over a Unix Domain socket. + +Commands must be sent as valid JSONRPC 2.0 requests, ending with a `\n`. + +| Command | Description | +| ----------------------------------------------------------- | ---------------------------------------------------- | +| [`stop`](#stop) | Stops the minisafe daemon | +| [`getinfo`](#getinfo) | Get general information about the daemon | +| [`getnewaddress`](#getnewaddress) | Get a new receiving address | + +# Reference + +## General + +### `stop` + +Stops the minisafe daemon. + +#### Response + +Returns an empty response. + +| Field | Type | Description | +| ------------- | ------ | ----------- | + +### `getinfo` + +General information about the daemon + +#### Request + +This command does not take any parameter for now. + +| Field | Type | Description | +| ------------- | ----------------- | ----------------------------------------------------------- | + +#### Response + +| Field | Type | Description | +| -------------------- | ------- | -------------------------------------------------------------------------------------------- | +| `version` | string | Version following the [SimVer](http://www.simver.org/) format | +| `network` | string | Answer can be `mainnet`, `testnet`, `regtest` | +| `blockheight` | integer | Current block height | +| `sync` | float | The synchronization progress as percentage (`0 < sync < 1`) | +| `descriptors` | object | Object with the name of the descriptor as key and the descriptor string as value | + +### `getnewaddress` + +Get a new address for receiving coins. This will always generate a new address regardless of whether +it was used or not. + +#### Request + +This command does not take any parameter for now. + +| Field | Type | Description | +| ------------- | ----------------- | ----------------------------------------------------------- | + +#### Response + +| Field | Type | Description | +| ------------- | ------ | ------------------ | +| `address` | string | A Bitcoin address |