Skip to content

Commit 6cf0cab

Browse files
add api spec for the signer (#133)
* add api spec for the signer * fix typo
1 parent b19422c commit 6cf0cab

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Covenant Signer API specification
2+
3+
Covenant signer must support following APIs to correctly work with covenant emulator.
4+
5+
## Endpoints
6+
7+
### `POST /v1/sign-transactions`
8+
9+
This endpoint is used to request signatures for a set of transactions.
10+
11+
#### Request Body
12+
13+
The request body is a JSON object with the following structure:
14+
15+
```json
16+
{
17+
"staking_tx_hex": "string",
18+
"slashing_tx_hex": "string",
19+
"unbonding_tx_hex": "string",
20+
"slash_unbonding_tx_hex": "string",
21+
"staking_output_idx": "number",
22+
"slashing_script_hex": "string",
23+
"unbonding_script_hex": "string",
24+
"unbonding_slashing_script_hex": "string",
25+
"fp_enc_keys": ["string"],
26+
"stake_expansion": {
27+
"previous_active_stake_tx_hex": "string",
28+
"other_funding_output_hex": "string",
29+
"previous_staking_output_idx": "number",
30+
"previous_active_stake_unbonding_script_hex": "string"
31+
}
32+
}
33+
```
34+
35+
#### `SignTransactionsRequest` description
36+
37+
| Field | Type | Description |
38+
| --- | --- | --- |
39+
| `staking_tx_hex` | `string` | The hexadecimal representation of the staking transaction. |
40+
| `slashing_tx_hex` | `string` | The hexadecimal representation of the slashing transaction. |
41+
| `unbonding_tx_hex` | `string` | The hexadecimal representation of the unbonding transaction. |
42+
| `slash_unbonding_tx_hex` | `string` | The hexadecimal representation of the slash unbonding transaction. |
43+
| `staking_output_idx` | `number` | The index of the staking output in the staking transaction. |
44+
| `slashing_script_hex` | `string` | The hexadecimal representation of the slashing script. |
45+
| `unbonding_script_hex` | `string` | The hexadecimal representation of the unbonding script. |
46+
| `unbonding_slashing_script_hex` | `string` | The hexadecimal representation of the unbonding slashing script. |
47+
| `fp_enc_keys` | `[]string` | An array of hexadecimal representations of the finality provider encryption keys. |
48+
| `stake_expansion` | `StakeExpansionRequest` | An optional object containing information about the stake expansion. |
49+
50+
#### `StakeExpansionRequest` description
51+
52+
| Field | Type | Description |
53+
| --- | --- | --- |
54+
| `previous_active_stake_tx_hex` | `string` | The hexadecimal representation of the previous active stake transaction. |
55+
| `other_funding_output_hex` | `string` | The hexadecimal representation of the other funding output. |
56+
| `previous_staking_output_idx` | `number` | The index of the previous staking output in the previous active stake transaction. |
57+
| `previous_active_stake_unbonding_script_hex` | `string` | The hexadecimal representation of the unbonding script of the previous active stake transaction. |
58+
59+
#### Response Body
60+
61+
The response body is a JSON object with the following structure:
62+
63+
```json
64+
{
65+
"slashing_transactions_signatures": ["string"],
66+
"unbonding_transaction_signature": "string",
67+
"slash_unbonding_transactions_signatures": ["string"],
68+
"stake_expansion_transaction_signature": "string"
69+
}
70+
```
71+
72+
#### `SignTransactionsResponse` description
73+
74+
| Field | Type | Description |
75+
| --- | --- | --- |
76+
| `slashing_transactions_signatures` | `[]string` | An array of hexadecimal representations of the adaptor signatures for the slashing transactions. |
77+
| `unbonding_transaction_signature` | `string` | The hexadecimal representation of the signature for the unbonding transaction. |
78+
| `slash_unbonding_transactions_signatures` | `[]string` | An array of hexadecimal representations of the adaptor signatures for the slash unbonding transactions. |
79+
| `stake_expansion_transaction_signature` | `string` | The hexadecimal representation of the signature for the stake expansion transaction. field will only be filled if `stake_expansion` object in request was not nil|
80+
81+
### `GET /v1/public-key`
82+
83+
This endpoint is used to retrieve the public key of the signer.
84+
85+
#### Response Body
86+
87+
```json
88+
{
89+
"public_key": "string"
90+
}
91+
```
92+
93+
#### Response body description
94+
95+
| Field | Type | Description |
96+
| --- | --- | --- |
97+
| `public_key` | `string` | A hexadecimal representation of covenant signer 33byte public key. |

0 commit comments

Comments
 (0)