New derivation doc

This commit is contained in:
kexkey
2021-10-14 13:08:25 -04:00
parent 558774a899
commit fc3fadf59f
3 changed files with 138 additions and 0 deletions

View File

@@ -893,6 +893,59 @@ Proxy response:
} }
``` ```
### Fast address derivation using path in config and provided index (called by your application)
Derives addresses for supplied index. Must be used with derivation.pub32 and derivation.path properties in config.properties.
```http
GET http://cyphernode:8888/deriveindex_bitcoind/25-30
GET http://cyphernode:8888/deriveindex_bitcoind/34
```
Proxy response:
```json
[
"2N6Q9kBcLtNswgMSLSQ5oduhbctk7hxEJW8",
"2NFLhFghAPKEPuZCKoeXYYxuaBxhKXbmhBV",
"2N7gepbQtRM5Hm4PTjvGadj9wAwEwnAsKiP",
"2Mth8XDZpXkY9d95tort8HYEAuEesow2tF6",
"2MwqEmAXhUw6H7bJwMhD13HGWVEj2HgFiNH",
"2N2Y4BVRdrRFhweub2ehHXveGZC3nryMEJw"
]
```
### Fast address derivation using provided path and index (called by your application)
Derives addresses for supplied pub32 and path. config.properties' derivation.pub32 and derivation.path are not used.
```http
POST http://cyphernode:8888/derivepubpath_bitcoind
with body...
{"pub32":"tpubD6NzVbkrYhZ4YR3QK2tyfMMvBghAvqtNaNK1LTyDWcRHLcMUm3ZN2cGm5BS3MhCRCeCkXQkTXXjiJgqxpqXK7PeUSp86DTTgkLpcjMtpKWk","path":"0/25-30"}
or
{"pub32":"upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb","path":"0/34"}
or
{"pub32":"vpub5SLqN2bLY4WeZF3kL4VqiWF1itbf3A6oRrq9aPf16AZMVWYCuN9TxpAZwCzVgW94TNzZPNc9XAHD4As6pdnExBtCDGYRmNJrcJ4eV9hNqcv","path":"0/25-30"}
```
Proxy response:
```json
[
"mz3bWMW3BWGT9YGDjJwS8TfhJMMtZ91Frm",
"mkjmKEX3KJrVpiqLSSxKB6jjgm3WhPnrv8",
"mk43Tmf6E5nsmETTaNMTZK9TikaeVJRJ4a",
"n1SEcVHHKpHyNr695JpXNdH6b9cWQ26qkt",
"mzWqwZkA31kYVy1kpMoZgvfzSDyGgEi7Yg",
"mp5jtEDNa88xfSQGs5yYQGk7guGWvaG4ci"
]
```
### Get info from Lightning Network node (called by your application) ### Get info from Lightning Network node (called by your application)
Calls getinfo from lightningd. Useful to let your users know where to connect to. Calls getinfo from lightningd. Useful to let your users know where to connect to.

View File

@@ -1867,6 +1867,81 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable' $ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
/deriveindex_bitcoind/{indexSpecifier}:
get:
parameters:
- in: "path"
name: "indexSpecifier"
description: "Index specifier. Either an integer or a range in the form n-m"
required: true
schema:
type: "string"
tags:
- "addresses"
- "core features"
summary: "Fast address derivation using configured xpub key and derivation path"
description: "Fast address derivation for supplied index. Must be used with derivation.pub32 and derivation.path properties in config.properties."
operationId: "deriveIndex"
responses:
'200':
description: "successful operation"
content:
application/json:
schema:
type: "array"
items:
$ref: '#/components/schemas/TypeAddressString'
'403':
$ref: '#/components/schemas/ApiResponseNotAllowed'
'503':
description: "Resource temporarily unavailable"
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
/derivepubpath_bitcoind:
post:
tags:
- "addresses"
- "core features"
summary: "Fast address derivation using supplied xpub key and derivation path"
description: "Fast address derivation for supplied pub32 and path. config.properties' derivation.pub32 and derivation.path are not used."
operationId: "derivePubPath"
requestBody:
required: true
content:
application/json:
schema:
type: "object"
required:
- "pub32"
- "path"
properties:
pub32:
description: "xpub/ypub/zpub/tpub/upub/vpub used to derive address(es)"
type: "string"
path:
description: "Derivation path including the index, in the form n or n-m (ex.: 0/44'/86 or 0/44'/62-77)"
type: "string"
responses:
'200':
description: "successful operation"
content:
application/json:
schema:
type: "array"
items:
$ref: '#/components/schemas/TypeAddressString'
'400':
$ref: '#/components/schemas/ApiResponseInvalidInput'
'403':
$ref: '#/components/schemas/ApiResponseNotAllowed'
'503':
description: "Resource temporarily unavailable"
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseTemporarilyUnavailable'
/getmempoolinfo: /getmempoolinfo:
get: get:
tags: tags:

View File

@@ -85,6 +85,16 @@ test_derive() {
echo -e "\nDeriving 500 addresses with derivepubpath_bitcoind (Bitcoin Core)..." echo -e "\nDeriving 500 addresses with derivepubpath_bitcoind (Bitcoin Core)..."
time curl -s -H "Content-Type: application/json" -d "{\"pub32\":\"upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb\",\"path\":\"0/0-499\"}" proxy:8888/derivepubpath_bitcoind > /dev/null time curl -s -H "Content-Type: application/json" -d "{\"pub32\":\"upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb\",\"path\":\"0/0-499\"}" proxy:8888/derivepubpath_bitcoind > /dev/null
# Deriving 500 addresses with derivepubpath (pycoin)...
# real 0m 18.15s
# user 0m 0.00s
# sys 0m 0.00s
#
# Deriving 500 addresses with derivepubpath_bitcoind (Bitcoin Core)...
# real 0m 0.64s
# user 0m 0.00s
# sys 0m 0.00s
} }
apk add curl jq apk add curl jq