-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
392 lines (370 loc) · 10.6 KB
/
Copy pathopenapi.yaml
File metadata and controls
392 lines (370 loc) · 10.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
openapi: 3.1.0
info:
title: benchyd API
description: |
HTTP API for benchyd, the Sia host benchmarking daemon. The API exposes
consensus, syncer, and wallet state along with the host scan and benchmark
operations.
Sia core types are encoded as follows:
- Currency: base-10 string of hastings (1 SC = 10^24 H)
- Address: 76-character hex string (32-byte hash + 6-byte checksum)
- PublicKey: "ed25519:" followed by 64 hex characters
- Hash256 / BlockID / TransactionID: 64-character hex string
- Duration: integer number of nanoseconds
version: "1.0.0"
servers:
- url: http://localhost:8484
description: Default local API address
tags:
- name: consensus
- name: syncer
- name: benchmark
- name: wallet
paths:
/consensus/tip:
get:
tags: [consensus]
summary: Get the current consensus tip
operationId: getConsensusTip
responses:
"200":
description: The current chain tip and sync status
content:
application/json:
schema:
$ref: "#/components/schemas/ConsensusState"
/syncer/address:
get:
tags: [syncer]
summary: Get the syncer's listen address
operationId: getSyncerAddress
responses:
"200":
description: The advertised syncer address
content:
application/json:
schema:
type: string
example: "127.0.0.1:9981"
/syncer/peers:
get:
tags: [syncer]
summary: List connected peers
operationId: getSyncerPeers
responses:
"200":
description: The currently connected peers
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Peer"
put:
tags: [syncer]
summary: Connect to a peer
operationId: connectSyncerPeer
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SyncerConnectRequest"
responses:
"200":
description: The peer was connected
"500":
description: Failed to connect to the peer
/syncer/peers/{address}:
delete:
tags: [syncer]
summary: Disconnect from a peer
operationId: disconnectSyncerPeer
parameters:
- name: address
in: path
required: true
description: The network address of the peer to disconnect
schema:
type: string
responses:
"200":
description: The peer was disconnected
"404":
description: The peer is not connected
/scan:
post:
tags: [benchmark]
summary: Scan a host's settings
description: Connects to a host over RHP4 and returns its current settings.
operationId: scanHost
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ScanRequest"
responses:
"200":
description: The scanned host settings
content:
application/json:
schema:
$ref: "#/components/schemas/Settings"
"500":
description: Failed to scan the host
/benchmark:
post:
tags: [benchmark]
summary: Benchmark a host
description: |
Forms a contract with the host, uploads the requested number of sectors,
then downloads them, measuring throughput and cost. This is a
long-running operation.
operationId: benchmarkHost
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/BenchmarkRequest"
responses:
"200":
description: The benchmark results
content:
application/json:
schema:
$ref: "#/components/schemas/Result"
"500":
description: The benchmark failed
/wallet:
get:
tags: [wallet]
summary: Get wallet state
operationId: getWallet
responses:
"200":
description: The wallet address, scan height, and balance
content:
application/json:
schema:
$ref: "#/components/schemas/WalletResponse"
/wallet/events:
get:
tags: [wallet]
summary: List confirmed wallet events
operationId: getWalletEvents
parameters:
- name: limit
in: query
required: false
description: Maximum number of events to return (defaults to 100, max 500)
schema:
type: integer
default: 100
maximum: 500
- name: offset
in: query
required: false
description: Number of events to skip
schema:
type: integer
default: 0
responses:
"200":
description: The wallet's confirmed events
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Event"
/wallet/pending:
get:
tags: [wallet]
summary: List unconfirmed wallet events
operationId: getWalletPending
responses:
"200":
description: The wallet's unconfirmed events
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Event"
/wallet/send:
post:
tags: [wallet]
summary: Send siacoins
operationId: sendSiacoins
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/WalletSendSiacoinsRequest"
responses:
"200":
description: The ID of the broadcast transaction
content:
application/json:
schema:
$ref: "#/components/schemas/TransactionID"
"400":
description: Invalid request (e.g. void address or amount below the miner fee)
"500":
description: Failed to fund, sign, or broadcast the transaction
components:
schemas:
Currency:
type: string
description: An amount of siacoins, in hastings (1 SC = 10^24 H).
example: "1000000000000000000000000"
Address:
type: string
description: A Sia address (76-character hex string).
example: "addr1234..."
PublicKey:
type: string
description: An ed25519 public key.
example: "ed25519:9aac1ffb1cfd1079a8c6c87b47da1d567e35b97234993c288c1ad0db1d1ce1b6"
Hash256:
type: string
description: A 256-bit hash encoded as a 64-character hex string.
TransactionID:
type: string
description: A transaction ID encoded as a 64-character hex string.
Duration:
type: integer
format: int64
description: A duration in nanoseconds.
ChainIndex:
type: object
properties:
height:
type: integer
format: int64
id:
$ref: "#/components/schemas/Hash256"
required: [height, id]
ConsensusState:
type: object
properties:
synced:
type: boolean
chainIndex:
$ref: "#/components/schemas/ChainIndex"
required: [synced, chainIndex]
Peer:
type: object
properties:
address:
type: string
version:
type: string
synced:
type: boolean
required: [address, version, synced]
SyncerConnectRequest:
type: object
properties:
address:
type: string
description: The network address of the peer to connect to.
required: [address]
ScanRequest:
type: object
properties:
address:
type: string
description: The host's RHP4 network address.
hostKey:
$ref: "#/components/schemas/PublicKey"
required: [address, hostKey]
BenchmarkRequest:
type: object
properties:
address:
type: string
description: The host's RHP4 network address.
hostKey:
$ref: "#/components/schemas/PublicKey"
sectors:
type: integer
format: int64
description: The number of sectors to upload and download.
required: [address, hostKey, sectors]
Settings:
type: object
description: The RHP4 settings scanned from a host.
properties:
settings:
type: object
description: |
The host's RHP4 settings (go.sia.tech/core/rhp/v4 HostSettings).
See the Sia core RHP4 documentation for the full structure.
additionalProperties: true
required: [settings]
Result:
type: object
description: The results of a host benchmark.
properties:
sectors:
type: integer
format: int64
handshake:
$ref: "#/components/schemas/Duration"
appendP99:
$ref: "#/components/schemas/Duration"
readP99:
$ref: "#/components/schemas/Duration"
upload:
$ref: "#/components/schemas/Duration"
download:
$ref: "#/components/schemas/Duration"
uploadCost:
$ref: "#/components/schemas/Currency"
downloadCost:
$ref: "#/components/schemas/Currency"
required:
- sectors
- handshake
- appendP99
- readP99
- upload
- download
- uploadCost
- downloadCost
WalletResponse:
type: object
properties:
scanHeight:
type: integer
format: int64
address:
$ref: "#/components/schemas/Address"
spendable:
$ref: "#/components/schemas/Currency"
confirmed:
$ref: "#/components/schemas/Currency"
unconfirmed:
$ref: "#/components/schemas/Currency"
required: [scanHeight, address, spendable, confirmed, unconfirmed]
WalletSendSiacoinsRequest:
type: object
properties:
address:
$ref: "#/components/schemas/Address"
amount:
$ref: "#/components/schemas/Currency"
subtractMinerFee:
type: boolean
description: If true, the miner fee is deducted from the amount sent.
required: [address, amount]
Event:
type: object
description: |
A wallet event (go.sia.tech/coreutils/wallet Event). See the Sia
coreutils wallet documentation for the full structure.
additionalProperties: true