-
Notifications
You must be signed in to change notification settings - Fork 14
/
openapi.yaml
3360 lines (3252 loc) · 101 KB
/
openapi.yaml
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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: Tendermint RPC
contact:
name: Tendermint RPC
url: https://github.com/tendermint/tendermint/issues/new/choose
description: |
Tendermint supports the following RPC protocols:
* URI over HTTP
* JSON-RPC 2.0 over HTTP
* JSON-RPC 2.0 over websockets (deprecated)
## Configuration
RPC can be configured by tuning parameters under `[rpc]` table in the
`$TMHOME/config/config.toml` file or by using the `--rpc.X` command-line
flags.
Default rpc listen address is `tcp://0.0.0.0:26657`.
To set another address, set the `laddr` config parameter to desired value.
CORS (Cross-Origin Resource Sharing) can be enabled by setting
`cors_allowed_origins`, `cors_allowed_methods`, `cors_allowed_headers`
config parameters.
## Arguments
Arguments which expect strings or byte arrays may be passed as quoted
strings, like `"abc"` or as `0x`-prefixed strings, like `0x616263`.
## URI/HTTP
A GET request with arguments encoded as query parameters:
curl localhost:26657/block?height=5
## JSONRPC/HTTP
JSONRPC requests can be POST'd to the root RPC endpoint via HTTP.
curl --header "Content-Type: application/json" --request POST --data '{"method": "block", "params": ["5"], "id": 1}' localhost:26657
## JSONRPC/websockets
In Tendermint v0.35 and earlier, JSONRPC requests can be also made via
websocket. The websocket interface is deprecated in Tendermint v0.36, and
will be removed in v0.37.
The websocket endpoint is at `/websocket`, e.g. `localhost:26657/websocket`.
The RPC methods for event subscription (`subscribe`, `unsubscribe`, and
`unsubscribe_all`) are only available via websockets.
Example using https://github.com/hashrocket/ws:
ws ws://localhost:26657/websocket
> { "jsonrpc": "2.0", "method": "subscribe", "params": ["tm.event='NewBlock'"], "id": 1 }
version: "Master"
license:
name: Apache 2.0
url: https://github.com/dashevo/tenderdash/blob/master/LICENSE
servers:
- url: https://rpc.cosmos.network
description: Cosmos mainnet node to interact with the Tendermint RPC
- url: http://localhost:26657
description: Interact with the Tendermint RPC locally on your device
tags:
- name: Websocket
description: Subscribe/unsubscribe are reserved for websocket events.
- name: Info
description: Informations about the node APIs
- name: Tx
description: Transactions broadcast APIs
- name: ABCI
description: ABCI APIs
- name: Events
description: Event subscription APIs
- name: Evidence
description: Evidence APIs
- name: Unsafe
description: Unsafe APIs
paths:
/broadcast_tx_sync:
get:
summary: Returns with the response from CheckTx. Does not wait for DeliverTx result.
deprecated: true
tags:
- Tx
operationId: broadcast_tx_sync
description: |
This method is deprecated in Tendermint v0.36, and will be
removed in v0.37. Use `broadcast_tx`, which has similar
semantics.
This method blocks until CheckTx returns and reports its result, but
does not wait for the transaction to be included in a block. To know
when the transaction is included in a block, check for the transaction
event using JSON-RPC. See
https://docs.tendermint.com/master/app-dev/subscribing-to-events-via-websocket.html
See https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting
for formatting/encoding rules.
parameters:
- in: query
name: tx
required: true
schema:
type: string
example: "456"
description: The transaction
responses:
"200":
description: Empty
content:
application/json:
schema:
$ref: "#/components/schemas/BroadcastTxResponse"
"500":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/broadcast_tx:
get:
summary: Returns with the response from CheckTx. Does not wait for DeliverTx result.
tags:
- Tx
operationId: broadcast_tx
description: |
This method blocks until CheckTx returns and reports its result, but
does not wait for the transaction to be included in a block. To know
when the transaction is included in a block, check for the transaction
event using JSON-RPC. See
https://docs.tendermint.com/master/app-dev/subscribing-to-events-via-websocket.html
See https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting
for formatting/encoding rules.
parameters:
- in: query
name: tx
required: true
schema:
type: string
example: "456"
description: The transaction
responses:
"200":
description: Empty
content:
application/json:
schema:
$ref: "#/components/schemas/BroadcastTxResponse"
"500":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/broadcast_tx_async:
get:
summary: Returns right away, with no response. Does not wait for CheckTx nor DeliverTx results.
deprecated: true
tags:
- Tx
operationId: broadcast_tx_async
description: |
This method is deprecated in Tendermint v0.36, and will be
removed in v0.37. Use `broadcast_tx`.
This method submits the transaction and returns immediately without
waiting for the transaction to be checked (CheckTx) or committed. Too
know when the transaction is included in a block, you can check for the
transaction event using JSON-RPC. See
https://docs.tendermint.com/master/app-dev/subscribing-to-events-via-websocket.html
See https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting
for formatting/encoding rules.
parameters:
- in: query
name: tx
required: true
schema:
type: string
example: "123"
description: The transaction
responses:
"200":
description: empty answer
content:
application/json:
schema:
$ref: "#/components/schemas/BroadcastTxResponse"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/broadcast_tx_commit:
get:
summary: Returns with the responses from CheckTx and DeliverTx.
deprecated: true
tags:
- Tx
operationId: broadcast_tx_commit
description: |
This method waits for the transaction to be checked (CheckTx) and makes
a best effort to wait for it to be committed into a block before
returning. It will report an error if the request times out before the
transaction commits. If CheckTx or DeliverTx fails, the RPC will
succeed and report the failing (non-zero) ABCI result code.
WARNING: Use this only for testing and development. For production use,
call broadcast_tx.
To know when a transaction is included in a block, check for the
transaction event using JSON-RPC. See
https://docs.tendermint.com/master/app-dev/subscribing-to-events-via-websocket.html
See https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting
for formatting/encoding rules.
parameters:
- in: query
name: tx
required: true
schema:
type: string
example: "785"
description: The transaction
responses:
"200":
description: empty answer
content:
application/json:
schema:
$ref: "#/components/schemas/BroadcastTxCommitResponse"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/check_tx:
get:
summary: Checks the transaction without executing it.
tags:
- Tx
operationId: check_tx
description: |
The transaction won\'t be added to the mempool.
Please refer to
https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting
for formatting/encoding rules.
parameters:
- in: query
name: tx
required: true
schema:
type: string
example: "785"
description: The transaction
responses:
"200":
description: ABCI application's CheckTx response
content:
application/json:
schema:
$ref: "#/components/schemas/CheckTxResponse"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/remove_tx:
get:
summary: Removes a transaction from the mempool.
tags:
- TxKey
operationId: remove_tx
parameters:
- in: query
name: txKey
required: true
schema:
type: string
example: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
description: The transaction key
responses:
"200":
description: empty response.
"500":
description: empty error.
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/events:
get:
summary: Fetch events posted by the consensus node.
tags:
- Events
operationId: events
description: |
Fetch a batch of events posted by the consensus node and matching a
specified query string.
The query grammar is defined in [pubsub/query/syntax](https://godoc.org/github.com/tendermint/tendermint/internal/pubsub/query/syntax).
An empty query matches all events; otherwise a query comprises one or
more terms comparing event metadata to target values. For example, to
select new block events:
tm.event = 'NewBlock'
Multiple terms can be combined with AND, for example to match the
transaction event with a given hash, use:
tm.event = 'Tx' AND tx.hash = 'EA7B33F'
The comparison operators include `=`, `<`, `<=`, `>`, `>=`, and
`CONTAINS`. Operands may be strings (in single quotes), numbers, dates,
or timestamps. In addition, the `EXISTS` operator allows you to check
for the presence of an attribute regardless of its value.
Tendermint defines a `tm.event` attribute for all events. Transactions
are also assigned `tx.hash` and `tx.height` attributes. Other attributes
are provided by the application as ABCI Event records. The name of the
event in the query is formed by combining the type and attribute key
with a period. For example, given:
[]abci.Event{{
Type: "reward",
Attributes: []abci.EventAttribute{
{Key: "address", Value: "cosmos1xyz012pdq"},
{Key: "amount", Value: "45.62"},
{Key: "balance", Value: "100.390001"},
},
}}
the query may refer to the names`"reward.address`,`"reward.amount`, and
`reward.balance`, as in:
reward.address EXISTS AND reward.balance > 45
The node maintains a log of all events within an operator-defined time
window. The /events method returns the most recent items from the log
that match the query. Each item returned includes a cursor that marks
its location in the log. Cursors can be passed via the `before` and
`after` parameters to fetch events earlier in the log.
parameters:
- in: query
name: filter
schema:
$ref: "#/components/schemas/EventFilter"
- in: query
name: maxItems
schema:
type: integer
example: 10
- in: query
name: after
schema:
type: string
example: "0005d7c09065e9a7-01cf"
- in: query
name: before
schema:
type: string
example: "0005d7c09065e9a7-01cf"
- in: query
name: waitTime
schema:
type: integer
example: 5000000000
responses:
"200":
description: Reports a batch of matching events
content:
application/json:
schema:
$ref: "#/components/schemas/EventsResponse"
"500":
description: Reports an error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/subscribe:
get:
summary: Subscribe for events via WebSocket.
tags:
- Events
- Websocket
operationId: subscribe
description: |
To tell which events you want, you need to provide a query. query is a
string, which has a form: "condition AND condition ..." (no OR at the
moment). condition has a form: "key operation operand". key is a string with
a restricted set of possible symbols ( \t\n\r\\()"'=>< are not allowed).
operation can be "=", "<", "<=", ">", ">=", "CONTAINS" AND "EXISTS". operand
can be a string (escaped with single quotes), number, date or time.
Examples:
tm.event = 'NewBlock' # new blocks
tm.event = 'CompleteProposal' # node got a complete proposal
tm.event = 'Tx' AND tx.hash = 'XYZ' # single transaction
tm.event = 'Tx' AND tx.height = 5 # all txs of the fifth block
tx.height = 5 # all txs of the fifth block
Tendermint provides a few predefined keys: tm.event, tx.hash and tx.height.
Note for transactions, you can define additional keys by providing events with
DeliverTx response.
import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/pubsub/query"
)
abci.ResponseDeliverTx{
Events: []abci.Event{
{
Type: "rewards.withdraw",
Attributes: []abci.EventAttribute{
{Key: "address", Value: "AddrA", Index: true},
{Key: "source", Value: "SrcX", Index: true},
{Key: "amount", Value: "...", Index: true},
{Key: "balance", Value: "...", Index: true},
},
},
{
Type: "rewards.withdraw",
Attributes: []abci.EventAttribute{
{Key: "address", Value: "AddrB", Index: true},
{Key: "source", Value: "SrcY", Index: true},
{Key: "amount", Value: "...", Index: true},
{Key: "balance", Value: "...", Index: true},
},
},
{
Type: "transfer",
Attributes: []abci.EventAttribute{
{Key: "sender", Value: "AddrC", Index: true},
{Key: "recipient", Value: "AddrD", Index: true},
{Key: "amount", Value: "...", Index: true},
},
},
},
}
All events are indexed by a composite key of the form {eventType}.{evenAttrKey}.
In the above examples, the following keys would be indexed:
- rewards.withdraw.address
- rewards.withdraw.source
- rewards.withdraw.amount
- rewards.withdraw.balance
- transfer.sender
- transfer.recipient
- transfer.amount
Multiple event types with duplicate keys are allowed and are meant to
categorize unique and distinct events. In the above example, all events
indexed under the key `rewards.withdraw.address` will have the following
values stored and queryable:
- AddrA
- AddrB
To create a query for txs where address AddrA withdrew rewards:
query.MustParse("tm.event = 'Tx' AND rewards.withdraw.address = 'AddrA'")
To create a query for txs where address AddrA withdrew rewards from source Y:
query.MustParse("tm.event = 'Tx' AND rewards.withdraw.address = 'AddrA' AND rewards.withdraw.source = 'Y'")
To create a query for txs where AddrA transferred funds:
query.MustParse("tm.event = 'Tx' AND transfer.sender = 'AddrA'")
The following queries would return no results:
query.MustParse("tm.event = 'Tx' AND transfer.sender = 'AddrZ'")
query.MustParse("tm.event = 'Tx' AND rewards.withdraw.address = 'AddrZ'")
query.MustParse("tm.event = 'Tx' AND rewards.withdraw.source = 'W'")
See list of all possible events here
https://godoc.org/github.com/tendermint/tendermint/types#pkg-constants
For complete query syntax, check out
https://godoc.org/github.com/tendermint/tendermint/libs/pubsub/query.
```go
import rpchttp "github.com/tendermint/rpc/client/http"
import "github.com/tendermint/tendermint/types"
client, err := rpchttp.New("tcp://0.0.0.0:26657", "/websocket")
if err != nil {
// handle error
}
err = client.Start()
if err != nil {
// handle error
}
defer client.Stop()
ctx, cancel := context.WithTimeout(context.Background(), 1 * time.Second)
defer cancel()
query := "tm.event = 'Tx' AND tx.height = 3"
txs, err := client.Subscribe(ctx, "test-client", query)
if err != nil {
// handle error
}
go func() {
for e := range txs {
fmt.Println("got ", e.Data.(types.EventDataTx))
}
}()
```
NOTE: if you're not reading events fast enough, Tendermint might
terminate the subscription.
parameters:
- in: query
name: query
required: true
schema:
type: string
example: tm.event = 'Tx' AND tx.height = 5
description: |
query is a string, which has a form: "condition AND condition ..." (no OR at the
moment). condition has a form: "key operation operand". key is a string with
a restricted set of possible symbols ( \t\n\r\\()"'=>< are not allowed).
operation can be "=", "<", "<=", ">", ">=", "CONTAINS". operand can be a
string (escaped with single quotes), number, date or time.
responses:
"200":
description: empty answer
content:
application/json:
schema:
$ref: "#/components/schemas/EmptyResponse"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/unsubscribe:
get:
summary: Unsubscribe from event on Websocket
tags:
- Events
- Websocket
operationId: unsubscribe
description: |
```go
client, err := rpchttp.New("tcp://0.0.0.0:26657", "/websocket")
if err != nil {
// handle error
}
err := client.Start()
if err != nil {
// handle error
}
defer client.Stop()
query := "tm.event = 'Tx' AND tx.height = 3"
err = client.Unsubscribe(context.Background(), "test-client", query)
if err != nil {
// handle error
}
```
parameters:
- in: query
name: query
required: true
schema:
type: string
example: tm.event = 'Tx' AND tx.height = 5
description: |
query is a string, which has a form: "condition AND condition ..." (no OR at the
moment). condition has a form: "key operation operand". key is a string with
a restricted set of possible symbols ( \t\n\r\\()"'=>< are not allowed).
operation can be "=", "<", "<=", ">", ">=", "CONTAINS". operand can be a
string (escaped with single quotes), number, date or time.
responses:
"200":
description: Answer
content:
application/json:
schema:
$ref: "#/components/schemas/EmptyResponse"
"500":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/unsubscribe_all:
get:
summary: Unsubscribe from all events via WebSocket
tags:
- Events
- Websocket
operationId: unsubscribe_all
description: |
Unsubscribe from all events via WebSocket
responses:
"200":
description: empty answer
content:
application/json:
schema:
$ref: "#/components/schemas/EmptyResponse"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/health:
get:
summary: Node heartbeat
tags:
- Info
operationId: health
description: |
Get node health. Returns empty result (200 OK) on success, no response - in case of an error.
responses:
"200":
description: Gets Node Health
content:
application/json:
schema:
$ref: "#/components/schemas/EmptyResponse"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/status:
get:
summary: Node Status
operationId: status
tags:
- Info
description: |
Get Tendermint status including node info, pubkey, latest block hash, app hash, block height, current max peer height, and time.
responses:
"200":
description: Status of the node
content:
application/json:
schema:
$ref: "#/components/schemas/StatusResponse"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/net_info:
get:
summary: Network information
operationId: net_info
tags:
- Info
description: |
Get network info.
responses:
"200":
description: empty answer
content:
application/json:
schema:
$ref: "#/components/schemas/NetInfoResponse"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/dial_seeds:
get:
summary: Dial Seeds (Unsafe)
operationId: dial_seeds
tags:
- Unsafe
description: |
Dial a peer, this route in under unsafe, and has to manually enabled to use
**Example:** curl 'localhost:26657/dial_seeds?seeds=\["f9baeaa15fedf5e1ef7448dd60f46c01f1a9e9c4@1.2.3.4:26656","0491d373a8e0fcf1023aaf18c51d6a1d0d4f31bd@5.6.7.8:26656"\]'
parameters:
- in: query
name: peers
description: list of seed nodes to dial
schema:
type: array
items:
type: string
example: "f9baeaa15fedf5e1ef7448dd60f46c01f1a9e9c4@1.2.3.4:26656"
responses:
"200":
description: Dialing seeds in progress. See /net_info for details
content:
application/json:
schema:
$ref: "#/components/schemas/dialResp"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/dial_peers:
get:
summary: Add Peers/Persistent Peers (unsafe)
operationId: dial_peers
tags:
- Unsafe
description: |
Set a persistent peer, this route in under unsafe, and has to manually enabled to use.
**Example:** curl 'localhost:26657/dial_peers?peers=\["f9baeaa15fedf5e1ef7448dd60f46c01f1a9e9c4@1.2.3.4:26656","0491d373a8e0fcf1023aaf18c51d6a1d0d4f31bd@5.6.7.8:26656"\]&persistent=false'
parameters:
- in: query
name: persistent
description: Have the peers you are dialing be persistent
schema:
type: boolean
example: true
- in: query
name: unconditional
description: Have the peers you are dialing be unconditional
schema:
type: boolean
example: true
- in: query
name: private
description: Have the peers you are dialing be private
schema:
type: boolean
example: true
- in: query
name: peers
description: array of peers to dial
schema:
type: array
items:
type: string
example: "f9baeaa15fedf5e1ef7448dd60f46c01f1a9e9c4@1.2.3.4:26656"
responses:
"200":
description: Dialing seeds in progress. See /net_info for details
content:
application/json:
schema:
$ref: "#/components/schemas/dialResp"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/unsafe_flush_mempool:
get:
summary: Flush mempool of all unconfirmed transactions
operationId: unsafe_flush_mempool
tags:
- Unsafe
description: |
Flush flushes out the mempool. It acquires a read-lock, fetches all the
transactions currently in the transaction store and removes each transaction
from the store and all indexes and finally resets the cache.
Note, flushing the mempool may leave the mempool in an inconsistent state.
responses:
"200":
description: empty answer
content:
application/json:
schema:
$ref: "#/components/schemas/EmptyResponse"
"500":
description: empty error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/blockchain:
get:
summary: "Get block headers (max: 20) for minHeight <= height <= maxHeight."
operationId: blockchain
parameters:
- in: query
name: minHeight
description: Minimum block height to return
schema:
type: integer
example: 1
- in: query
name: maxHeight
description: Maximum block height to return
schema:
type: integer
example: 2
tags:
- Info
description: |
Get block headers for minHeight <= height maxHeight.
If maxHeight does not yet exist, blocks up to the current height will
be returned. If minHeight does not exist (due to pruning), earliest
existing height will be used.
At most 20 items will be returned. Block headers are returned in
descending order (highest first).
responses:
"200":
description: Block headers, returned in descending order (highest first).
content:
application/json:
schema:
$ref: "#/components/schemas/BlockchainResponse"
"500":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/header:
get:
summary: Get the header at a specified height
operationId: header
parameters:
- in: query
name: height
schema:
type: integer
default: 0
example: 1
description: height to return. If no height is provided, it will fetch the latest height.
tags:
- Info
description: |
Retrieve the block header corresponding to a specified height.
responses:
"200":
description: Header information.
content:
application/json:
schema:
$ref: "#/components/schemas/HeaderResponse"
"500":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/header_by_hash:
get:
summary: Get header by hash
operationId: header_by_hash
parameters:
- in: query
name: hash
description: header hash
required: true
schema:
type: string
example: "0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED"
tags:
- Info
description: |
Retrieve the block header corresponding to a block hash.
responses:
"200":
description: Header information.
content:
application/json:
schema:
$ref: "#/components/schemas/HeaderResponse"
"500":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/block:
get:
summary: Get block at a specified height
operationId: block
parameters:
- in: query
name: height
schema:
type: integer
default: 0
example: 1
description: height to return. If no height is provided, it will fetch the latest block.
tags:
- Info
description: |
Get Block.
responses:
"200":
description: Block information.
content:
application/json:
schema:
$ref: "#/components/schemas/BlockResponse"
"500":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/block_by_hash:
get:
summary: Get block by hash
operationId: block_by_hash
parameters:
- in: query
name: hash
description: block hash
required: true
schema:
type: string
example: "0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED"
tags:
- Info
description: |
Get Block By Hash.
responses:
"200":
description: Block information.
content:
application/json:
schema:
$ref: "#/components/schemas/BlockResponse"
"500":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/block_results:
get:
summary: Get block results at a specified height
operationId: block_results
parameters:
- in: query
name: height
description: height to return. If no height is provided, it will fetch information regarding the latest block.
schema:
type: integer
default: 0
example: 1
tags:
- Info
description: |
Get block_results.
responses:
"200":
description: Block results.
content:
application/json:
schema:
$ref: "#/components/schemas/BlockSearchResponse"
"500":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/commit:
get:
summary: Get commit results at a specified height
operationId: commit
parameters:
- in: query
name: height
description: height to return. If no height is provided, it will fetch commit information regarding the latest block.
schema:
type: integer
default: 0
example: 1
tags:
- Info
description: |
Get Commit.
responses:
"200":
description: |
Commit results.
canonical switches from false to true for block H once block H+1 has been committed. Until then it's subjective and only reflects what this node has seen so far.