Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
1177 lines (1134 loc) · 39 KB
/
Copy pathopenapi.yaml
File metadata and controls
1177 lines (1134 loc) · 39 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
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.3
info:
title: Basis Tracker API
description: |
HTTP API for Basis Tracker - a decentralized system for offchain IOU notes backed by on-chain reserves.
Basis enables efficient offchain cash systems for micropayments and community currencies, allowing:
- Credit-based payments (unbacked IOU money)
- On-chain collateral management via Ergo reserves
- Real-time tracking of debt relationships
- Secure redemption processes with Schnorr signatures
The system uses secp256k1 cryptography with 33-byte compressed public keys and 65-byte Schnorr signatures.
Trackers maintain offchain ledgers while reserves provide on-chain collateral backing.
version: 1.0.0
contact:
name: Basis Tracker Team
url: https://github.com/bml/basis-tracker
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: http://localhost:3048
description: Local development server
paths:
/:
get:
summary: Health check endpoint
description: Returns a simple message to verify the API is running
operationId: root
responses:
'200':
description: Successful response
content:
text/plain:
schema:
type: string
example: "Hello, Basis Tracker API!"
/notes:
post:
summary: Create a new IOU note
description: Creates a new IOU note with the specified parameters. The note must be signed by the issuer.
operationId: createNote
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateNoteRequest'
responses:
'201':
description: Note created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseEmpty'
'400':
description: Bad request - invalid input parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/notes/issuer/{pubkey}:
get:
summary: Get notes by issuer
description: Retrieve all IOU notes issued by a specific public key
operationId: getNotesByIssuer
parameters:
- name: pubkey
in: path
required: true
description: Hex-encoded issuer public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
responses:
'200':
description: Successfully retrieved notes
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseNotes'
'400':
description: Bad request - invalid public key format
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/notes/issuer/{issuer_pubkey}/recipient/{recipient_pubkey}:
get:
summary: Get specific note by issuer and recipient
description: Retrieve a specific IOU note between an issuer and recipient
operationId: getNoteByIssuerAndRecipient
parameters:
- name: issuer_pubkey
in: path
required: true
description: Hex-encoded issuer public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
- name: recipient_pubkey
in: path
required: true
description: Hex-encoded recipient public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "020202020202020202020202020202020202020202020202020202020202020202"
responses:
'200':
description: Successfully retrieved note
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseNote'
'404':
description: Note not found
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseEmpty'
'400':
description: Bad request - invalid public key format
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/reserves/issuer/{pubkey}:
get:
summary: Get reserves by issuer
description: Retrieve all reserves managed by a specific issuer
operationId: getReservesByIssuer
parameters:
- name: pubkey
in: path
required: true
description: Hex-encoded issuer public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
responses:
'200':
description: Successfully retrieved reserves
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseReserves'
'400':
description: Bad request - invalid public key format
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/events:
get:
summary: Get recent tracker events
description: Retrieve the 50 most recent tracker events including note updates, reserve changes, and system events
operationId: getEvents
responses:
'200':
description: Successfully retrieved events
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseEvents'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/events/paginated:
get:
summary: Get paginated tracker events
description: Retrieve paginated tracker events including note updates, reserve changes, and system events
operationId: getEventsPaginated
parameters:
- name: page
in: query
required: false
description: Page number (0-indexed)
schema:
type: integer
minimum: 0
default: 0
- name: page_size
in: query
required: false
description: Number of items per page (max 100)
schema:
type: integer
minimum: 1
maximum: 100
default: 20
responses:
'200':
description: Successfully retrieved events
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseEvents'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/key-status/{pubkey}:
get:
summary: Get key status information
description: Retrieve comprehensive status information for a specific public key including debt, collateral, and collateralization ratio
operationId: getKeyStatus
tags:
- Status
parameters:
- name: pubkey
in: path
required: true
description: Hex-encoded public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
responses:
'200':
description: Successfully retrieved key status
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseKeyStatus'
'400':
description: Bad request - invalid public key format
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/redeem:
post:
summary: Initiate redemption process
description: Initiate the redemption of an IOU note from a reserve
operationId: initiateRedemption
tags:
- Redemption
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RedeemRequest'
responses:
'200':
description: Redemption initiated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseRedeem'
'400':
description: Bad request - invalid input parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/proof:
get:
summary: Get proof for a specific note
description: Generate and retrieve a proof for a specific IOU note against the current tracker state
operationId: getProof
tags:
- Proofs
parameters:
- name: issuer_pubkey
in: query
required: true
description: Hex-encoded issuer public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
- name: recipient_pubkey
in: query
required: true
description: Hex-encoded recipient public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "020202020202020202020202020202020202020202020202020202020202020202"
responses:
'200':
description: Successfully generated proof
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseProof'
'400':
description: Bad request - invalid public key format or missing parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/tracker/proof:
get:
summary: Get tracker lookup proof
description: |
Get AVL proof for totalDebt from tracker's AVL tree.
Returns proof for context extension variable #8 in redemption transactions.
operationId: getTrackerProof
tags:
- Proofs
parameters:
- name: issuer_pubkey
in: query
required: true
description: Hex-encoded issuer public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
- name: recipient_pubkey
in: query
required: true
description: Hex-encoded recipient public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "020202020202020202020202020202020202020202020202020202020202020202"
responses:
'200':
description: Successfully generated tracker proof
content:
application/json:
schema:
$ref: '#/components/schemas/TrackerProofData'
'400':
description: Bad request - invalid public key format
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/reserve/proof:
get:
summary: Get reserve lookup proof
description: |
Get AVL proof for already_redeemed from reserve's AVL tree.
Returns proof for context extension variable #7 in redemption transactions.
For first redemptions, returns proof: null (no lookup proof needed).
operationId: getReserveProof
tags:
- Proofs
parameters:
- name: issuer_pubkey
in: query
required: true
description: Hex-encoded issuer public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
- name: recipient_pubkey
in: query
required: true
description: Hex-encoded recipient public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "020202020202020202020202020202020202020202020202020202020202020202"
responses:
'200':
description: Successfully generated reserve proof
content:
application/json:
schema:
$ref: '#/components/schemas/ReserveProofData'
'400':
description: Bad request - invalid public key format
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/tracker/signature:
post:
summary: Request tracker signature for redemption
description: |
Request Schnorr signature from tracker for redemption.
The tracker signs: key || totalDebt || timestamp
where key = blake2b256(ownerKey || receiverKey)
operationId: requestTrackerSignature
tags:
- Redemption
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TrackerSignatureRequest'
responses:
'200':
description: Successfully generated tracker signature
content:
application/json:
schema:
$ref: '#/components/schemas/TrackerSignatureResponse'
'400':
description: Bad request - invalid public key format
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
/proof/redemption:
get:
summary: Get comprehensive redemption proof
description: |
Get all proofs needed for redemption in a single request.
Includes tracker lookup proof, reserve lookup proof, and reserve insert proof.
operationId: getRedemptionProof
tags:
- Proofs
parameters:
- name: issuer_pubkey
in: query
required: true
description: Hex-encoded issuer public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
- name: recipient_pubkey
in: query
required: true
description: Hex-encoded recipient public key (66 characters)
schema:
type: string
pattern: '^[0-9a-fA-F]{66}$'
example: "020202020202020202020202020202020202020202020202020202020202020202"
- name: amount
in: query
required: false
description: Redemption amount (optional)
schema:
type: integer
format: uint64
example: 500000000
responses:
'200':
description: Successfully generated redemption proof
content:
application/json:
schema:
$ref: '#/components/schemas/RedemptionProofResponse'
'400':
description: Bad request - invalid parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponseError'
components:
schemas:
# Request/Response Structures
CreateNoteRequest:
type: object
required:
- recipient_pubkey
- amount
- timestamp
- signature
- issuer_pubkey
properties:
recipient_pubkey:
type: string
description: Hex-encoded recipient public key (66 characters)
pattern: '^[0-9a-fA-F]{66}$'
example: "020202020202020202020202020202020202020202020202020202020202020202"
amount:
type: integer
format: uint64
description: Total cumulative debt amount (used in signing message)
minimum: 0
example: 1000
timestamp:
type: integer
format: uint64
description: Unix timestamp when the note was created (tracked for record-keeping, not used in signing)
minimum: 0
example: 1234567890
signature:
type: string
description: Hex-encoded Schnorr signature (130 characters)
pattern: '^[0-9a-fA-F]{130}$'
example: "0303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303"
issuer_pubkey:
type: string
description: Hex-encoded issuer public key (66 characters)
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
SerializableIouNote:
type: object
description: Serializable IOU note for API responses
properties:
recipient_pubkey:
type: string
description: Hex-encoded recipient public key
example: "020202020202020202020202020202020202020202020202020202020202020202"
amount:
type: integer
format: uint64
description: Total cumulative debt amount
example: 1000
timestamp:
type: integer
format: uint64
description: Creation timestamp (tracked for record-keeping, not used in signing)
example: 1234567890
signature:
type: string
description: Hex-encoded Schnorr signature (signs key || totalDebt || timestamp)
example: "0303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303"
SerializableReserveInfo:
type: object
description: Serializable reserve information
properties:
box_id:
type: string
description: Hex-encoded reserve box ID
example: "f1e2d3c4b5a697887766554433221100ffeeddccbbaa99887766554433221100"
owner_pubkey:
type: string
description: Hex-encoded owner public key
example: "010101010101010101010101010101010101010101010101010101010101010101"
collateral_amount:
type: integer
format: uint64
description: Amount of collateral in nanoERG
example: 2500000000
total_debt:
type: integer
format: uint64
description: Total debt issued against this reserve
example: 1200000000
tracker_nft_id:
type: string
nullable: true
description: Optional tracker NFT ID
example: "a1b2c3d4e5f67788990011223344556677889900112233445566778899001122"
last_updated_height:
type: integer
format: uint64
description: Last blockchain height when reserve was updated
example: 1250
last_updated_timestamp:
type: integer
format: uint64
description: Last update timestamp
example: 1672531200
collateralization_ratio:
type: number
format: float
description: Current collateralization ratio
example: 2.08
EventType:
type: string
description: Type of tracker event
enum:
- NoteUpdated
- ReserveCreated
- ReserveToppedUp
- ReserveRedeemed
- ReserveSpent
- Commitment
- CollateralAlert
TrackerEvent:
type: object
description: Unified tracker event structure
properties:
id:
type: integer
format: uint64
description: Event ID
example: 1
type:
$ref: '#/components/schemas/EventType'
timestamp:
type: integer
format: uint64
description: Event timestamp
example: 1234567890
issuer_pubkey:
type: string
nullable: true
description: Hex-encoded issuer public key
example: "010101010101010101010101010101010101010101010101010101010101010101"
recipient_pubkey:
type: string
nullable: true
description: Hex-encoded recipient public key
example: "020202020202020202020202020202020202020202020202020202020202020202"
amount:
type: integer
format: uint64
nullable: true
description: Amount involved in the event
example: 1000
reserve_box_id:
type: string
nullable: true
description: Reserve box ID for reserve events
example: "box1234567890abcdef"
collateral_amount:
type: integer
format: uint64
nullable: true
description: Collateral amount for reserve events
example: 1000000000
redeemed_amount:
type: integer
format: uint64
nullable: true
description: Redeemed amount for redemption events
example: 500000000
height:
type: integer
format: uint64
nullable: true
description: Blockchain height when event occurred
example: 1000
KeyStatusResponse:
type: object
description: Key status information
properties:
total_debt:
type: integer
format: uint64
description: Total debt issued by this key
example: 1500000000
collateral:
type: integer
format: uint64
description: Total collateral backing the debt
example: 3000000000
collateralization_ratio:
type: number
format: float
description: Current collateralization ratio
example: 2.0
note_count:
type: integer
description: Number of outstanding notes
example: 5
last_updated:
type: integer
format: uint64
description: Last update timestamp
example: 1672531200
issuer_pubkey:
type: string
description: Hex-encoded issuer public key
example: "010101010101010101010101010101010101010101010101010101010101010101"
RedeemRequest:
type: object
description: Redemption request
required:
- issuer_pubkey
- recipient_pubkey
- amount
- timestamp
- issuer_signature
properties:
issuer_pubkey:
type: string
description: Hex-encoded issuer public key (66 characters)
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
recipient_pubkey:
type: string
description: Hex-encoded recipient public key (66 characters)
pattern: '^[0-9a-fA-F]{66}$'
example: "020202020202020202020202020202020202020202020202020202020202020202"
amount:
type: integer
format: uint64
description: Amount to redeem
example: 500000000
timestamp:
type: integer
format: uint64
description: Timestamp of the note being redeemed
example: 1234567890
reserve_box_id:
type: string
description: Reserve box ID (optional - server will lookup if not provided)
example: "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
tracker_box_id:
type: string
description: Tracker box ID (optional - server will fetch if not provided)
example: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
tracker_nft_id:
type: string
description: Tracker NFT ID (optional - server will fetch if not provided)
example: "fedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321"
current_height:
type: integer
format: uint64
description: Current blockchain height (optional - server will fetch if not provided)
example: 1000000
recipient_address:
type: string
description: Recipient address (optional - server will derive from pubkey if not provided)
example: "9fD5TqXvN8Z3k2LmP7wR4sY6uH1jC8bA0eG9iK3oM5nQ2xV"
change_address:
type: string
description: Change address (optional - server will derive from tracker pubkey if not provided)
example: "9fD5TqXvN8Z3k2LmP7wR4sY6uH1jC8bA0eG9iK3oM5nQ2xV"
issuer_signature:
type: string
description: Hex-encoded Schnorr signature from issuer (130 characters = 65 bytes)
pattern: '^[0-9a-fA-F]{130}$'
example: "0303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303"
emergency:
type: boolean
description: Whether this is an emergency redemption (after 3 days tracker unavailability)
default: false
example: false
tracker_signature:
type: string
description: Hex-encoded Schnorr signature from tracker (optional - server will generate if not provided)
pattern: '^[0-9a-fA-F]{130}$'
example: "0404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404"
RedeemResponse:
type: object
description: Redemption response
properties:
redemption_id:
type: string
description: Unique redemption identifier
example: "redeem_0101010101010101_0202020202020202"
amount:
type: integer
format: uint64
description: Amount being redeemed
example: 500000000
timestamp:
type: integer
format: uint64
description: Redemption timestamp
example: 1672531200
proof_available:
type: boolean
description: Whether proof is available
example: true
transaction_pending:
type: boolean
description: Whether redemption transaction is pending
example: false
ProofResponse:
type: object
description: Proof response
properties:
issuer_pubkey:
type: string
description: Hex-encoded issuer public key
example: "010101010101010101010101010101010101010101010101010101010101010101"
recipient_pubkey:
type: string
description: Hex-encoded recipient public key
example: "020202020202020202020202020202020202020202020202020202020202020202"
proof_data:
type: string
description: Hex-encoded proof data
example: "proof_0101010101010101_0202020202020202"
tracker_state_digest:
type: string
description: Tracker state digest at proof generation
example: "mock_digest_1234567890abcdef"
block_height:
type: integer
format: uint64
description: Blockchain height when proof was generated
example: 1500
timestamp:
type: integer
format: uint64
description: Proof generation timestamp
example: 1672531200
# API Response Wrappers
ApiResponse:
type: object
description: Standard API response format
properties:
success:
type: boolean
description: Whether the request was successful
data:
type: object
nullable: true
description: Response data (null for error responses)
error:
type: string
nullable: true
description: Error message (null for successful responses)
# Tracker Signature Request/Response
TrackerSignatureRequest:
type: object
description: Request for tracker signature on redemption
required:
- issuer_pubkey
- recipient_pubkey
- total_debt
properties:
issuer_pubkey:
type: string
description: Hex-encoded issuer public key (66 characters)
pattern: '^[0-9a-fA-F]{66}$'
example: "010101010101010101010101010101010101010101010101010101010101010101"
recipient_pubkey:
type: string
description: Hex-encoded recipient public key (66 characters)
pattern: '^[0-9a-fA-F]{66}$'
example: "020202020202020202020202020202020202020202020202020202020202020202"
total_debt:
type: integer
format: uint64
description: Total cumulative debt amount
example: 1000000000
emergency:
type: boolean
description: Whether this is an emergency redemption
default: false
example: false
TrackerSignatureResponse:
type: object
description: Tracker signature response
properties:
success:
type: boolean
description: Whether signature generation was successful
example: true
tracker_signature:
type: string
description: Hex-encoded Schnorr signature (130 characters)
example: "0404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404"
tracker_pubkey:
type: string
description: Hex-encoded tracker public key
example: "030303030303030303030303030303030303030303030303030303030303030303"
message_signed:
type: string
description: Hex-encoded message that was signed
example: "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
is_emergency:
type: boolean
description: Whether this was an emergency redemption
example: false
# Proof Data Structures
TrackerProofData:
type: object
description: Tracker lookup proof data
properties:
key:
type: string
description: Hex-encoded AVL tree key
example: "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
value:
type: string
description: 'Hex-encoded value: totalDebt as 8-byte big-endian'
example: "000000003b9aca00"
proof:
type: string
description: Hex-encoded AVL proof bytes
example: "0102030405060708"
total_debt:
type: integer
format: uint64
description: Total debt as integer
example: 1000000000
tracker_state_digest:
type: string
description: Current tracker state digest (R5 register value)
example: "64abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
ReserveProofData:
type: object
description: Reserve lookup proof data
properties:
key:
type: string
description: Hex-encoded AVL tree key
example: "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
value:
type: string
description: 'Hex-encoded value: already_redeemed as 8-byte big-endian'
example: "000000003b9aca00"
proof:
type: string
nullable: true
description: Hex-encoded AVL proof bytes (null for first redemption)
example: "0102030405060708"
already_redeemed:
type: integer
format: uint64
description: Already redeemed amount as integer
example: 500000000
is_first_redemption:
type: boolean
description: Whether this is the first redemption (no lookup proof needed)