-
Notifications
You must be signed in to change notification settings - Fork 1
/
chainweb.openapi.yaml
3471 lines (3187 loc) · 138 KB
/
chainweb.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
# ############################################################################ #
info:
title: Kadena Chainweb Node API
description: |
API of [chainweb-node](https://github.com/kadena-io/chainweb-node)
Chainweb is a scalable Proof-Of-Work (PoW) consensus algorithm. It is an
conservative extension of Bitcoin's Nakamoto consensus that extends
Bitcoin's single chain algorithm to multiple chains. This allows for
unlimited transaction throughput by horizontally scaling the number of chains.
Feedback and bug reports for the content of this site are welcome. Please
open an issue at [this github repository](https://github.com/kadena-io/chainweb-openapi/issues).
version: '0.0'
x-logo:
url: 'https://i.imgur.com/bAZFAGF.png'
# backgroundColor: '#0033A0'
alttext: Kadena Chainweb Logo
# ############################################################################ #
# Servers
# ############################################################################ #
servers:
- url: "https://api.chainweb.com/chainweb/{apiVersion}/mainnet01"
description: |
Chainweb mainnet service API. It also serves some endpoints of the P2P API.
variables:
apiVersion:
default: "0.0"
- url: "https://api.testnet.chainweb.com/chainweb/{apiVersion}/testnet04"
description: |
Chainweb testnet service API. It also serves some endpoints of the P2P API.
variables:
apiVersion:
default: "0.0"
- url: "{schema}://{domain}:{port}/chainweb/{apiVersion}/{chainwebVersion}"
description: |
An generic chainweb-node. It may serve only a subset of the endpoints.
variables:
schema:
default: http
enum: [ "http", "https" ]
domain:
default: api.chainweb.com
port:
default: "1848"
chainwebVersion:
default: mainnet01
enum: [ "test-singleton", "development", "mainnet01", "testnet04" ]
apiVersion:
default: "0.0"
- url: "https://{location}.chainweb.com/chainweb/{apiVersion}/mainnet01"
description: Chainweb mainnet P2P bootstrap node. Only P2P API endpoints are served.
variables:
location:
default: us-e1
enum: [ "us-e1", "us-e2", "us-e3", "us-w1", "us-w2", "us-w3", "fr1", "fr2", "fr3", "jp1", "jp2", "jp3"]
apiVersion:
default: "0.0"
- url: "https://{location}.testnet.chainweb.com/chainweb/{apiVersion}/testnet04"
description: Chainweb testnet P2P bootstrap node. Only P2P API endpoints are served.
variables:
location:
default: us-e1
enum: [ "us1", "us2", "eu1", "eu2", "ap1", "ap2" ]
apiVersion:
default: "0.0"
# ############################################################################ #
# Tags
# ############################################################################ #
tags:
# ############################################################################ #
# Endpoints
- name: p2p_api
x-displayName: P2P API
description: |
The P2P API is used for inter-node communication in order to establish block
chain consensus. Each chainweb-node serves these endpoints via HTTPS on a
network interface and port that is available directly on the public
internet.
Additionally, endpoints of the P2P API can be made available for other
clients. For this purpose it is possible to expose the endpoints via reverse
proxies, load balancers, or authentication frameworks, and similar web
technologies.
- name: service_api
x-displayName: Service API
description: |
The Service API includes endpoints that expose functionality of
chainweb-node to clients other than chainweb-nodes, such as mining pools,
DAPPs, web applications, exchanges, wallets, etc.
The endpoints of the service API are optional and can be enabled via
respective configuration settings. They are served on a separate port via
plain HTTP. Node operators are free to expose those endpoints only locally,
or via reverse proxies, load balancers, authentication frameworks, and
similar web technologies.
Some of the endpoints of the service API can require considerable resources
on the server side and administrators should be careful when exposing those
publicly. Generally, endpoints of the service API are more vulnerable to DOS
attacks.
- name: cut
x-displayName: Cut Endpoints
description: |
A cut represents a distributed state of a chainweb. It references one
block header for each chain, such that those blocks are pairwise
concurrent.
Two blocks from two different chains are said to be concurrent if either
one of them is an adjacent parent (is a direct dependency) of the other or
if the blocks do not depend at all on each other.
- name: peer
x-displayName: Peer Endpoints
description: |
The P2P communication between chainweb-nodes is sharded into several independent
P2P network. The `cut` network is exchanging consensus state. There is also one
mempool P2P network for each chain.
- name: mempool
x-displayName: Mempool P2P Endpoints
description: |
Mempool P2P endpoints for communication between mempools. Endusers are not
supposed to use these endpoints directly. Instead, the respective Pact
endpoints should be used for submitting transactions into the network.
- name: payload
x-displayName: Block Payload Endpoints
description: |
Raw literal Block Payloads in the form in which they are stored on the chain.
By default only the payload data is returned which is sufficient for validating
the blockchain Merkle Tree. It is also sufficient as input to Pact for
executing the Pact transactions of the block and recomputing the outputs.
It is also possible to query the transaction outputs along with the payload data.
- name: blockhash
x-displayName: Block Hashes Endpoints
description: |
These endpoints return block hashes from the chain database.
Generally, block hashes are returned in ascending order and include hashes
from orphaned blocks.
For only querying blocks that are included in the winning branch of the
chain the `branch` endpoint can be used, which returns blocks in descending
order starting from the leafs of branches of the block chain.
- name: block
x-displayName: Block Endpoints
description: |
These endpoints return whole blocks, headers and payloads, from the chain
database.
Generally, blocks are returned in ascending order and include orphaned
blocks.
For only querying blocks that are included in the winning branch of the
chain the `branch` endpoints can be used, which return blocks in descending
order starting from the leafs of branches of the block chain.
Blocks are returned in only one format, with block headers and payloads in
JSON encoding.
- name: header
x-displayName: Block Header Endpoints
description: |
These endpoints return block headers from the chain database.
Similar to the block endpoints, block headers are generally returned in
ascending order and include headers of orphaned blocks.
For only querying block headers that are included in the winning branch of
the chain the `branch` endpoints can be used, which return block headers in
descending order starting from the leafs of branches of the block chain.
Block headers are returned in three different formats specified in the `accept` header of the request:
* `application/json`, returns block headers in base64Url (without padding)
encoded binary.
* `application/json;blockheader-encoding=object`, returns block headers in
JSON encoding.
* `application/octet-stream`, when supported by the endpoint, returns block
headers as binary.
- name: config
x-displayName: Config Endpoint
- name: misc
x-displayName: Miscellaneous Endpoints
- name: pact
x-displayName: Pact Endpoints
description: |
The [Pact](https://pactlang.org) endpoints are documented in the [Pact API
Specification](./pact.html).
The Pact endpoints for chain `{chainId}` use the route prefix
`/chain/{chainId}/pact/` in addition to the base URL.
Futher details can also be found in [this section of the Pact Language
Reference](https://pact-language.readthedocs.io/en/stable/pact-reference.html#endpoints).
- name: rosetta
x-displayName: Rosetta Endpoints
description: |
Chainweb node includes an implementation of the
[Rosetta API](https://www.rosetta-api.org). The API is disabled by default
and can be enabled in the configuration file of a node.
The following endpoints are supported, which are documented
in the [Rosetta Specification](https://www.rosetta-api.org/docs/welcome.html):
* `POST rosetta/account/balance`
* `POST rosetta/block/transaction`
* `POST rosetta/block`
* `POST rosetta/construction/metadata`
* `POST rosetta/construction/submit`
* `POST rosetta/mempool/transaction`
* `POST rosetta/mempool`
* `POST rosetta/network/list`
* `POST rosetta/network/options`
* `POST rosetta/network/status`
- name: mining
x-displayName: Mining Endpoints
description: |
The Mining API of Chainweb node is disabled by default. It can be enabled
and configured in the configuration file.
The mining API consists of the following endpoints that
are described in detail on the
[Chainweb mining wiki page](https://github.com/kadena-io/chainweb-node/wiki/Mining-API)
* `GET mining/work`
* `POST mining/solved`
* `GET mining/updates`
# ############################################################################ #
# Binary Encodings
- name: binaryHeader
x-displayName: Block Header Binary Encoding
description: |
## Binary Format For Chain Graphs of Degree Three
defined in `Chainweb.BlockHeader`
| Size | Bytes | Value |
| ---- | ------- | ----------- |
| 8 | 0-7 | flags |
| 8 | 8-15 | time |
| 32 | 16-47 | parent |
| 110 | 48-157 | adjacents |
| 32 | 158-189 | target |
| 32 | 190-221 | payload |
| 4 | 222-225 | chain |
| 32 | 226-257 | weight |
| 8 | 258-265 | height |
| 4 | 266-269 | version |
| 8 | 270-277 | epoch start |
| 8 | 278-285 | nonce |
| 32 | 286-317 | hash |
total: 318 bytes
Adjacent Parents Record (length 3):
| Bytes | Value |
| ----- | --------- |
| 0-1 | length |
| 2-109 | adjacents |
total: 110 bytes
Adjacent Parent:
| Bytes | Value |
| ----- | ----- |
| 0-3 | chain |
| 4-35 | hash |
total: 36 bytes
## Fields
**POW related values**:
Arithmetic operations and comparisons on `parent`, `target`, `weight`, and `hash`
interpret the value as unsigned 256 bit integral numbers in little endian encoding.
All operations are performed using rational arithmetic of unlimited precision and the final result is rounded.
Please consult the code for details of how the result is rounded.
**Time Stamps**:
`time` and `epoch start` are a little endian twoth complement encoded integral numbers that count SI microseconds since POSIX epoch (leap seconds are ignored). These numbers are always positive (highest bit is 0).
**Numbers**:
* `height` is a little endian encoded unsigned integral 64 bit number.
* `length` is a little endian encoded unsigned integral 16 bit number.
**Version**:
`version` identifies the chainweb version. It is a 32 bit value in little endian encoding.
Values up to 0x0000FFFF are reserved for production versions (which includes `development` and testnets).
| value | version |
| ---------- | ----------- |
| 0x00000005 | mainnet01 |
| 0x00000001 | development |
| 0x00000007 | testnet04 |
**Other**:
* `nonce` is any sequence of 8 bytes that is only compared for equality.
* `chain` is any sequence of 4 bytes that identifies a chain and can be compared for equality.
* `payload` is any sequence of 32 bytes that is a cryptographic hash of the payload associated with the block and can be compared for equality.
* `flags` are eight bytes of value 0x0 that are reserved for future use.
- name: binaryWorkHeader
x-displayName: Work Header Binary Encoding
description: |
The work bytes received from the `/miner/work` endpoint is slightly different than the above header format. These headers do not include the block hash, instead prefixing the header above (without hash) with chain id and hash target bytes.
The first 36 bytes are informational. Only the bytes from position 36 to the end are subject of the POW hash computation.
The final 8 bytes are the nonce. The creation time is encoded in bytes 44-52 (see above for details of the encoding). Miners are allowed, but not required, to update the time to reflect the solve time for the block more closely.
A larger value for the creation time increases the accuracy of difficulty adjustment which is in the interest of miners -- the high difficulty guarantees that the outcome of the race of winning blocks is determined by actual hash power. However, blocks that are predated (i.e. have a creation time that is in the future) are rejected during block header validation. Leaving the time unchanged is a valid choice.
Miners must not change or make any assumptions about the content of the "reserved" bytes.
Defined in `Chainweb.Miner.Core`
| Size | Bytes | Work Bytes | Value |
| ---- | ------- | -----------| ----------- |
| 4 | 0-3 | NA | chain |
| 32 | 4-35 | NA | hash-target |
| | | | |
| 8 | 36-43 | 0-7 | reserved |
| 8 | 44-51 | 8-15 | **time** |
| 298 | 52-313 | 16-277 | reserved |
| 8 | 314-321 | 278-285 | **nonce** |
total: 322 bytes
For arithmetic comparisons the `hash-target` is interpreted as unsigned 256 bit integral number in little endian encoding.
`time` is a little endian twoth complement encoded integral number that counts SI microseconds since POSIX epoch (leap seconds are ignored). The value is always positive (highest bit is 0).
# ############################################################################ #
# Data Models
- name: cut_model
x-displayName: Cut Model
description: |
The `origin` property is required for use with the `PUT /cut` endpoint.
<SchemaDefinition schemaRef="#/components/schemas/cut" showReadOnly={true} showWriteOnly={true} />
- name: payload_model
x-displayName: Payload Model
description: |
<SchemaDefinition schemaRef="#/components/schemas/payload" showReadOnly={true} showWriteOnly={true} />
- name: payloadWithOutputs_model
x-displayName: Payload With Outputs Model
description: |
<SchemaDefinition schemaRef="#/components/schemas/payloadWithOutputs" showReadOnly={true} showWriteOnly={true} />
- name: header_model
x-displayName: Block Header Model
description: |
<SchemaDefinition schemaRef="#/components/schemas/blockHeader" showReadOnly={true} showWriteOnly={true} />
- name: peer_model
x-displayName: Peer Info Model
description: |
<SchemaDefinition schemaRef="#/components/schemas/peer" showReadOnly={true} showWriteOnly={true} />
## Compute PeerInfo
Generally, it is easier to query the peer info of a peer using a GET query for a peer database.
Otherwise the peer info can be computed as follows.
For peers that use domain names with valid CA signed SSL certificates the peer id is `null`.
For peers with self-signed certificates the peer id is the base64Url (without padding) encoded
SHA256 fingerprint of the certificate. For a chainweb-node `NODE` it can be computed as follows:
```sh
echo |
openssl s_client -showcerts -servername ${NODE} -connect ${NODE}:443 2>/dev/null |
openssl x509 -fingerprint -noout -sha256 |
sed 's/://g' |
tail -c 65 |
xxd -r -p |
base64 |
tr -d '=' |
tr '/+' '_-'
```
- name: nodeInfo_model
x-displayName: Chainweb Node Info Model
description: |
<SchemaDefinition schemaRef="#/components/schemas/nodeInfo" showReadOnly={true} showWriteOnly={true} />
- name: page_model
x-displayName: Collection Page Model
description: |
<SchemaDefinition schemaRef="#/components/schemas/page" showReadOnly={true} showWriteOnly={true} />
- name: minerInfo_model
x-displayName: Miner Info Model
description: |
<SchemaDefinition schemaRef="#/components/schemas/minerInfo" showReadOnly={true} showWriteOnly={true} />
- name: miningUpdateEventStream_model
x-displayName: Mining Update Event Stream Model
description: |
A server-sent event sources that notifies miners when new mining work
becomes available. The stream is terminated by the server in regular
intervals and it is up to the client to request a new stream.
Each event consists of a single line: `event:New Cut`.
Events are separated by empty lines.
<SchemaDefinition schemaRef="#/components/schemas/miningUpdateEventStream" showReadOnly={true} showWriteOnly={true} />
- name: commonResponseHeaders
x-displayName: Response Headers
description: |
## Server Timestamp
`x-server-timestamp`: The time of the clock of the remote node
<SchemaDefinition schemaRef="#/components/schemas/posixTimestamp" showReadOnly={true} showWriteOnly={true} />
## Chainweb Node Version
`x-chainweb-node-version`: The version of the remote chainweb node
<SchemaDefinition schemaRef="#/components/schemas/chainwebVersion" showReadOnly={true} showWriteOnly={true} />
## Client Peer Address
`x-peer-addr`: Host and port of the client as observed by the remote node
<SchemaDefinition schemaRef="#/components/schemas/hostAddress" showReadOnly={true} showWriteOnly={true} />
# ############################################################################ #
# Tag Groups
x-tagGroups:
- name: chainweb_p2p
x-displayName: Chainweb P2P API
tags:
- p2p_api
- cut
- blockhash
- header
- payload
- mempool
- peer
- config
- name: chainweb_service
x-displayName: Chainweb Service API
tags:
- service_api
- block
- misc
- mining
- pact
- rosetta
- name: Common HTTP Headers
tags:
- commonResponseHeaders
- name: Data Models
tags:
- cut_model
- header_model
- payload_model
- payloadWithOutputs_model
- peer_model
- nodeInfo_model
- page_model
- minerInfo_model
- miningUpdateEventStream_model
- name: Binary Encodings
tags:
- binaryHeader
- binaryWorkHeader
# ############################################################################ #
# Components
# ############################################################################ #
components:
# ########################################################################## #
schemas:
# POSIX time stamp
posixTimestamp:
title: POSIX Timestamp
type: integer
description: Seconds since POSIX epoch
example: 1619108524
minimum: 0
posixTimestampMicro:
title: POSIX Timestamp in Microseconds
type: integer
description: Microseconds since POSIX epoch
example: 1602382624629329
minimum: 0
# Chainweb Version
chainwebVersion:
title: Chainweb Version
description: The version of the Chainweb network
enum: [ "test-singleton", "development", "mainnet01", "testnet04" ]
# chain id
chainId:
title: Chain ID
description: |
A Chainweb chain ID. In Kadena Chainweb chains are named by numbers
starting form 0. Valid values depend on the current graph at the
respective block height of the chainweb version.
type: integer
minimum: 0
example: 0
# host address
hostAddress:
title: Host Address
description: Host address containing IPv4 and port
type: string
pattern: '^\d{4}.\d{4}.\d{4}.\d{4}:\d+$'
example: '10.36.1.3:42988'
# Signed Transaction Text
signedTxText:
title: Signed Transaction Text
type: string
description: Text of a JSON encoded signed Pact transaction
example:
$ref: '#/components/examples/signedTxText'
# RequestKey
requestKey:
title: Request Key
type: string
description: Base64Url-encoded, request key of a Pact transaction
pattern: "^[a-zA-Z0-9_-]{43}$"
# contentEncoding: base64Url
minLength: 43
maxLength: 43
example: y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw
# SHA256 Hash
sha256Hash:
title: SHA256 Hash
type: string
description: Base64Url (without padding) encoded SHA256 hash
pattern: "^[a-zA-Z0-9_-]{43}$"
# contentEncoding: base64Url
minLength: 43
maxLength: 43
example: y3aWL72-3wAy7vL9wcegGXnstH0lHi-q-cfxkhD5JCw
# Block Hash
blockHash:
title: Block Hash
description: Base64Url (without padding) encoded block hash
example: QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH7
allOf:
- $ref: '#/components/schemas/sha256Hash'
# payload Hash
payloadHash:
title: Block Payload Hash
description: Base64Url (without padding) encoded block payload hash
example: GpaWbHkHrCjRhY8hKE0qZ1WsBBaG3Y_zkFLV2sYumQA
allOf:
- $ref: '#/components/schemas/sha256Hash'
# height
blockHeight:
title: Block Height
description: |
The height of a block is the number of its predecessors in the block chain
type: integer
minimum: 0
example: 1000000
# weight
blockWeight:
title: Block Weight
description: |
The POW weight of a block is the sum of the difficulties of the block
and of all of its ancestors. The difficulty of a block is the maximum
difficulty divided by the target.
It represented as the base64Url (without padding) 256 bit little endian
encoding of the numerical value.
type: string
pattern: "^[a-zA-Z0-9_-]{43}$"
# contentEncoding: base64Url
minLength: 43
maxLength: 43
example: iil_D0t2MGqjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
# Target
target:
title: PoW Target
description: |
The PoW target of a block represented as the base64Url (without
padding) 256 bit little endian encoding of the numerical value.
type: string
pattern: "^[a-zA-Z0-9_-]{43}$"
# contentEncoding: base64Url
minLength: 43
maxLength: 43
example: 2uMCnB4lWsErj9w1C1vAp1sHYd-sABf3kgcAAAAAAAA
# Nonce
nonce:
title: PoW Nonce
description: |
PoW nonce of the block. This is computed by the miner such that the
block hash is smaller than the target.
type: string
pattern: "[0-9]+"
minLength: 1
# Binary block header in base64Url encoding
base64Header:
title: Base64Url Block Header
description: Base64Url (without padding) encoded binary block header
type: string
pattern: "[a-zA-Z0-9_-]+"
# contentEncoding: base64Url
# minLength: 424
# maxLength: 424
example:
value:
$ref: '#/components/examples/base64HeaderPage/value/items/0'
backupStatus:
title: Backup job status
type: string
pattern: "backup-done|backup-in-progress|backup-failed"
backupId:
title: Backup job identifier
description: Textual backup job identifier
type: string
pattern: "[a-zA-Z0-9_-]+"
example: 1648665437000
# Binary encoded Block Header
binaryHeader:
title: Binary Block Header
description: Binary representation of a block header
type: string
minLength: 318
maxLength: 318
# contentMediaType: application/octet-stream
# JSON encoded Block Header
blockHeader:
title: Block Header
description: JSON Encoded Block Header
required: [creationTime, parent, height, hash, chainId, weight, featureFlags, epochStart, adjacents, payloadHash, chainwebVersion, target, nonce]
example:
value:
$ref: '#/components/examples/blockHeaderPage/value/items/0'
properties:
creationTime:
$ref: '#/components/schemas/posixTimestampMicro'
parent:
$ref: '#/components/schemas/blockHash'
height:
$ref: '#/components/schemas/blockHeight'
hash:
$ref: '#/components/schemas/blockHash'
chainId:
$ref: '#/components/schemas/chainId'
weight:
$ref: '#/components/schemas/blockWeight'
featureFlags:
type: integer
description: A reserved value that must be 0.
epochStart:
$ref: '#/components/schemas/posixTimestampMicro'
adjacents:
description: |
The block hashes of the adjacent parents of the block. This is
represented as an associative array that maps the adjancent chain
ids to the respective block hash.
type: object
additionalProperties:
$ref: '#/components/schemas/blockHash'
payloadHash:
$ref: '#/components/schemas/payloadHash'
chainwebVersion:
$ref: '#/components/schemas/chainwebVersion'
target:
$ref: '#/components/schemas/target'
nonce:
$ref: '#/components/schemas/nonce'
# Block Payload
payload:
title: Block Payload
description: |
Payload of a Block including the Merkle roots for transactions and
transaction outputs.
required: [ transactions, minerData, transactionsHash, outputsHash, payloadHash ]
example:
value:
$ref: '#/components/examples/payloads/value/1'
properties:
transactions:
type: array
description: Array of base64Url (without padding) encoded JSON texts of signed Pact transactions
items:
type: string
pattern: "[a-zA-Z0-9_-]+"
# contentEncoding: base64Url
description: Base64Url (without padding) encoded JSON text of a signed Pact transaction
minerData:
type: string
pattern: "[a-zA-Z0-9_-]+"
# contentEncoding: base64Url
description: Base64Url (without padding) encoded JSON text of the miner data of the payload
transactionsHash:
$ref: '#/components/schemas/sha256Hash'
outputsHash:
$ref: '#/components/schemas/sha256Hash'
payloadHash:
$ref: '#/components/schemas/payloadHash'
# Block Payload With Outputs
payloadWithOutputs:
title: Block Payload With Outputs
description: |
Payload with outputs of a Block including the Merkle roots for
transactions and transaction outputs
required: [ transactions, minerData, transactionsHash, outputsHash, payloadHash, coinbase ]
example:
$ref: '#/components/examples/emptyPayload'
properties:
transactions:
type: array
description: |
Array of pairs of transactions and their outputs.
Signed Pact transactions and outputs are base64Url-encoded without padding.
items:
type: array
minItems: 2
maxItems: 2
items:
anyOf:
- type: string
pattern: "[a-zA-Z0-9_-]+"
# contentEncoding: base64Url
description: Base64Url (without padding) encoded JSON text of a signed Pact transaction
- type: string
pattern: "[a-zA-Z0-9_-]+"
# contentEncoding: base64Url
description: Base64Url (without padding) encoded JSON text of a transaction output
minerData:
type: string
pattern: "[a-zA-Z0-9_-]+"
# contentEncoding: base64Url
description: Base64Url (without padding) encoded JSON text of the miner data of the payload
transactionsHash:
$ref: '#/components/schemas/sha256Hash'
outputsHash:
$ref: '#/components/schemas/sha256Hash'
payloadHash:
$ref: '#/components/schemas/payloadHash'
coinbase:
type: string
pattern: "[a-zA-Z0-9_-]+"
# contentEncoding: base64Url
description: Base64Url (without padding) encoded JSON text of coinbase output of the block
block:
title: Full block
description: |
A block header and payload
required: [header, payloadWithOutputs]
example:
$ref: '#/components/examples/blockPage/value/items/0'
properties:
header:
$ref: '#/components/schemas/blockHeader'
payloadWithOutputs:
$ref: '#/components/schemas/payloadWithOutputs'
# Peer Info
peer:
title: Peer
description: Peer info object
required: [id, address]
example:
$ref: '#/components/examples/peers/value/items/0'
properties:
id:
description: |
The base64Url (without padding) encoded SHA256 fingerprint of the
SSL certificate of the node. This can be null only if the node uses
an official CA signed certificate
type: string
nullable: true
pattern: "[a-zA-Z0-9_-]{43}"
# contentEncoding: base64Url
address:
required: [hostname, port]
properties:
hostname:
description: |
A domain name or IP address. This must be a domain name only if
the respective node is using a valid CA signed SSL certificate.
type: string
oneOf:
- format: hostname
- format: ipv4
- format: ipv6
port:
description: Port number
type: integer
minimum: 1
maximum: 65535
# Cut
cut:
title: Cut
description: Cut datastruction of the chainweb API
required: [height, weight, hashes]
example:
$ref: '#/components/examples/cut'
properties:
origin:
$ref: "#/components/schemas/peer"
height:
description: |
The cut height is the sum of the height of all blocks of the cut.
Usage of this value should be avoided, because its semantics may
change in the future
type: integer
minimum: 0
# deprecated: true
weight:
description: The sum of the weights of all blocks in the cut
type: string
pattern: "[a-zA-Z0-9_-]{43}"
# contentEncoding: base64Url
hashes:
type: object
required: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
description: |
An object that maps chain Ids to their respective block hash and
block height
additionalProperties:
$ref: '#/components/schemas/hashWithBlockHeight'
instance:
type: string
id:
type: string
hashWithBlockHeight:
title: Hash with block height
description: A block hash and the height of that block
required: [hash, height]
example:
{
"height": 1539924,
"hash": "uP-pHW4QKrV9fN1mlDGwKuaiIDlJW7xYSj1nW53EHM4"
}
type: object
properties:
hash:
type: string
pattern: "[a-zA-Z0-9_-]{43}"
height:
type: integer
minimum: 0
# Info
nodeInfo:
title: Chainweb Node Info
description: General information about a chainweb node
required: [nodeNumberOfChains,nodeApiVersion,nodeChains,nodeVersion,nodeGraphHistory]
example:
$ref: '#/components/examples/info'
properties:
nodeNumberOfChains:
type: integer
minimum: 10
example: 20
nodeApiVersion:
type: string
example: "0.0"
nodeChains:
type: array
items:
description: Chain identifiers
type: string
minItems: 0
example: ["0"]
nodeVersion:
type: string
enum: [ "test-singleton", "development", "mainnet01", "testnet04" ]
example: mainnet01
nodeGraphHistory:
description: |
Array of all chain graphs indexed by the height of the first block with the repective
graph. Graphs are encoded as adjacency lists.
type: array
uniqueItems: true
minItems: 1
items:
description: A pair consisting of the height of the first block of a chain graph and the adjacency list of the graph.
type: array
minItems: 2
maxItems: 2
items:
oneOf:
- description: height of the first block of the graph
type: integer
minimum: 0
- description: adjacency list encoding of the chain graph.
type: array
items:
description: A pair of the chain identifier and the list of chains adjacent to it.
minItems: 2
maxItems: 2
type: array
items:
oneOf:
- description: a chain identifier
type: integer
minimum: 0
- description: an adjacency list for that chain
type: array
minItems: 0
items:
type: integer
minimum: 0
# Page (use with allOf to provide an schema for itmes)
page:
title: Page
description: Page of a collection of items
required: [next, limit, items]
example:
$ref: '#/components/examples/base64HeaderPage'
properties:
limit:
description: |
The number of items in the page. This number can be smaller but
never be larger than the number of requested items.
type: integer
minimum: 0
items:
description: Items of the returned collection
type: array
next:
description: |