-
-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathRustChain_API.postman_collection.json
More file actions
2187 lines (2187 loc) · 85 KB
/
RustChain_API.postman_collection.json
File metadata and controls
2187 lines (2187 loc) · 85 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
{
"info": {
"_postman_id": "rustchain-api-v2.2.1",
"name": "RustChain API v2.2.1",
"description": "Complete API collection for RustChain v2.2.1 (Security Hardened, Mainnet Candidate).\n\nThis collection covers all endpoints exposed by the integrated node at `node/rustchain_v2_integrated_v2.2.1_rip200.py`.\n\nFeatures covered:\n- RIP-0005 (Epochs)\n- RIP-0008 (Withdrawals + Replay Protection)\n- RIP-0009 (Finality)\n- RIP-0142 (Multisig Governance)\n- RIP-0143 (Readiness Aggregator)\n- RIP-0144 (Genesis Freeze)\n- RIP-0146/147 (Attestation & OUI enforcement)\n- RIP-0173 (Lottery/Eligibility Oracle)\n- RIP-0200 (Round-Robin 1CPU1Vote)\n- RIP-0200b (Deflationary Bounty Decay)\n- RIP-0301 (Fee Pool)\n- Beacon Protocol (OpenClaw envelope anchoring)\n- Signed Wallet Transfers (Ed25519)\n- 2-Phase Commit Pending Ledger\n- P2P Sync\n\nAdmin endpoints require the `X-API-Key` or `X-Admin-Key` header set to the value of the `RC_ADMIN_KEY` environment variable.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"variable": [
{
"key": "baseUrl",
"value": "http://50.28.86.131:8099",
"type": "string",
"description": "Base URL for the RustChain node"
},
{
"key": "adminKey",
"value": "YOUR_ADMIN_KEY_HERE",
"type": "string",
"description": "RC_ADMIN_KEY for admin-protected endpoints"
},
{
"key": "minerId",
"value": "g4-powerbook-01",
"type": "string",
"description": "Example miner ID"
},
{
"key": "minerPk",
"value": "RTCabcdef1234567890abcdef1234567890abcdef12",
"type": "string",
"description": "Example miner public key / wallet address"
}
],
"item": [
{
"name": "Health & Status",
"description": "Health checks, readiness probes, and system status endpoints.",
"item": [
{
"name": "Health Check",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/health",
"host": ["{{baseUrl}}"],
"path": ["health"]
},
"description": "Returns node health status including DB read/write status, backup age, tip age, and uptime."
},
"response": [
{
"name": "200 - Healthy",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"version\": \"2.2.1-security-hardened\",\n \"uptime_s\": 86400,\n \"db_rw\": true,\n \"backup_age_hours\": 2.5,\n \"tip_age_slots\": 0\n}"
}
]
},
{
"name": "Readiness Probe",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/ready",
"host": ["{{baseUrl}}"],
"path": ["ready"]
},
"description": "Returns whether the DB is reachable and migrations have been applied."
},
"response": [
{
"name": "200 - Ready",
"status": "OK",
"code": 200,
"body": "{\n \"ready\": true,\n \"version\": \"2.2.1-security-hardened\"\n}"
}
]
},
{
"name": "Ops Readiness Aggregator (RIP-0143)",
"request": {
"method": "GET",
"header": [
{
"key": "X-API-Key",
"value": "{{adminKey}}",
"description": "Admin key for detailed check output (optional - unauthenticated returns only ok/fail)"
}
],
"url": {
"raw": "{{baseUrl}}/ops/readiness",
"host": ["{{baseUrl}}"],
"path": ["ops", "readiness"]
},
"description": "Single PASS/FAIL aggregator for all go/no-go checks. Unauthenticated callers receive only the boolean result. Admin callers see detailed per-check output."
},
"response": [
{
"name": "200 - All checks pass (admin view)",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"checks\": [\n {\"name\": \"health\", \"ok\": true},\n {\"name\": \"tip_age_s\", \"ok\": true, \"val\": 120},\n {\"name\": \"headers_count\", \"ok\": true, \"val\": 5000},\n {\"name\": \"metrics_keys\", \"ok\": true, \"keys\": [\"rustchain_header_count\", \"rustchain_ticket_rejects_total\", \"rustchain_mem_remember_total\"]}\n ]\n}"
}
]
},
{
"name": "System Stats",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/api/stats",
"host": ["{{baseUrl}}"],
"path": ["api", "stats"]
},
"description": "Returns system-wide statistics: version, chain ID, current epoch, total miners, total balance, pending withdrawals, and feature/security flags."
},
"response": [
{
"name": "200 - Stats",
"status": "OK",
"code": 200,
"body": "{\n \"version\": \"2.2.1-security-hardened\",\n \"chain_id\": \"rustchain-mainnet-candidate\",\n \"epoch\": 42,\n \"block_time\": 600,\n \"total_miners\": 150,\n \"total_balance\": 96673.0,\n \"pending_withdrawals\": 3,\n \"features\": [\"RIP-0005\", \"RIP-0008\", \"RIP-0009\", \"RIP-0142\", \"RIP-0143\", \"RIP-0144\"],\n \"security\": [\"no_mock_sigs\", \"mandatory_admin_key\", \"replay_protection\", \"validated_json\"]\n}"
}
]
},
{
"name": "Prometheus Metrics",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/metrics",
"host": ["{{baseUrl}}"],
"path": ["metrics"]
},
"description": "Prometheus-format metrics endpoint for monitoring."
},
"response": []
},
{
"name": "MAC / Attestation / Enrollment Metrics",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/metrics_mac",
"host": ["{{baseUrl}}"],
"path": ["metrics_mac"]
},
"description": "Prometheus-format metrics for MAC OUI seen/denied, unique MACs in 24h, stale/active attestations, and enrollment ok/reject counters."
},
"response": []
},
{
"name": "OpenAPI Spec",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/openapi.json",
"host": ["{{baseUrl}}"],
"path": ["openapi.json"]
},
"description": "Returns the OpenAPI 3.0.3 specification for the node."
},
"response": []
},
{
"name": "OUI Enforcement Status",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/ops/oui/enforce",
"host": ["{{baseUrl}}"],
"path": ["ops", "oui", "enforce"]
},
"description": "Get the current OUI enforcement toggle state."
},
"response": [
{
"name": "200 - Enforcement status",
"status": "OK",
"code": 200,
"body": "{\n \"enforce\": 0\n}"
}
]
}
]
},
{
"name": "Attestation",
"description": "Hardware attestation endpoints for Proof of Antiquity. Miners must attest their hardware to participate in epoch enrollment.",
"item": [
{
"name": "Get Attestation Challenge",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/attest/challenge",
"host": ["{{baseUrl}}"],
"path": ["attest", "challenge"]
},
"description": "Issues a challenge nonce for hardware attestation. The nonce expires after 5 minutes."
},
"response": [
{
"name": "200 - Challenge issued",
"status": "OK",
"code": 200,
"body": "{\n \"nonce\": \"a1b2c3d4e5f6...64_hex_chars\",\n \"expires_at\": 1710000300,\n \"server_time\": 1710000000\n}"
}
]
},
{
"name": "Submit Attestation",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"miner\": \"{{minerId}}\",\n \"nonce\": \"<nonce_from_challenge>\",\n \"report\": {\n \"nonce\": \"<nonce_from_challenge>\",\n \"device_model\": \"PowerBook G4\",\n \"device_arch\": \"g4\",\n \"device_family\": \"powerpc\",\n \"cores\": 1,\n \"cpu_serial\": \"XJ4500123\",\n \"entropy_sources\": [\"cpu_jitter\", \"disk_latency\"],\n \"entropy_score\": 0.85\n },\n \"device\": {\n \"device_model\": \"PowerBook G4\",\n \"device_arch\": \"g4\",\n \"device_family\": \"powerpc\",\n \"cores\": 1\n },\n \"signals\": {\n \"macs\": [\"00:11:22:33:44:55\"]\n },\n \"fingerprint\": {\n \"cpu_flags\": \"altivec\",\n \"boot_id\": \"abc123\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/attest/submit",
"host": ["{{baseUrl}}"],
"path": ["attest", "submit"]
},
"description": "Submit hardware attestation with fingerprint and entropy validation. Includes hardware binding (one machine = one wallet), IP rate limiting, OUI enforcement, and temporal review."
},
"response": [
{
"name": "200 - Attestation accepted",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"miner\": \"g4-powerbook-01\",\n \"accepted\": true,\n \"entropy_score\": 0.85,\n \"fingerprint_passed\": true,\n \"temporal_review_flag\": false,\n \"macs_recorded\": 1,\n \"warthog_bonus\": 0\n}"
},
{
"name": "429 - Rate limited",
"status": "Too Many Requests",
"code": 429,
"body": "{\n \"ok\": false,\n \"error\": \"rate_limited\",\n \"message\": \"Too many unique miners from this IP address\",\n \"code\": \"IP_RATE_LIMIT\"\n}"
}
]
},
{
"name": "Ops Attestation Debug (Admin)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-API-Key",
"value": "{{adminKey}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"miner\": \"{{minerId}}\"\n}"
},
"url": {
"raw": "{{baseUrl}}/ops/attest/debug",
"host": ["{{baseUrl}}"],
"path": ["ops", "attest", "debug"]
},
"description": "Admin debug endpoint: shows miner's enrollment eligibility, attestation status, MAC data, and enrollment check config. Requires admin key."
},
"response": [
{
"name": "200 - Debug info",
"status": "OK",
"code": 200,
"body": "{\n \"miner\": \"g4-powerbook-01\",\n \"timestamp\": 1710000000,\n \"config\": {\n \"ENROLL_REQUIRE_TICKET\": true,\n \"ENROLL_TICKET_TTL_S\": 600,\n \"ENROLL_REQUIRE_MAC\": true,\n \"MAC_MAX_UNIQUE_PER_DAY\": 5\n },\n \"attestation\": {\n \"found\": true,\n \"ts_ok\": 1709999800,\n \"age_seconds\": 200,\n \"is_fresh\": true,\n \"device_family\": \"powerpc\",\n \"device_arch\": \"g4\",\n \"entropy_score\": 0.85\n },\n \"macs\": {\n \"unique_24h\": 1,\n \"entries\": []\n },\n \"would_pass_enrollment\": true,\n \"check_result\": {}\n}"
}
]
}
]
},
{
"name": "Epochs & Enrollment",
"description": "Epoch lifecycle, miner enrollment, and lottery eligibility (RIP-0005, RIP-0173, RIP-0200).",
"item": [
{
"name": "Get Current Epoch",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/epoch",
"host": ["{{baseUrl}}"],
"path": ["epoch"]
},
"description": "Returns current epoch info: epoch number, slot, pot size, enrolled miners count, blocks per epoch, and total supply."
},
"response": [
{
"name": "200 - Epoch info",
"status": "OK",
"code": 200,
"body": "{\n \"epoch\": 42,\n \"slot\": 25200,\n \"epoch_pot\": 1.5,\n \"enrolled_miners\": 12,\n \"blocks_per_epoch\": 600,\n \"total_supply_rtc\": 21000000\n}"
}
]
},
{
"name": "Enroll in Epoch",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"miner_pubkey\": \"{{minerPk}}\",\n \"miner_id\": \"{{minerId}}\",\n \"device\": {\n \"family\": \"powerpc\",\n \"arch\": \"g4\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/epoch/enroll",
"host": ["{{baseUrl}}"],
"path": ["epoch", "enroll"]
},
"description": "Enroll a miner in the current epoch. Requires prior attestation and MAC validation. Weight is calculated from hardware family/arch. VM-detected miners receive negligible weight (1e-9)."
},
"response": [
{
"name": "200 - Enrolled",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"epoch\": 42,\n \"weight\": 2.0,\n \"hw_weight\": 2.0,\n \"fingerprint_failed\": false,\n \"miner_pk\": \"RTCabcdef1234567890abcdef1234567890abcdef12\",\n \"miner_id\": \"g4-powerbook-01\"\n}"
},
{
"name": "412 - Precondition failed",
"status": "Precondition Failed",
"code": 412,
"body": "{\n \"error\": \"attestation_required\",\n \"message\": \"Fresh attestation required before enrollment\"\n}"
}
]
},
{
"name": "Lottery Eligibility (RIP-0200)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/lottery/eligibility?miner_id={{minerId}}",
"host": ["{{baseUrl}}"],
"path": ["lottery", "eligibility"],
"query": [
{
"key": "miner_id",
"value": "{{minerId}}"
}
]
},
"description": "RIP-200 round-robin eligibility check. Returns whether the miner is eligible for the current slot."
},
"response": [
{
"name": "200 - Eligibility result",
"status": "OK",
"code": 200,
"body": "{\n \"eligible\": true,\n \"miner_id\": \"g4-powerbook-01\",\n \"slot\": 25200,\n \"reason\": \"round_robin_selected\"\n}"
}
]
},
{
"name": "Get Epoch Rewards",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/rewards/epoch/42",
"host": ["{{baseUrl}}"],
"path": ["rewards", "epoch", "42"]
},
"description": "Get the reward distribution for a specific epoch."
},
"response": [
{
"name": "200 - Epoch rewards",
"status": "OK",
"code": 200,
"body": "{\n \"epoch\": 42,\n \"rewards\": [\n {\n \"miner_id\": \"g4-powerbook-01\",\n \"share_i64\": 250000,\n \"share_rtc\": 0.25\n }\n ]\n}"
}
]
},
{
"name": "Settle Epoch Rewards (Admin)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-API-Key",
"value": "{{adminKey}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"epoch\": 42\n}"
},
"url": {
"raw": "{{baseUrl}}/rewards/settle",
"host": ["{{baseUrl}}"],
"path": ["rewards", "settle"]
},
"description": "Settle (distribute) rewards for a specific epoch. Admin/cron callable. Requires admin key."
},
"response": []
}
]
},
{
"name": "Block Headers",
"description": "Signed block header ingestion and chain tip queries.",
"item": [
{
"name": "Set Miner Header Key (Admin)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-API-Key",
"value": "{{adminKey}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"miner_id\": \"{{minerId}}\",\n \"pubkey_hex\": \"abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890\"\n}"
},
"url": {
"raw": "{{baseUrl}}/miner/headerkey",
"host": ["{{baseUrl}}"],
"path": ["miner", "headerkey"]
},
"description": "Admin-set or update the header-signing Ed25519 public key for a miner. The pubkey_hex must be exactly 64 hex characters. Requires admin API key."
},
"response": [
{
"name": "200 - Key set",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"miner_id\": \"g4-powerbook-01\",\n \"pubkey_hex\": \"abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890\"\n}"
}
]
},
{
"name": "Ingest Signed Header",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"miner_id\": \"{{minerId}}\",\n \"header\": {\n \"slot\": 25200,\n \"parent_hash\": \"0000000000000000000000000000000000000000000000000000000000000000\",\n \"state_root\": \"0000000000000000000000000000000000000000000000000000000000000000\"\n },\n \"message\": \"<hex_encoded_message>\",\n \"signature\": \"<128_hex_char_ed25519_signature>\",\n \"pubkey\": \"<64_hex_char_public_key_testnet_only>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/headers/ingest_signed",
"host": ["{{baseUrl}}"],
"path": ["headers", "ingest_signed"]
},
"description": "Ingest a signed block header from a v2 miner. Verifies Ed25519 signature, validates header continuity, persists, and updates tip. On testnet with RC_TESTNET_ALLOW_INLINE_PUBKEY=1, the pubkey can be provided inline. Automatically settles epoch rewards when enough blocks are mined."
},
"response": [
{
"name": "200 - Header accepted",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"slot\": 25200,\n \"miner\": \"g4-powerbook-01\",\n \"ms\": 12\n}"
},
{
"name": "400 - Missing fields",
"status": "Bad Request",
"code": 400,
"body": "{\n \"ok\": false,\n \"error\": \"missing fields\"\n}"
}
]
},
{
"name": "Get Chain Tip",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/headers/tip",
"host": ["{{baseUrl}}"],
"path": ["headers", "tip"]
},
"description": "Returns the current chain tip: latest slot, miner who produced it, tip age in seconds, and signature prefix."
},
"response": [
{
"name": "200 - Chain tip",
"status": "OK",
"code": 200,
"body": "{\n \"slot\": 25200,\n \"miner\": \"g4-powerbook-01\",\n \"tip_age\": 120,\n \"signature_prefix\": \"a1b2c3d4e5f6a7b8c9d0\"\n}"
}
]
}
]
},
{
"name": "Wallet & Balance",
"description": "Balance queries, transfer history, signed transfers, and the 2-phase commit pending ledger.",
"item": [
{
"name": "Get Balance by Miner PK",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/balance/{{minerPk}}",
"host": ["{{baseUrl}}"],
"path": ["balance", "{{minerPk}}"]
},
"description": "Get miner balance. Checks both miner_pk and miner_id columns for backwards compatibility. Returns balance in RTC and micro-units (i64)."
},
"response": [
{
"name": "200 - Balance",
"status": "OK",
"code": 200,
"body": "{\n \"miner_pk\": \"RTCabcdef1234567890abcdef1234567890abcdef12\",\n \"balance_rtc\": 42.5,\n \"amount_i64\": 42500000\n}"
}
]
},
{
"name": "Get Wallet Balance",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/wallet/balance?miner_id={{minerId}}",
"host": ["{{baseUrl}}"],
"path": ["wallet", "balance"],
"query": [
{
"key": "miner_id",
"value": "{{minerId}}"
}
]
},
"description": "Get balance for a specific miner by miner_id or address query parameter."
},
"response": [
{
"name": "200 - Wallet balance",
"status": "OK",
"code": 200,
"body": "{\n \"miner_id\": \"g4-powerbook-01\",\n \"amount_i64\": 42500000,\n \"amount_rtc\": 42.5\n}"
}
]
},
{
"name": "Get Wallet History",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/wallet/history?miner_id={{minerId}}&limit=50",
"host": ["{{baseUrl}}"],
"path": ["wallet", "history"],
"query": [
{
"key": "miner_id",
"value": "{{minerId}}"
},
{
"key": "limit",
"value": "50"
}
]
},
"description": "Get public transfer history for a wallet. Returns sent/received transfers with status, amounts, memos, and confirmation timestamps."
},
"response": [
{
"name": "200 - Transfer history",
"status": "OK",
"code": 200,
"body": "[\n {\n \"id\": 1,\n \"tx_id\": \"abc123def456\",\n \"tx_hash\": \"abc123def456\",\n \"from_addr\": \"RTCsender...\",\n \"to_addr\": \"RTCreceiver...\",\n \"amount\": 10.0,\n \"amount_i64\": 10000000,\n \"amount_rtc\": 10.0,\n \"timestamp\": 1710000000,\n \"created_at\": 1710000000,\n \"confirmed_at\": 1710086400,\n \"confirms_at\": 1710086400,\n \"status\": \"confirmed\",\n \"direction\": \"sent\",\n \"counterparty\": \"RTCreceiver...\",\n \"reason\": \"signed_transfer:payment for services\",\n \"memo\": \"payment for services\",\n \"confirmations\": 1\n }\n]"
}
]
},
{
"name": "Signed Transfer (Ed25519)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"from_address\": \"RTCabcdef1234567890abcdef1234567890abcdef12\",\n \"to_address\": \"RTCrecipient1234567890abcdef1234567890abcd12\",\n \"amount_rtc\": 10.0,\n \"nonce\": \"1710000000\",\n \"signature\": \"<128_hex_ed25519_signature>\",\n \"public_key\": \"<64_hex_ed25519_public_key>\",\n \"memo\": \"Payment for bounty work\",\n \"chain_id\": \"rustchain-mainnet-candidate\"\n}"
},
"url": {
"raw": "{{baseUrl}}/wallet/transfer/signed",
"host": ["{{baseUrl}}"],
"path": ["wallet", "transfer", "signed"]
},
"description": "Transfer RTC with Ed25519 signature verification. Supports both regular RTC addresses and bcn_ beacon addresses. Uses 2-phase commit: transfer enters pending state and confirms after 24 hours. Includes replay protection via nonce tracking."
},
"response": [
{
"name": "200 - Transfer pending",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"verified\": true,\n \"signature_type\": \"Ed25519\",\n \"replay_protected\": true,\n \"phase\": \"pending\",\n \"pending_id\": 42,\n \"tx_hash\": \"abc123def456789012345678\",\n \"from_address\": \"RTCabcdef...\",\n \"to_address\": \"RTCrecipient...\",\n \"amount_rtc\": 10.0,\n \"chain_id\": \"rustchain-mainnet-candidate\",\n \"confirms_at\": 1710086400,\n \"confirms_in_hours\": 24.0,\n \"message\": \"Transfer pending. Will confirm in 24 hours unless voided.\"\n}"
}
]
},
{
"name": "Admin Transfer (2-Phase Commit)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Admin-Key",
"value": "{{adminKey}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"from_miner\": \"founder_community\",\n \"to_miner\": \"{{minerId}}\",\n \"amount_rtc\": 5.0,\n \"reason\": \"bounty_payout\"\n}"
},
"url": {
"raw": "{{baseUrl}}/wallet/transfer",
"host": ["{{baseUrl}}"],
"path": ["wallet", "transfer"]
},
"description": "Admin-initiated transfer with 2-phase commit. Transfer enters pending state and confirms after 24 hours unless voided. Requires admin key."
},
"response": [
{
"name": "200 - Transfer pending",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"phase\": \"pending\",\n \"pending_id\": 42,\n \"tx_hash\": \"abc123def456789012345678\",\n \"from_miner\": \"founder_community\",\n \"to_miner\": \"g4-powerbook-01\",\n \"amount_rtc\": 5.0,\n \"confirms_at\": 1710086400,\n \"confirms_in_hours\": 24.0,\n \"message\": \"Transfer pending. Will confirm in 24 hours unless voided.\"\n}"
}
]
},
{
"name": "Resolve Beacon Wallet",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/wallet/resolve?address=bcn_agent123",
"host": ["{{baseUrl}}"],
"path": ["wallet", "resolve"],
"query": [
{
"key": "address",
"value": "bcn_agent123"
}
]
},
"description": "Resolve a bcn_ beacon ID to its RTC wallet address and Ed25519 public key from the Beacon Atlas."
},
"response": [
{
"name": "200 - Resolved",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"beacon_id\": \"bcn_agent123\",\n \"pubkey_hex\": \"abcdef1234567890...\",\n \"rtc_address\": \"RTCabcdef...\",\n \"name\": \"My Agent\",\n \"status\": \"active\"\n}"
}
]
},
{
"name": "Get All Balances (Admin)",
"request": {
"method": "GET",
"header": [
{
"key": "X-API-Key",
"value": "{{adminKey}}"
}
],
"url": {
"raw": "{{baseUrl}}/api/balances?limit=100",
"host": ["{{baseUrl}}"],
"path": ["api", "balances"],
"query": [
{
"key": "limit",
"value": "100"
}
]
},
"description": "Return all wallet balances sorted by amount descending. Requires admin key. Supports limit parameter (max 5000)."
},
"response": [
{
"name": "200 - All balances",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"count\": 2,\n \"balances\": [\n {\"miner_id\": \"founder_community\", \"amount_i64\": 96673000000, \"amount_rtc\": 96673.0},\n {\"miner_id\": \"g4-powerbook-01\", \"amount_i64\": 42500000, \"amount_rtc\": 42.5}\n ]\n}"
}
]
},
{
"name": "Get All Wallet Balances (Admin)",
"request": {
"method": "GET",
"header": [
{
"key": "X-Admin-Key",
"value": "{{adminKey}}"
}
],
"url": {
"raw": "{{baseUrl}}/wallet/balances/all",
"host": ["{{baseUrl}}"],
"path": ["wallet", "balances", "all"]
},
"description": "Export all miner balances with grand total. Requires admin key."
},
"response": [
{
"name": "200 - All balances",
"status": "OK",
"code": 200,
"body": "{\n \"balances\": [\n {\"miner_id\": \"founder_community\", \"amount_i64\": 96673000000, \"amount_rtc\": 96673.0}\n ],\n \"total_i64\": 96673000000,\n \"total_rtc\": 96673.0\n}"
}
]
},
{
"name": "Get Transaction Ledger (Admin)",
"request": {
"method": "GET",
"header": [
{
"key": "X-Admin-Key",
"value": "{{adminKey}}"
}
],
"url": {
"raw": "{{baseUrl}}/wallet/ledger?miner_id={{minerId}}",
"host": ["{{baseUrl}}"],
"path": ["wallet", "ledger"],
"query": [
{
"key": "miner_id",
"value": "{{minerId}}",
"description": "Optional - omit to get all ledger entries"
}
]
},
"description": "Get immutable transaction ledger entries (optionally filtered by miner). Returns last 200 entries. Requires admin key."
},
"response": [
{
"name": "200 - Ledger entries",
"status": "OK",
"code": 200,
"body": "{\n \"items\": [\n {\n \"ts\": 1710000000,\n \"epoch\": 42,\n \"miner_id\": \"g4-powerbook-01\",\n \"delta_i64\": 250000,\n \"delta_rtc\": 0.25,\n \"reason\": \"epoch_reward\"\n }\n ]\n}"
}
]
}
]
},
{
"name": "Pending Ledger (2-Phase Commit)",
"description": "Manage the 2-phase commit pending ledger for transfers. Pending transfers confirm after 24 hours unless voided.",
"item": [
{
"name": "List Pending Transfers (Admin)",
"request": {
"method": "GET",
"header": [
{
"key": "X-Admin-Key",
"value": "{{adminKey}}"
}
],
"url": {
"raw": "{{baseUrl}}/pending/list?status=pending&limit=100",
"host": ["{{baseUrl}}"],
"path": ["pending", "list"],
"query": [
{
"key": "status",
"value": "pending",
"description": "Filter by status: pending, confirmed, voided, or 'all'"
},
{
"key": "limit",
"value": "100"
}
]
},
"description": "List pending (or all) transfers in the 2-phase commit ledger. Requires admin key."
},
"response": [
{
"name": "200 - Pending list",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"count\": 1,\n \"pending\": [\n {\n \"id\": 1,\n \"ts\": 1710000000,\n \"from_miner\": \"founder_community\",\n \"to_miner\": \"g4-powerbook-01\",\n \"amount_rtc\": 5.0,\n \"reason\": \"bounty_payout\",\n \"status\": \"pending\",\n \"confirms_at\": 1710086400,\n \"voided_by\": null,\n \"voided_reason\": null,\n \"tx_hash\": \"abc123def456789012345678\"\n }\n ]\n}"
}
]
},
{
"name": "Void Pending Transfer (Admin)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Admin-Key",
"value": "{{adminKey}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"pending_id\": 1,\n \"reason\": \"suspicious_transfer\",\n \"voided_by\": \"admin\"\n}"
},
"url": {
"raw": "{{baseUrl}}/pending/void",
"host": ["{{baseUrl}}"],
"path": ["pending", "void"]
},
"description": "Void a pending transfer before it confirms. Can identify the transfer by pending_id or tx_hash. Only pending-status transfers can be voided. Requires admin key."
},
"response": [
{
"name": "200 - Voided",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"voided_id\": 1,\n \"from_miner\": \"founder_community\",\n \"to_miner\": \"g4-powerbook-01\",\n \"amount_rtc\": 5.0,\n \"voided_by\": \"admin\",\n \"reason\": \"suspicious_transfer\"\n}"
}
]
},
{
"name": "Confirm Pending Transfers (Admin/Cron)",
"request": {
"method": "POST",
"header": [
{
"key": "X-Admin-Key",
"value": "{{adminKey}}"
}
],
"url": {
"raw": "{{baseUrl}}/pending/confirm",
"host": ["{{baseUrl}}"],
"path": ["pending", "confirm"]
},
"description": "Worker endpoint: confirms all pending transfers whose 24-hour delay has elapsed. Checks sender balance at confirmation time. Logs to immutable ledger. Requires admin key."
},
"response": [
{
"name": "200 - Confirmed",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"confirmed_count\": 3,\n \"confirmed_ids\": [1, 2, 3],\n \"errors\": null\n}"
}
]
},
{
"name": "Balance Integrity Check (Admin)",
"request": {
"method": "GET",
"header": [
{
"key": "X-API-Key",
"value": "{{adminKey}}"
}
],
"url": {
"raw": "{{baseUrl}}/pending/integrity",
"host": ["{{baseUrl}}"],
"path": ["pending", "integrity"]
},
"description": "Check balance integrity: verifies that the sum of all ledger deltas matches the balance table for every miner. Requires admin key."
},
"response": [
{
"name": "200 - Integrity OK",
"status": "OK",
"code": 200,
"body": "{\n \"ok\": true,\n \"total_miners_checked\": 150,\n \"mismatches\": null,\n \"pending_transfers\": 2\n}"
}
]
}
]
},
{
"name": "Withdrawals",
"description": "Register withdrawal keys, request withdrawals, and check withdrawal status (RIP-0008).",
"item": [
{
"name": "Register Withdrawal Key (Admin)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-Admin-Key",
"value": "{{adminKey}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"miner_pk\": \"{{minerPk}}\",\n \"pubkey_sr25519\": \"abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890\"\n}"
},
"url": {
"raw": "{{baseUrl}}/withdraw/register",
"host": ["{{baseUrl}}"],
"path": ["withdraw", "register"]
},
"description": "Register an sr25519 public key for withdrawals. First-time registration is allowed; key rotation requires admin key. Requires admin key."
},
"response": [
{
"name": "200 - Key registered",
"status": "OK",
"code": 200,
"body": "{\n \"miner_pk\": \"RTCabcdef...\",\n \"pubkey_registered\": true,\n \"can_withdraw\": true\n}"
}
]
},
{
"name": "Request Withdrawal",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"miner_pk\": \"{{minerPk}}\",\n \"amount\": 10.0,\n \"destination\": \"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY\",\n \"signature\": \"<base64_or_hex_sr25519_signature>\",\n \"nonce\": \"unique_nonce_12345\"\n}"
},
"url": {
"raw": "{{baseUrl}}/withdraw/request",
"host": ["{{baseUrl}}"],
"path": ["withdraw", "request"]
},
"description": "Request an RTC withdrawal. Requires registered sr25519 key, sufficient balance, valid signature, and unique nonce (replay protection). Subject to daily limits. A withdrawal fee is deducted and routed to the community mining pool (RIP-301)."
},
"response": [
{
"name": "200 - Withdrawal created",
"status": "OK",
"code": 200,
"body": "{\n \"withdrawal_id\": \"WD_1710000000000000_abc123de\",\n \"status\": \"pending\",\n \"amount\": 10.0,\n \"fee\": 0.01,\n \"net_amount\": 9.99\n}"
}
]
},
{
"name": "Get Withdrawal Status",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/withdraw/status/WD_1710000000000000_abc123de",
"host": ["{{baseUrl}}"],
"path": ["withdraw", "status", "WD_1710000000000000_abc123de"]
},
"description": "Get the status of a specific withdrawal by its withdrawal_id."