-
Notifications
You must be signed in to change notification settings - Fork 1
/
blurd-rpc.html
2620 lines (2085 loc) · 114 KB
/
blurd-rpc.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<link href="style/prism.css" rel="stylesheet" />
<title>Blur Network Daemon RPC Documentation</title>
</head>
<body>
<h1 style="color:white" id="daemon-rpc-doc">Blur Network Daemon RPC Documentation</h1>
<h2 id="introduction">Introduction</h2>
<p>This is a list of the Blurd daemon RPC calls, their inputs and outputs, and examples of each.</p>
<p>Many RPC calls use the daemon's JSON RPC interface while others use their own interfaces, as demonstrated below.</p>
<p>Note: "atomic units" refer to the smallest fraction of 1 BLUR according to the Blurd implementation. <strong>1 BLUR = 1e12 atomic units.</strong></p>
<p>(Guide updated as of network height of 429,811)</p>
<h3 style="color:white" id="json-rpc-methods"><a href="#json-rpc-methods">JSON RPC Methods</a>:</h3>
<ul>
<li><a href="#get_block_count">get_block_count</a></li>
<li><a href="#on_get_block_hash">on_get_block_hash</a></li>
<li><a href="#get_block_template">get_block_template</a></li>
<li><a href="#submit_block">submit_block</a></li>
<li><a href="#get_last_block_header">get_last_block_header</a></li>
<li><a href="#get_block_header_by_hash">get_block_header_by_hash</a></li>
<li><a href="#get_block_header_by_height">get_block_header_by_height</a></li>
<li><a href="#get_block_headers_range">get_block_headers_range</a></li>
<li><a href="#get_block">get_block</a></li>
<li><a href="#get_connections">get_connections</a></li>
<li><a href="#get_info">get_info</a></li>
<li><a href="#hard_fork_info">hard_fork_info</a></li>
<li><a href="#set_bans">set_bans</a></li>
<li><a href="#get_bans">get_bans</a></li>
<li><a href="#flush_txpool">flush_txpool</a></li>
<li><a href="#get_output_histogram">get_output_histogram</a></li>
<li><a href="#get_version">get_version</a></li>
<li><a href="#get_coinbase_tx_sum">get_coinbase_tx_sum</a></li>
<li><a href="#get_fee_estimate">get_fee_estimate</a></li>
<li><a href="#get_alternate_chains">get_alternate_chains</a></li>
<li><a href="#relay_tx">relay_tx</a></li>
<li><a href="#sync_info">sync_info</a></li>
<li><a href="#get_txpool_backlog">get_txpool_backlog</a></li>
<li><a href="#get_output_distribution">get_output_distribution</a></li>
</ul>
<h3 style="color:white" id="other-rpc-methods"><a href="#other-daemon-rpc-calls">Other RPC Methods</a>:</h3>
<ul>
<li><a href="#get_height">/get_height</a></li>
<li><a href="#get_blocksbin">/get_blocks.bin</a></li>
<li><a href="#get_blocks_by_heightbin">/get_blocks_by_height.bin</a></li>
<li><a href="#get_hashesbin">/get_hashes.bin</a></li>
<li><a href="#get_o_indexesbin">/get_o_indexes.bin</a></li>
<li><a href="#get_outsbin">/get_outs.bin</a></li>
<li><a href="#get_transactions">/get_transactions</a></li>
<li><a href="#get_alt_blocks_hashes">/get_alt_blocks_hashes</a></li>
<li><a href="#is_key_image_spent">/is_key_image_spent</a></li>
<li><a href="#send_raw_transaction">/send_raw_transaction</a></li>
<li><a href="#start_mining">/start_mining</a></li>
<li><a href="#stop_mining">/stop_mining</a></li>
<li><a href="#mining_status">/mining_status</a></li>
<li><a href="#save_bc">/save_bc</a></li>
<li><a href="#get_peer_list">/get_peer_list</a></li>
<li><a href="#set_log_hash_rate">/set_log_hash_rate</a></li>
<li><a href="#set_log_level">/set_log_level</a></li>
<li><a href="#set_log_categories">/set_log_categories</a></li>
<li><a href="#get_transaction_pool">/get_transaction_pool</a></li>
<li><a href="#get_transaction_pool_hashesbin">/get_transaction_pool_hashes.bin</a></li>
<li><a href="#get_transaction_pool_stats">/get_transaction_pool_stats</a></li>
<li><a href="#stop_daemon">/stop_daemon</a></li>
<li><a href="#get_info-not-json">/get_info (not JSON)</a></li>
<li><a href="#get_limit">/get_limit</a></li>
<li><a href="#set_limit">/set_limit</a></li>
<li><a href="#out_peers">/out_peers</a></li>
<li><a href="#in_peers">/in_peers</a></li>
<li><a href="#get_outs">/get_outs</a></li>
</ul>
<hr />
<h2 id="json-rpc-methods-1">JSON RPC Methods</h2>
<p>The majority of Blurd RPC calls use the daemon's <code class="language-">json_rpc</code> interface to request various bits of information. These methods all follow a similar structure, for example:</p>
<pre><code class="language-json">IP=127.0.0.1
PORT=52542
METHOD='get_block_header_by_height'
ALIAS='getblockheaderbyheight'
PARAMS='{"height":429811}'
curl \
-X POST http://$IP:$PORT/json_rpc \
-d '{"method":"'$METHOD'","params":'$PARAMS'}'
</code></pre>
<p>Some methods include parameters, while others do not. Examples of each JSON RPC method follow.</p>
<h3 id="get_block_count"><strong>get_block_count</strong></h3>
<p>Look up how many blocks are in the longest chain known to the node.</p>
<p>Alias: <em>getblockcount</em>.</p>
<p>Inputs: <em>None</em>.</p>
<p>Outputs:</p>
<ul>
<li><em>count</em> - unsigned int; Number of blocks in longest chain seen by the node.</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
</ul>
<p>Example:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_block_count"}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"count": 4,
"status": "OK"
}
}
</code></pre>
<h3 id="on_get_block_hash"><strong>on_get_block_hash</strong></h3>
<p>Look up a block's hash by its height.</p>
<p>Alias: <em>on_getblockhash</em>.</p>
<p>Inputs:</p>
<ul>
<li>block height (int array of length 1)</li>
</ul>
<p>Outputs:</p>
<ul>
<li>block hash (string)</li>
</ul>
<p>Example:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"on_get_block_hash","params":[420000]}'
{
"id": "0",
"jsonrpc": "2.0",
"result": "61126b109f73f86d81cdf814ce3ebfebfa455409dd6835f1503885fcd77ccd86"
}
</code></pre>
<h3 id="get_block_template"><strong>get_block_template</strong></h3>
<p>Get a block template on which mining a new block.</p>
<p>Alias: <em>getblocktemplate</em>.</p>
<p>Inputs:</p>
<ul>
<li><em>wallet_address</em> - string; Address of wallet to receive coinbase transactions if block is successfully mined.</li>
<li><em>reserve_size</em> - unsigned int; Reserve size.</li>
</ul>
<p>Outputs:</p>
<ul>
<li><em>blocktemplate_blob</em> - string; Blob on which to try to mine a new block.</li>
<li><em>blockhashing_blob</em> - string; Blob on which to try to find a valid nonce.</li>
<li><em>difficulty</em> - unsigned int; Difficulty of next block.</li>
<li><em>expected_reward</em> - unsigned int; Coinbase reward expected to be received if block is successfully mined.</li>
<li><em>height</em> - unsigned int; Height on which to mine.</li>
<li><em>prev_hash</em> - string; Hash of the most recent block on which to mine the next block.</li>
<li><em>reserved_offset</em> - unsigned int; Reserved offset.</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
<li><em>untrusted</em> - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (<code class="language-">true</code></pre>), or when the daemon is fully synced (<code class="language-">false</code>).</li>
</ul>
<p>Example:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_block_template","params":{"wallet_address":"bL2yv6tv5hGcS1L5WvPgu7VkVg525icyRRd2sCKNY5ZQACRHnoXNG6EJqTpatQZ9HAaDegZUYCKUPhkwGSfeWSxA2DBUtKpQh","reserve_size":60}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"blockhashing_blob": "0a0ac6a1a3e605e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f000000003b99f6e1bf4502a3a1c1e77d89a28b90d1ce264558ba8afa58e9cad68063347601",
"blocktemplate_blob": "0a0ac6a1a3e605e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f00000000018d9e1a01fff49d1a01c3baa3cfa3a301022c82c2a7b49551ba37754e2c7aa19ea6a0d896fbec6e044d3bb6e33ea3705a525f01cd059a08448965b9c41417543c734d07e895caae79d948474d372d0055af86ce023c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": 115497497,
"expected_reward": 5610198850883,
"height": 429812,
"prev_hash": "e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f",
"reserved_offset": 129,
"status": "OK",
"untrusted": false
}
}
</code></pre>
<h3 id="submit_block"><strong>submit_block</strong></h3>
<p>Submit a mined block to the network.</p>
<p>Alias: <em>submitblock</em>.</p>
<p>Inputs:</p>
<ul>
<li>Block blob data - array of strings; list of block blobs which have been mined. See <a href="#get_block_template">get_block_template</a> to get a blob on which to mine.</li>
</ul>
<p>Outputs:</p>
<ul>
<li><em>status</em> - string; Block submit status.</li>
</ul>
<p>In this example, a block blob which has not been mined is submitted:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"submit_block","params":["0707e6bdfedc053771512f1bc27c62731ae9e8f2443db64ce742f4e57f5cf8d393de28551e441a0000000002fb830a01ffbf830a018cfe88bee283060274c0aae2ef5730e680308d9c00b6da59187ad0352efe3c71d36eeeb28782f29f2501bd56b952c3ddc3e350c2631d3a5086cac172c56893831228b17de296ff4669de020200000000"]'
{
"id": "0",
"jsonrpc": "2.0",
"error": {
"code": -7,
"message": "Block not accepted"
}
}
</code></pre>
<h3 id="get_last_block_header"><strong>get_last_block_header</strong></h3>
<p>Block header information for the most recent block is easily retrieved with this method. No inputs are needed.</p>
<p>Alias: <em>getlastblockheader</em>.</p>
<p>Inputs: <em>None</em>.</p>
<p>Outputs:</p>
<ul>
<li><em>block_header</em> - A structure containing block header information.
<ul>
<li><em>block_size</em> - unsigned int; The block size in bytes.</li>
<li><em>depth</em> - unsigned int; The number of blocks succeeding this block on the blockchain. A larger number means an older block.</li>
<li><em>difficulty</em> - unsigned int; The strength of the Blur network based on mining power.</li>
<li><em>hash</em> - string; The hash of this block.</li>
<li><em>height</em> - unsigned int; The number of blocks preceding this block on the blockchain.</li>
<li><em>major_version</em> - unsigned int; The major version of the Blur protocol at this block height.</li>
<li><em>minor_version</em> - unsigned int; The minor version of the Blur protocol at this block height.</li>
<li><em>nonce</em> - unsigned int; a cryptographic random one-time number used in mining a Blur block.</li>
<li><em>num_txes</em> - unsigned int; Number of transactions in the block, not counting the coinbase tx.</li>
<li><em>orphan_status</em> - boolean; Usually <code class="language-">false</code>. If <code class="language-">true</code>, this block is not part of the longest chain.</li>
<li><em>pow_hash</em> - string; The proof-of-work hash of the block immediately preceding this block in the chain (this should always have leading zeroes in the MSBs)</li>
<li><em>prev_hash</em> - string; The hash of the block immediately preceding this block in the chain.</li>
<li><em>reward</em> - unsigned int; The amount of new BLUR (in atomic units) generated in this block and rewarded to the miner. Note: 1 BLUR = 1e12 atomic units.</li>
<li><em>timestamp</em> - unsigned int; The unix time at which the block was recorded into the blockchain.</li>
</ul>
</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
<li><em>untrusted</em> - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (<code class="language-">true</code>), or when the daemon is fully synced (<code class="language-">false</code>).</li>
</ul>
<p>In this example, the most recent block (429811 at the time) is returned:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_last_block_header"}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"block_header": {
"block_size": 85,
"depth": 0,
"difficulty": 115525980,
"hash": "e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f",
"height": 429811,
"major_version": 10,
"minor_version": 10,
"nonce": 4228969614,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "c9fe516b38bfcf3fec9e5b77ee638de3f9700249a4cf1b114a120f2d16000000",
"prev_hash": "152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c",
"reward": 5610204201190,
"timestamp": 1556664436
},
"status": "OK",
"untrusted": false
}
}
</code></pre>
<h3 id="get_block_header_by_hash"><strong>get_block_header_by_hash</strong></h3>
<p>Block header information can be retrieved using either a block's hash or height. This method includes a block's hash as an input parameter to retrieve basic information about the block.</p>
<p>Alias: <em>getblockheaderbyhash</em>.</p>
<p>Inputs:</p>
<ul>
<li><em>hash</em> - string; The block's sha256 hash.</li>
</ul>
<p>Outputs:</p>
<ul>
<li><em>block_header</em> - A structure containing block header information. See <a href="#get_last_block_header">get_last_block_header</a>.</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
<li><em>untrusted</em> - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (<code class="language-">true</code>), or when the daemon is fully synced (<code class="language-">false</code>).</li>
</ul>
<p>In this example, block 429811 is looked up by its hash:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_block_header_by_hash","params":{"hash":"e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f"}}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"block_header": {
"block_size": 85,
"depth": 7,
"difficulty": 115525980,
"hash": "e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f",
"height": 429811,
"major_version": 10,
"minor_version": 10,
"nonce": 4228969614,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "c9fe516b38bfcf3fec9e5b77ee638de3f9700249a4cf1b114a120f2d16000000",
"prev_hash": "152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c",
"reward": 5610204201190,
"timestamp": 1556664436
},
"status": "OK",
"untrusted": false
}
}
</code></pre>
<h3 id="get_block_header_by_height"><strong>get_block_header_by_height</strong></h3>
<p>Similar to <a href="#get_block_header_by_hash">get_block_header_by_hash</a> above, this method includes a block's height as an input parameter to retrieve basic information about the block.</p>
<p>Alias: <em>getblockheaderbyheight</em>.</p>
<p>Inputs:</p>
<ul>
<li><em>height</em> - unsigned int; The block's height.</li>
</ul>
<p>Outputs:</p>
<ul>
<li><em>block_header</em> - A structure containing block header information. See <a href="#get_last_block_header">get_last_block_header</a>.</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
<li><em>untrusted</em> - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (<code class="language-">true</code>), or when the daemon is fully synced (<code class="language-">false</code>).</li>
</ul>
<p>In this example, block 912345 is looked up by its height (notice that the returned information is the same as in the previous example):</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_block_header_by_height","params":{"height":429811}}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"block_header": {
"block_size": 85,
"depth": 3,
"difficulty": 115525980,
"hash": "e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f",
"height": 429811,
"major_version": 10,
"minor_version": 10,
"nonce": 4228969614,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "c9fe516b38bfcf3fec9e5b77ee638de3f9700249a4cf1b114a120f2d16000000",
"prev_hash": "152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c",
"reward": 5610204201190,
"timestamp": 1556664436
},
"status": "OK",
"untrusted": false
}
}
</code></pre>
<h3 id="get_block_headers_range"><strong>get_block_headers_range</strong></h3>
<p>Similar to <a href="#get_block_header_by_height">get_block_header_by_height</a> above, but for a range of blocks. This method includes a starting block height and an ending block height as parameters to retrieve basic information about the range of blocks.</p>
<p>Alias: <em>getblockheadersrange</em>.</p>
<p>Inputs:</p>
<ul>
<li><em>start_height</em> - unsigned int; The starting block's height.</li>
<li><em>end_height</em> - unsigned int; The ending block's height.</li>
</ul>
<p>Outputs:</p>
<ul>
<li><em>headers</em> - array of<code class="language-">block_header</code> (a structure containing block header information. See <a href="#get_last_block_header">get_last_block_header</a>).</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
<li><em>untrusted</em> - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (<code class="language-">true</code>), or when the daemon is fully synced (<code class="language-">false</code>).</li>
</ul>
<p>In this example, blocks range from height 429811 to 429814 is looked up (notice that the returned informations are ascending order and that it is at the April 2018 network upgrade time):</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_block_headers_range","params":{"start_height":429811,"end_height":429814}}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"headers": [
{
"block_size": 85,
"depth": 26,
"difficulty": 115525980,
"hash": "e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f",
"height": 429811,
"major_version": 10,
"minor_version": 10,
"nonce": 4228969614,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "c9fe516b38bfcf3fec9e5b77ee638de3f9700249a4cf1b114a120f2d16000000",
"prev_hash": "152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c",
"reward": 5610204201190,
"timestamp": 1556664436
},
{
"block_size": 85,
"depth": 25,
"difficulty": 115497497,
"hash": "29293c6a76a57cf4a4368ea52e67121d92b70a34deb0da40b7c055e7389a1371",
"height": 429812,
"major_version": 10,
"minor_version": 10,
"nonce": 952654155,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "c6982fd83a2abd3f8b479d60987b770246305c7ac51130cd10ac526f23000000",
"prev_hash": "e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f",
"reward": 5610198850883,
"timestamp": 1556664691
},
{
"block_size": 85,
"depth": 24,
"difficulty": 103344002,
"hash": "66a34433d2168e885df2a2ff890e1e49e3156357d3dcc4843e1f502a4a6428ff",
"height": 429813,
"major_version": 10,
"minor_version": 10,
"nonce": 53516223,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "c0cf57cd367a65ea6671061d7be96caff7b618cb5eb6f09723441cb625000000",
"prev_hash": "29293c6a76a57cf4a4368ea52e67121d92b70a34deb0da40b7c055e7389a1371",
"reward": 5610193500580,
"timestamp": 1556664700
},
{
"block_size": 85,
"depth": 23,
"difficulty": 106253270,
"hash": "73f9cec7fb41f0abd15c5548b34640da92ae9f2504fd86546fd660c8771e99f2",
"height": 429814,
"major_version": 10,
"minor_version": 10,
"nonce": 1196796717,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "d576cbb87dfef79a9365181b962ed552677ab0c8770ef288612635d90a000000",
"prev_hash": "66a34433d2168e885df2a2ff890e1e49e3156357d3dcc4843e1f502a4a6428ff",
"reward": 5610188150283,
"timestamp": 1556664945
}
],
"status": "OK",
"untrusted": false
}
}
</code></pre>
<h3 id="get_block"><strong>get_block</strong></h3>
<p>Full block information can be retrieved by either block height or hash, like with the above block header calls. For full block information, both lookups use the same method, but with different input parameters.</p>
<p>Alias: <em>getblock</em>.</p>
<p>Inputs (pick one of the following):</p>
<ul>
<li><em>height</em> - unsigned int; The block's height.</li>
<li><em>hash</em> - string; The block's hash.</li>
</ul>
<p>Outputs:</p>
<ul>
<li><em>blob</em> - string; Hexadecimal blob of block information.</li>
<li><em>block_header</em> - A structure containing block header information. See <a href="#get_last_block_header">get_last_block_header</a>.</li>
<li><em>json</em> - json string; JSON formatted block details:
<ul>
<li><em>major_version</em> - Same as in block header.</li>
<li><em>minor_version</em> - Same as in block header.</li>
<li><em>timestamp</em> - Same as in block header.</li>
<li><em>prev_id</em> - Same as<code class="language-">prev_hash</code> in block header.</li>
<li><em>nonce</em> - Same as in block header.</li>
<li><em>miner_tx</em> - Miner transaction information
<ul>
<li><em>version</em> - Transaction version number.</li>
<li><em>unlock_time</em> - The block height when the coinbase transaction becomes spendable.</li>
<li><em>vin</em> - List of transaction inputs:
<ul>
<li><em>gen</em> - Miner txs are coinbase txs, or "gen".
<ul>
<li><em>height</em> - This block height, a.k.a. when the coinbase is generated.</li>
</ul>
</li>
</ul>
</li>
<li><em>vout</em> - List of transaction outputs. Each output contains:
<ul>
<li><em>amount</em> - The amount of the output, in atomic units (1e-12 or 0.000000000001 BLUR.</li>
<li><em>target</em> -
<ul>
<li><em>key</em> -</li>
</ul>
</li>
</ul>
</li>
<li><em>extra</em> - Usually called the "transaction ID" but can be used to include any random 32 byte/64 character hex string.</li>
<li><em>signatures</em> - Contain signatures of tx signers. Coinbased txs do not have signatures.</li>
</ul>
</li>
<li><em>tx_hashes</em> - List of hashes of non-coinbase transactions in the block. If there are no other transactions, this will be an empty list.</li>
</ul>
</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
<li><em>untrusted</em> - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (<code class="language-">true</code>), or when the daemon is fully synced (<code class="language-">false</code>).</li>
</ul>
<p><strong>Look up by height:</strong></p>
<p>In the following example, block 429811 is looked up by its height. Note that block 912345 does not have any non-coinbase transactions. (See the next example for a block with extra transactions):</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_block","params":{"height":429811}}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"blob": "0a0af4a0a3e605152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c8ef410fc018c9e1a01fff39d1a01e681ead1a3a301026908be5bb4427b716e50cf2cc179dafbabea4ac7b89dbd3cbd631ce873e563ef2101c8be6c6c0c010f4fa7d981fe5080408dce775d38ff51ad47bb0ad64e6c9c9a910000",
"block_header": {
"block_size": 85,
"depth": 26,
"difficulty": 115525980,
"hash": "e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f",
"height": 429811,
"major_version": 10,
"minor_version": 10,
"nonce": 4228969614,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "c9fe516b38bfcf3fec9e5b77ee638de3f9700249a4cf1b114a120f2d16000000",
"prev_hash": "152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c",
"reward": 5610204201190,
"timestamp": 1556664436
},
"json": "{\n \"major_version\": 10, \n \"minor_version\": 10, \n \"timestamp\": 1556664436, \n \"prev_id\": \"152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c\", \n \"nonce\": 4228969614, \n \"miner_tx\": {\n \"version\": 1, \n \"unlock_time\": 429836, \n \"vin\": [ {\n \"gen\": {\n \"height\": 429811\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 5610204201190, \n \"target\": {\n \"key\": \"6908be5bb4427b716e50cf2cc179dafbabea4ac7b89dbd3cbd631ce873e563ef\"\n }\n }\n ], \n \"extra\": [ 1, 200, 190, 108, 108, 12, 1, 15, 79, 167, 217, 129, 254, 80, 128, 64, 141, 206, 119, 93, 56, 255, 81, 173, 71, 187, 10, 214, 78, 108, 156, 154, 145\n ], \n \"rct_signatures\": {\n \"type\": 0\n }\n }, \n \"tx_hashes\": [ ]\n}",
"miner_tx_hash": "59e4508bc9efb495e6d091023bffefc8e9177a5aa0209aa3c13a711e09885c42",
"status": "OK",
"untrusted": false
}
}
</code></pre>
<p><strong>Look up by hash:</strong></p>
<p>In the following example, block 429811 is looked up by its hash. Note that block 429811 has 1 non-coinbase transaction:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_block","params":{"hash":"e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f"}}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"blob": "0a0af4a0a3e605152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c8ef410fc018c9e1a01fff39d1a01e681ead1a3a301026908be5bb4427b716e50cf2cc179dafbabea4ac7b89dbd3cbd631ce873e563ef2101c8be6c6c0c010f4fa7d981fe5080408dce775d38ff51ad47bb0ad64e6c9c9a910000",
"block_header": {
"block_size": 85,
"depth": 26,
"difficulty": 115525980,
"hash": "e293bebabcda8fa5f9bba5da574b598ba617abbd51a6c6f6b07f7089b846248f",
"height": 429811,
"major_version": 10,
"minor_version": 10,
"nonce": 4228969614,
"num_txes": 0,
"orphan_status": false,
"pow_hash": "c9fe516b38bfcf3fec9e5b77ee638de3f9700249a4cf1b114a120f2d16000000",
"prev_hash": "152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c",
"reward": 5610204201190,
"timestamp": 1556664436
},
"json": "{\n \"major_version\": 10, \n \"minor_version\": 10, \n \"timestamp\": 1556664436, \n \"prev_id\": \"152d88fcd751c4bb0b0c87c0dbf7db4cb95cde2426b407fa7dcdc476c578822c\", \n \"nonce\": 4228969614, \n \"miner_tx\": {\n \"version\": 1, \n \"unlock_time\": 429836, \n \"vin\": [ {\n \"gen\": {\n \"height\": 429811\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 5610204201190, \n \"target\": {\n \"key\": \"6908be5bb4427b716e50cf2cc179dafbabea4ac7b89dbd3cbd631ce873e563ef\"\n }\n }\n ], \n \"extra\": [ 1, 200, 190, 108, 108, 12, 1, 15, 79, 167, 217, 129, 254, 80, 128, 64, 141, 206, 119, 93, 56, 255, 81, 173, 71, 187, 10, 214, 78, 108, 156, 154, 145\n ], \n \"rct_signatures\": {\n \"type\": 0\n }\n }, \n \"tx_hashes\": [ ]\n}",
"miner_tx_hash": "59e4508bc9efb495e6d091023bffefc8e9177a5aa0209aa3c13a711e09885c42",
"status": "OK",
"untrusted": false
}
}
</code></pre>
<h3 id="get_connections"><strong>get_connections</strong></h3>
<p>Retrieve information about incoming and outgoing connections to your node.</p>
<p>Alias: <em>None</em>.</p>
<p>Inputs: <em>None</em>.</p>
<p>Outputs:</p>
<ul>
<li><em>connections</em> - List of all connections and their info:
<ul>
<li><em>address</em> - string; The peer's address, actually IPv4 & port</li>
<li><em>avg_download</em> - unsigned int; Average bytes of data downloaded by node.</li>
<li><em>avg_upload</em> - unsigned int; Average bytes of data uploaded by node.</li>
<li><em>connection_id</em> - string; The connection ID</li>
<li><em>current_download</em> - unsigned int; Current bytes downloaded by node.</li>
<li><em>current_upload</em> - unsigned int; Current bytes uploaded by node.</li>
<li><em>height</em>- unsigned int; The peer height</li>
<li><em>host</em> - string; The peer host</li>
<li><em>incoming</em> - boolean; Is the node getting information from your node?</li>
<li><em>ip</em> - string; The node's IP address.</li>
<li><em>live_time</em> - unsigned int</li>
<li><em>local_ip</em> - boolean</li>
<li><em>localhost</em> - boolean</li>
<li><em>peer_id</em> - string; The node's ID on the network.</li>
<li><em>port</em> - string; The port that the node is using to connect to the network.</li>
<li><em>recv_count</em> - unsigned int</li>
<li><em>recv_idle_time</em> - unsigned int</li>
<li><em>send_count</em> - unsigned int</li>
<li><em>send_idle_time</em> - unsigned int</li>
<li><em>state</em> - string</li>
<li><em>support_flags</em> - unsigned int</li>
</ul>
</li>
</ul>
<p>Following is an example of<code class="language-">get_connections</code></pre> and it's return:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_connections"}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"connections": [
{
"address": "45.79.85.65:52541",
"avg_download": 4,
"avg_upload": 2,
"connection_id": "ce119c03b28d9f4c05e8c48db8790154",
"current_download": 2,
"current_upload": 1,
"height": 429840,
"host": "45.79.85.65",
"incoming": false,
"ip": "45.79.85.65",
"live_time": 5,
"local_ip": false,
"localhost": false,
"peer_id": "5b60df46b90a1f9d",
"port": "52541",
"recv_count": 24572,
"recv_idle_time": 4,
"send_count": 11344,
"send_idle_time": 4,
"state": "state_normal",
"support_flags": 1
},
{
"address": "212.71.234.44:52541",
"avg_download": 3,
"avg_upload": 0,
"connection_id": "75f4706e6d8e23bf3b71e52f02f0fe3e",
"current_download": 2,
"current_upload": 0,
"height": 429840,
"host": "212.71.234.44",
"incoming": false,
"ip": "212.71.234.44",
"live_time": 6,
"local_ip": false,
"localhost": false,
"peer_id": "297d552575a558a3",
"port": "52541",
"recv_count": 24568,
"recv_idle_time": 5,
"send_count": 1348,
"send_idle_time": 5,
"state": "state_normal",
"support_flags": 1
},
{
"address": "45.33.92.232:52541",
"avg_download": 4,
"avg_upload": 0,
"connection_id": "80967188e69616cca4071b4b4cf51567",
"current_download": 2,
"current_upload": 0,
"height": 429840,
"host": "45.33.92.232",
"incoming": false,
"ip": "45.33.92.232",
"live_time": 6,
"local_ip": false,
"localhost": false,
"peer_id": "6371e6a1c81c9e17",
"port": "52541",
"recv_count": 24998,
"recv_idle_time": 5,
"send_count": 1465,
"send_idle_time": 6,
"state": "state_normal",
"support_flags": 1
}
],
"status": "OK"
}
}
</code></pre>
<h3 id="get_info"><strong>get_info</strong></h3>
<p>Retrieve general information about the state of your node and the network.</p>
<p>Alias:</p>
<ul>
<li><em>/get_info</em></li>
<li><em>/getinfo</em></li>
</ul>
<p>See other RPC Methods <a href="#get_info-not-json">/get_info (not JSON)</a></p>
<p>Inputs: <em>None</em>.</p>
<p>Outputs:</p>
<ul>
<li><em>alt_blocks_count</em> - unsigned int; Number of alternative blocks to main chain.</li>
<li><em>block_size_limit</em> - unsigned int; Maximum allowed block size</li>
<li><em>block_size_median</em> - unsigned int; Median block size of latest 100 blocks</li>
<li><em>bootstrap_daemon_address</em> - string; <a data-tooltip="A node to which a daemon connects to give immediate usability to wallets while syncing" href="/resources/Blurpedia/bootstrap-node.html">bootstrap node</a> to give immediate usability to wallets while syncing by proxying RPC to it. (Note: the replies may be untrustworthy).</li>
<li><em>cumulative_difficulty</em> - unsigned int; Cumulative difficulty of all blocks in the blockchain.</li>
<li><em>difficulty</em> - unsigned int; Network difficulty (analogous to the strength of the network)</li>
<li><em>free_space</em> - unsigned int; Available disk space on the node.</li>
<li><em>grey_peerlist_size</em> - unsigned int; Grey Peerlist Size</li>
<li><em>height</em> - unsigned int; Current length of longest chain known to daemon.</li>
<li><em>height_without_bootstrap</em> - unsigned int; Current length of the local chain of the daemon.</li>
<li><em>incoming_connections_count</em> - unsigned int; Number of peers connected to and pulling from your node.</li>
<li><em>mainnet</em> - boolean; States if the node is on the mainnet (<code class="language-">true</code>) or not (<code class="language-">false</code>).</li>
<li><em>offline</em> - boolean; States if the node is offline (<code class="language-">true</code>) or online (<code class="language-">false</code>).</li>
<li><em>outgoing_connections_count</em> - unsigned int; Number of peers that you are connected to and getting information from.</li>
<li><em>rpc_connections_count</em> - unsigned int; Number of RPC client connected to the daemon (Including this RPC request).</li>
<li><em>stagenet</em> - boolean; States if the node is on the stagenet (<code class="language-">true</code>) or not (<code class="language-">false</code>).</li>
<li><em>start_time</em> - unsigned int; Start time of the daemon, as UNIX time.</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
<li><em>target</em> - unsigned int; Current target for next proof of work.</li>
<li><em>target_height</em> - unsigned int; The height of the next block in the chain.</li>
<li><em>testnet</em> - boolean; States if the node is on the testnet (<code class="language-">true</code>) or not (<code class="language-">false</code>).</li>
<li><em>top_block_hash</em> - string; Hash of the highest block in the chain.</li>
<li><em>tx_count</em> - unsigned int; Total number of non-coinbase transaction in the chain.</li>
<li><em>tx_pool_size</em> - unsigned int; Number of transactions that have been broadcast but not included in a block.</li>
<li><em>untrusted</em> - boolean; States if the result is obtained using the bootstrap mode, and is therefore not trusted (<code class="language-">true</code>), or when the daemon is fully synced (<code class="language-">false</code>).</li>
<li><em>version</em> - string; Displays the version of the daemon responding to the request.</li>
<li><em>was_bootstrap_ever_used</em> - boolean; States if a bootstrap node has ever been used since the daemon started.</li>
<li><em>white_peerlist_size</em> - unsigned int; White Peerlist Size</li>
</ul>
<p>Following is an example<code class="language-">get_info</code></pre> call and its return:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_info"}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"alt_blocks_count": 0,
"block_size_limit": 600000,
"block_size_median": 85,
"bootstrap_daemon_address": "",
"cumulative_difficulty": 7240811386970,
"difficulty": 84498252,
"free_space": 14855622656,
"grey_peerlist_size": 288,
"height": 429840,
"height_without_bootstrap": 429840,
"incoming_connections_count": 0,
"mainnet": true,
"offline": false,
"outgoing_connections_count": 4,
"rpc_connections_count": 1,
"stagenet": false,
"start_time": 1556666776,
"status": "OK",
"target": 60,
"target_height": 429840,
"testnet": false,
"top_block_hash": "c86b4f4bf7e500f841fb7a4fa77ccdc61e086e3d606906b8b176507f6d5b14b1",
"tx_count": 2220,
"tx_pool_size": 0,
"untrusted": false,
"version": "0.1.9.6",
"was_bootstrap_ever_used": false,
"white_peerlist_size": 112
}
}
</code></pre>
<h3 id="hard_fork_info"><strong>hard_fork_info</strong></h3>
<p>Look up information regarding hard fork voting and readiness.</p>
<p>Alias: <em>None</em>.</p>
<p>Inputs: <em>None</em>.</p>
<p>Outputs:</p>
<ul>
<li><em>earliest_height</em> - unsigned int; Block height at which hard fork would be enabled if voted in.</li>
<li><em>enabled</em> - boolean; Tells if hard fork is enforced.</li>
<li><em>state</em> - unsigned int; Current hard fork state: 0 (There is likely a hard fork), 1 (An update is needed to fork properly), or 2 (Everything looks good).</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
<li><em>threshold</em> - unsigned int; Minimum percent of votes to trigger hard fork. Default is 80.</li>
<li><em>version</em> - unsigned int; The major block version for the fork.</li>
<li><em>votes</em> - unsigned int; Number of votes towards hard fork.</li>
<li><em>voting</em> - unsigned int; Hard fork voting status.</li>
<li><em>window</em> - unsigned int; Number of blocks over which current votes are cast. Default is 10080 blocks.</li>
</ul>
<p>Example:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"hard_fork_info"}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"earliest_height": 342000,
"enabled": true,
"state": 2,
"status": "OK",
"threshold": 0,
"untrusted": false,
"version": 10,
"votes": 10080,
"voting": 10,
"window": 10080
}
}
</code></pre>
<h3 id="set_bans"><strong>set_bans</strong></h3>
<p>Ban another node by IP.</p>
<p>Alias: <em>None</em>.</p>
<p>Inputs:</p>
<ul>
<li><em>bans</em> - A list of nodes to ban:
<ul>
<li><em>host</em> - string; Host to ban (IP in A.B.C.D form - will support I2P address in the future).</li>
<li><em>ip</em> - unsigned int; IP address to ban, in Int format.</li>
<li><em>ban</em> - boolean; Set <code class="language-">true</code> to ban.</li>
<li><em>seconds</em> - unsigned int; Number of seconds to ban node.</li>
</ul>
</li>
</ul>
<p>Outputs:</p>
<ul>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
</ul>
<p>Examples:</p>
<p><strong>banning by host</strong></p>
<p>In the following example, host is banned with its IP address string-formatted as A.B.C.D:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"set_bans","params":{"bans":[{"host":"192.168.1.51","ban":true,"seconds":30}]}}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"status": "OK"
}
}
</code></pre>
<p><strong>banning by ip</strong></p>
<p>In the following example, integer-formatted IP is banned:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"set_bans","params":{"bans":[{"ip":838969536,"ban":true,"seconds":30}]}}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"status": "OK"
}
}
</code></pre>
<h3 id="get_bans"><strong>get_bans</strong></h3>
<p>Get list of banned IPs.</p>
<p>Alias: <em>None</em>.</p>
<p>Inputs: <em>None</em>.</p>
<p>Outputs:</p>
<ul>
<li><em>bans</em> - List of banned nodes:
<ul>
<li><em>host</em> - string; Banned host (IP in A.B.C.D form).</li>
<li><em>ip</em> - unsigned int; Banned IP address, in Int format.</li>
<li><em>seconds</em> - unsigned int; Local Unix time that IP is banned until.</li>
</ul>
</li>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
</ul>
<p>Example:</p>
<pre><code class="language-json">$ curl -X POST http://127.0.0.1:52542/json_rpc -d '{"method":"get_bans"}'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"bans": [{
"host": "102.168.1.51",
"ip": 855746662,
"seconds": 22
},{
"host": "192.168.1.50",
"ip": 838969536,
"seconds": 28
}],
"status": "OK"
}
}
</code></pre>
<h3 id="flush_txpool"><strong>flush_txpool</strong></h3>
<p>Flush tx ids from transaction pool</p>
<p>Alias: <em>None</em>.</p>
<p>Inputs:</p>
<ul>
<li><em>txids</em> - array of strings; Optional, list of transactions IDs to flush from pool (all tx ids flushed if empty).</li>
</ul>
<p>Outputs:</p>
<ul>
<li><em>status</em> - string; General RPC error code. "OK" means everything looks good.</li>
</ul>