1use crate::rpc::data::macros::define_request_and_response;
5
6define_request_and_response! {
14 get_block_template (json_rpc),
19
20 GET_BLOCK_TEMPLATE: &str,
22
23 Request =
25r#"{
26 "jsonrpc": "2.0",
27 "id": "0",
28 "method": "get_block_template",
29 "params": {
30 "wallet_address": "44GBHzv6ZyQdJkjqZje6KLZ3xSyN1hBSFAnLP6EAqJtCRVzMzZmeXTC2AHKDS9aEDTRKmo6a6o9r9j86pYfhCWDkKjbtcns",
31 "reserve_size": 60
32 }
33}"#;
34
35 Response =
37r#"{
38 "id": "0",
39 "jsonrpc": "2.0",
40 "result": {
41 "blockhashing_blob": "1010f4bae0b4069d648e741d85ca0e7acb4501f051b27e9b107d3cd7a3f03aa7f776089117c81a00000000e0c20372be23d356347091025c5b5e8f2abf83ab618378565cce2b703491523401",
42 "blocktemplate_blob": "1010f4bae0b4069d648e741d85ca0e7acb4501f051b27e9b107d3cd7a3f03aa7f776089117c81a0000000002c681c30101ff8a81c3010180e0a596bb11033b7eedf47baf878f3490cb20b696079c34bd017fe59b0d070e74d73ffabc4bb0e05f011decb630f3148d0163b3bd39690dde4078e4cfb69fecf020d6278a27bad10c58023c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
43 "difficulty": 283305047039,
44 "difficulty_top64": 0,
45 "expected_reward": 600000000000,
46 "height": 3195018,
47 "next_seed_hash": "",
48 "prev_hash": "9d648e741d85ca0e7acb4501f051b27e9b107d3cd7a3f03aa7f776089117c81a",
49 "reserved_offset": 131,
50 "seed_hash": "e2aa0b7b55042cd48b02e395d78fa66a29815ccc1584e38db2d1f0e8485cd44f",
51 "seed_height": 3194880,
52 "status": "OK",
53 "untrusted": false,
54 "wide_difficulty": "0x41f64bf3ff"
55 }
56}"#;
57}
58
59define_request_and_response! {
60 get_block_count (json_rpc),
61 GET_BLOCK_COUNT: &str,
62 Request =
63r#"{
64 "jsonrpc": "2.0",
65 "id": "0",
66 "method": "get_block_count"
67}"#;
68 Response =
69r#"{
70 "id": "0",
71 "jsonrpc": "2.0",
72 "result": {
73 "count": 3195019,
74 "status": "OK",
75 "untrusted": false
76 }
77}"#;
78}
79
80define_request_and_response! {
81 on_get_block_hash (json_rpc),
82 ON_GET_BLOCK_HASH: &str,
83 Request =
84r#"{
85 "jsonrpc": "2.0",
86 "id": "0",
87 "method": "on_get_block_hash",
88 "params": [912345]
89}"#;
90 Response =
91r#"{
92 "id": "0",
93 "jsonrpc": "2.0",
94 "result": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6"
95}"#;
96}
97
98define_request_and_response! {
99 submit_block (json_rpc),
100 SUBMIT_BLOCK: &str,
101 Request =
102r#"{
103 "jsonrpc": "2.0",
104 "id": "0",
105 "method": "submit_block",
106 "params": ["0707e6bdfedc053771512f1bc27c62731ae9e8f2443db64ce742f4e57f5cf8d393de28551e441a0000000002fb830a01ffbf830a018cfe88bee283060274c0aae2ef5730e680308d9c00b6da59187ad0352efe3c71d36eeeb28782f29f2501bd56b952c3ddc3e350c2631d3a5086cac172c56893831228b17de296ff4669de020200000000"]
107}"#;
108 Response =
109r#"{
110 "error": {
111 "code": -7,
112 "message": "Block not accepted"
113 },
114 "id": "0",
115 "jsonrpc": "2.0"
116}"#;
117}
118
119define_request_and_response! {
120 generateblocks (json_rpc),
121 GENERATE_BLOCKS: &str,
122 Request =
123r#"{
124 "jsonrpc": "2.0",
125 "id": "0",
126 "method": "generateblocks",
127 "params": {
128 "amount_of_blocks": 1,
129 "wallet_address": "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A",
130 "starting_nonce": 0
131 }
132}"#;
133 Response =
134r#"{
135 "id": "0",
136 "jsonrpc": "2.0",
137 "result": {
138 "blocks": ["49b712db7760e3728586f8434ee8bc8d7b3d410dac6bb6e98bf5845c83b917e4"],
139 "height": 9783,
140 "status": "OK",
141 "untrusted": false
142 }
143}"#;
144}
145
146define_request_and_response! {
147 get_last_block_header (json_rpc),
148 GET_LAST_BLOCK_HEADER: &str,
149 Request =
150r#"{
151 "jsonrpc": "2.0",
152 "id": "0",
153 "method": "get_last_block_header"
154}"#;
155 Response =
156r#"{
157 "id": "0",
158 "jsonrpc": "2.0",
159 "result": {
160 "block_header": {
161 "block_size": 200419,
162 "block_weight": 200419,
163 "cumulative_difficulty": 366125734645190820,
164 "cumulative_difficulty_top64": 0,
165 "depth": 0,
166 "difficulty": 282052561854,
167 "difficulty_top64": 0,
168 "hash": "57238217820195ac4c08637a144a885491da167899cf1d20e8e7ce0ae0a3434e",
169 "height": 3195020,
170 "long_term_weight": 200419,
171 "major_version": 16,
172 "miner_tx_hash": "7a42667237d4f79891bb407c49c712a9299fb87fce799833a7b633a3a9377dbd",
173 "minor_version": 16,
174 "nonce": 1885649739,
175 "num_txes": 37,
176 "orphan_status": false,
177 "pow_hash": "",
178 "prev_hash": "22c72248ae9c5a2863c94735d710a3525c499f70707d1c2f395169bc5c8a0da3",
179 "reward": 615702960000,
180 "timestamp": 1721245548,
181 "wide_cumulative_difficulty": "0x514bd6a74a7d0a4",
182 "wide_difficulty": "0x41aba48bbe"
183 },
184 "credits": 0,
185 "status": "OK",
186 "top_hash": "",
187 "untrusted": false
188 }
189}"#;
190}
191
192define_request_and_response! {
193 get_block_header_by_hash (json_rpc),
194 GET_BLOCK_HEADER_BY_HASH: &str,
195 Request =
196r#"{
197 "jsonrpc": "2.0",
198 "id": "0",
199 "method": "get_block_header_by_hash",
200 "params": {
201 "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6"
202 }
203}"#;
204 Response =
205r#"{
206 "id": "0",
207 "jsonrpc": "2.0",
208 "result": {
209 "block_header": {
210 "block_size": 210,
211 "block_weight": 210,
212 "cumulative_difficulty": 754734824984346,
213 "cumulative_difficulty_top64": 0,
214 "depth": 2282676,
215 "difficulty": 815625611,
216 "difficulty_top64": 0,
217 "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6",
218 "height": 912345,
219 "long_term_weight": 210,
220 "major_version": 1,
221 "miner_tx_hash": "c7da3965f25c19b8eb7dd8db48dcd4e7c885e2491db77e289f0609bf8e08ec30",
222 "minor_version": 2,
223 "nonce": 1646,
224 "num_txes": 0,
225 "orphan_status": false,
226 "pow_hash": "",
227 "prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78",
228 "reward": 7388968946286,
229 "timestamp": 1452793716,
230 "wide_cumulative_difficulty": "0x2ae6d65248f1a",
231 "wide_difficulty": "0x309d758b"
232 },
233 "credits": 0,
234 "status": "OK",
235 "top_hash": "",
236 "untrusted": false
237 }
238}"#;
239}
240
241define_request_and_response! {
242 get_block_header_by_height (json_rpc),
243 GET_BLOCK_HEADER_BY_HEIGHT: &str,
244 Request =
245r#"{
246 "jsonrpc": "2.0",
247 "id": "0",
248 "method": "get_block_header_by_height",
249 "params": {
250 "height": 912345
251 }
252}"#;
253 Response =
254r#"{
255 "id": "0",
256 "jsonrpc": "2.0",
257 "result": {
258 "block_header": {
259 "block_size": 210,
260 "block_weight": 210,
261 "cumulative_difficulty": 754734824984346,
262 "cumulative_difficulty_top64": 0,
263 "depth": 2282677,
264 "difficulty": 815625611,
265 "difficulty_top64": 0,
266 "hash": "e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6",
267 "height": 912345,
268 "long_term_weight": 210,
269 "major_version": 1,
270 "miner_tx_hash": "c7da3965f25c19b8eb7dd8db48dcd4e7c885e2491db77e289f0609bf8e08ec30",
271 "minor_version": 2,
272 "nonce": 1646,
273 "num_txes": 0,
274 "orphan_status": false,
275 "pow_hash": "",
276 "prev_hash": "b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78",
277 "reward": 7388968946286,
278 "timestamp": 1452793716,
279 "wide_cumulative_difficulty": "0x2ae6d65248f1a",
280 "wide_difficulty": "0x309d758b"
281 },
282 "credits": 0,
283 "status": "OK",
284 "top_hash": "",
285 "untrusted": false
286 }
287}"#;
288}
289
290define_request_and_response! {
291 get_block_headers_range (json_rpc),
292 GET_BLOCK_HEADERS_RANGE: &str,
293 Request =
294r#"{
295 "jsonrpc": "2.0",
296 "id": "0",
297 "method": "get_block_headers_range",
298 "params": {
299 "start_height": 1545999,
300 "end_height": 1546000
301 }
302}"#;
303 Response =
304r#"{
305 "id": "0",
306 "jsonrpc": "2.0",
307 "result": {
308 "credits": 0,
309 "headers": [{
310 "block_size": 301413,
311 "block_weight": 301413,
312 "cumulative_difficulty": 13185267971483472,
313 "cumulative_difficulty_top64": 0,
314 "depth": 1649024,
315 "difficulty": 134636057921,
316 "difficulty_top64": 0,
317 "hash": "86d1d20a40cefcf3dd410ff6967e0491613b77bf73ea8f1bf2e335cf9cf7d57a",
318 "height": 1545999,
319 "long_term_weight": 301413,
320 "major_version": 6,
321 "miner_tx_hash": "9909c6f8a5267f043c3b2b079fb4eacc49ef9c1dee1c028eeb1a259b95e6e1d9",
322 "minor_version": 6,
323 "nonce": 3246403956,
324 "num_txes": 20,
325 "orphan_status": false,
326 "pow_hash": "",
327 "prev_hash": "0ef6e948f77b8f8806621003f5de24b1bcbea150bc0e376835aea099674a5db5",
328 "reward": 5025593029981,
329 "timestamp": 1523002893,
330 "wide_cumulative_difficulty": "0x2ed7ee6db56750",
331 "wide_difficulty": "0x1f58ef3541"
332 },{
333 "block_size": 13322,
334 "block_weight": 13322,
335 "cumulative_difficulty": 13185402687569710,
336 "cumulative_difficulty_top64": 0,
337 "depth": 1649023,
338 "difficulty": 134716086238,
339 "difficulty_top64": 0,
340 "hash": "b408bf4cfcd7de13e7e370c84b8314c85b24f0ba4093ca1d6eeb30b35e34e91a",
341 "height": 1546000,
342 "long_term_weight": 13322,
343 "major_version": 7,
344 "miner_tx_hash": "7f749c7c64acb35ef427c7454c45e6688781fbead9bbf222cb12ad1a96a4e8f6",
345 "minor_version": 7,
346 "nonce": 3737164176,
347 "num_txes": 1,
348 "orphan_status": false,
349 "pow_hash": "",
350 "prev_hash": "86d1d20a40cefcf3dd410ff6967e0491613b77bf73ea8f1bf2e335cf9cf7d57a",
351 "reward": 4851952181070,
352 "timestamp": 1523002931,
353 "wide_cumulative_difficulty": "0x2ed80dcb69bf2e",
354 "wide_difficulty": "0x1f5db457de"
355 }],
356 "status": "OK",
357 "top_hash": "",
358 "untrusted": false
359 }
360}"#;
361}
362
363define_request_and_response! {
364 get_block (json_rpc),
365 GET_BLOCK: &str,
366 Request =
367r#"{
368 "jsonrpc": "2.0",
369 "id": "0",
370 "method": "get_block",
371 "params": {
372 "height": 2751506
373 }
374}"#;
375 Response =
376r#"{
377 "id": "0",
378 "jsonrpc": "2.0",
379 "result": {
380 "blob": "1010c58bab9b06b27bdecfc6cd0a46172d136c08831cf67660377ba992332363228b1b722781e7807e07f502cef8a70101ff92f8a7010180e0a596bb1103d7cbf826b665d7a532c316982dc8dbc24f285cbc18bbcc27c7164cd9b3277a85d034019f629d8b36bd16a2bfce3ea80c31dc4d8762c67165aec21845494e32b7582fe00211000000297a787a000000000000000000000000",
381 "block_header": {
382 "block_size": 106,
383 "block_weight": 106,
384 "cumulative_difficulty": 236046001376524168,
385 "cumulative_difficulty_top64": 0,
386 "depth": 443517,
387 "difficulty": 313732272488,
388 "difficulty_top64": 0,
389 "hash": "43bd1f2b6556dcafa413d8372974af59e4e8f37dbf74dc6b2a9b7212d0577428",
390 "height": 2751506,
391 "long_term_weight": 176470,
392 "major_version": 16,
393 "miner_tx_hash": "e49b854c5f339d7410a77f2a137281d8042a0ffc7ef9ab24cd670b67139b24cd",
394 "minor_version": 16,
395 "nonce": 4110909056,
396 "num_txes": 0,
397 "orphan_status": false,
398 "pow_hash": "",
399 "prev_hash": "b27bdecfc6cd0a46172d136c08831cf67660377ba992332363228b1b722781e7",
400 "reward": 600000000000,
401 "timestamp": 1667941829,
402 "wide_cumulative_difficulty": "0x3469a966eb2f788",
403 "wide_difficulty": "0x490be69168"
404 },
405 "credits": 0,
406 "json": "{\n \"major_version\": 16, \n \"minor_version\": 16, \n \"timestamp\": 1667941829, \n \"prev_id\": \"b27bdecfc6cd0a46172d136c08831cf67660377ba992332363228b1b722781e7\", \n \"nonce\": 4110909056, \n \"miner_tx\": {\n \"version\": 2, \n \"unlock_time\": 2751566, \n \"vin\": [ {\n \"gen\": {\n \"height\": 2751506\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 600000000000, \n \"target\": {\n \"tagged_key\": {\n \"key\": \"d7cbf826b665d7a532c316982dc8dbc24f285cbc18bbcc27c7164cd9b3277a85\", \n \"view_tag\": \"d0\"\n }\n }\n }\n ], \n \"extra\": [ 1, 159, 98, 157, 139, 54, 189, 22, 162, 191, 206, 62, 168, 12, 49, 220, 77, 135, 98, 198, 113, 101, 174, 194, 24, 69, 73, 78, 50, 183, 88, 47, 224, 2, 17, 0, 0, 0, 41, 122, 120, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\n ], \n \"rct_signatures\": {\n \"type\": 0\n }\n }, \n \"tx_hashes\": [ ]\n}",
407 "miner_tx_hash": "e49b854c5f339d7410a77f2a137281d8042a0ffc7ef9ab24cd670b67139b24cd",
408 "status": "OK",
409 "top_hash": "",
410 "untrusted": false
411 }
412}"#;
413}
414
415define_request_and_response! {
416 get_block (json_rpc),
417 GET_BLOCK_HASH: &str,
420 Request =
421r#"{
422 "jsonrpc": "2.0",
423 "id": "0",
424 "method": "get_block",
425 "params": {
426 "hash": "86d421322b700166dde2d7eba1cc8600925ef640abf6c0a2cc8ce0d6dd90abfd"
427 }
428}"#;
429 Response =
430r#"{
431 "id": "0",
432 "jsonrpc": "2.0",
433 "result": {
434 "blob": "1010d8faa89b06f8a36d0dbe4d27d2f52160000563896048d71067c31e99a3869bf9b7142227bb5328010b02a6f6a70101ffeaf5a70101a08bc8b3bb11036d6713f5aa552a1aaf33baed7591f795b86daf339e51029a9062dfe09f0f909b312b0124d6023d591c4d434000e5e31c6db718a1e96e865939930e90a7042a1cd4cbd202083786a78452fdfc000002a89e380a44d8dfc64b551baa171447a0f9c9262255be6e8f8ef10896e36e2bf90c4d343e416e394ad9cc10b7d2df7b2f39370a554730f75dfcb04944bd62c299",
435 "block_header": {
436 "block_size": 3166,
437 "block_weight": 3166,
438 "cumulative_difficulty": 235954020187853162,
439 "cumulative_difficulty_top64": 0,
440 "depth": 443814,
441 "difficulty": 312527777859,
442 "difficulty_top64": 0,
443 "hash": "86d421322b700166dde2d7eba1cc8600925ef640abf6c0a2cc8ce0d6dd90abfd",
444 "height": 2751210,
445 "long_term_weight": 176470,
446 "major_version": 16,
447 "miner_tx_hash": "dabe07900d3123ed895612f4a151adb3e39681b145f0f85bfee23ea1fe47acf2",
448 "minor_version": 16,
449 "nonce": 184625235,
450 "num_txes": 2,
451 "orphan_status": false,
452 "pow_hash": "",
453 "prev_hash": "f8a36d0dbe4d27d2f52160000563896048d71067c31e99a3869bf9b7142227bb",
454 "reward": 600061380000,
455 "timestamp": 1667906904,
456 "wide_cumulative_difficulty": "0x34646ee649f516a",
457 "wide_difficulty": "0x48c41b7043"
458 },
459 "credits": 0,
460 "json": "{\n \"major_version\": 16, \n \"minor_version\": 16, \n \"timestamp\": 1667906904, \n \"prev_id\": \"f8a36d0dbe4d27d2f52160000563896048d71067c31e99a3869bf9b7142227bb\", \n \"nonce\": 184625235, \n \"miner_tx\": {\n \"version\": 2, \n \"unlock_time\": 2751270, \n \"vin\": [ {\n \"gen\": {\n \"height\": 2751210\n }\n }\n ], \n \"vout\": [ {\n \"amount\": 600061380000, \n \"target\": {\n \"tagged_key\": {\n \"key\": \"6d6713f5aa552a1aaf33baed7591f795b86daf339e51029a9062dfe09f0f909b\", \n \"view_tag\": \"31\"\n }\n }\n }\n ], \n \"extra\": [ 1, 36, 214, 2, 61, 89, 28, 77, 67, 64, 0, 229, 227, 28, 109, 183, 24, 161, 233, 110, 134, 89, 57, 147, 14, 144, 167, 4, 42, 28, 212, 203, 210, 2, 8, 55, 134, 167, 132, 82, 253, 252, 0\n ], \n \"rct_signatures\": {\n \"type\": 0\n }\n }, \n \"tx_hashes\": [ \"a89e380a44d8dfc64b551baa171447a0f9c9262255be6e8f8ef10896e36e2bf9\", \"0c4d343e416e394ad9cc10b7d2df7b2f39370a554730f75dfcb04944bd62c299\"\n ]\n}",
461 "miner_tx_hash": "dabe07900d3123ed895612f4a151adb3e39681b145f0f85bfee23ea1fe47acf2",
462 "status": "OK",
463 "top_hash": "",
464 "tx_hashes": ["a89e380a44d8dfc64b551baa171447a0f9c9262255be6e8f8ef10896e36e2bf9","0c4d343e416e394ad9cc10b7d2df7b2f39370a554730f75dfcb04944bd62c299"],
465 "untrusted": false
466 }
467}"#;
468}
469
470define_request_and_response! {
471 get_connections (json_rpc),
472 GET_CONNECTIONS: &str,
473 Request =
474r#"{
475 "jsonrpc": "2.0",
476 "id": "0",
477 "method": "get_connections"
478}"#;
479 Response =
480r#"{
481 "id": "0",
482 "jsonrpc": "2.0",
483 "result": {
484 "connections": [{
485 "address": "3evk3kezfjg44ma6tvesy7rbxwwpgpympj45xar5fo4qajrsmkoaqdqd.onion:18083",
486 "address_type": 4,
487 "avg_download": 0,
488 "avg_upload": 0,
489 "connection_id": "22ef856d0f1d44cc95e84fecfd065fe2",
490 "current_download": 0,
491 "current_upload": 0,
492 "height": 3195026,
493 "host": "3evk3kezfjg44ma6tvesy7rbxwwpgpympj45xar5fo4qajrsmkoaqdqd.onion",
494 "incoming": false,
495 "ip": "",
496 "live_time": 76651,
497 "local_ip": false,
498 "localhost": false,
499 "peer_id": "0000000000000001",
500 "port": "",
501 "pruning_seed": 0,
502 "recv_count": 240328,
503 "recv_idle_time": 34,
504 "rpc_credits_per_hash": 0,
505 "rpc_port": 0,
506 "send_count": 3406572,
507 "send_idle_time": 30,
508 "state": "normal",
509 "support_flags": 0
510 },{
511 "address": "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion:18083",
512 "address_type": 4,
513 "avg_download": 0,
514 "avg_upload": 0,
515 "connection_id": "c7734e15936f485a86d2b0534f87e499",
516 "current_download": 0,
517 "current_upload": 0,
518 "height": 3195024,
519 "host": "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion",
520 "incoming": false,
521 "ip": "",
522 "live_time": 76755,
523 "local_ip": false,
524 "localhost": false,
525 "peer_id": "0000000000000001",
526 "port": "",
527 "pruning_seed": 389,
528 "recv_count": 237657,
529 "recv_idle_time": 120,
530 "rpc_credits_per_hash": 0,
531 "rpc_port": 0,
532 "send_count": 3370566,
533 "send_idle_time": 120,
534 "state": "normal",
535 "support_flags": 0
536 }],
537 "status": "OK",
538 "untrusted": false
539 }
540}"#;
541}
542
543define_request_and_response! {
544 get_info (json_rpc),
545 GET_INFO: &str,
546 Request =
547r#"{
548 "jsonrpc": "2.0",
549 "id": "0",
550 "method": "get_info"
551}"#;
552 Response =
553r#"{
554 "id": "0",
555 "jsonrpc": "2.0",
556 "result": {
557 "adjusted_time": 1721245289,
558 "alt_blocks_count": 16,
559 "block_size_limit": 600000,
560 "block_size_median": 300000,
561 "block_weight_limit": 600000,
562 "block_weight_median": 300000,
563 "bootstrap_daemon_address": "",
564 "busy_syncing": false,
565 "credits": 0,
566 "cumulative_difficulty": 366127702242611947,
567 "cumulative_difficulty_top64": 0,
568 "database_size": 235169075200,
569 "difficulty": 280716748706,
570 "difficulty_top64": 0,
571 "free_space": 30521749504,
572 "grey_peerlist_size": 4996,
573 "height": 3195028,
574 "height_without_bootstrap": 3195028,
575 "incoming_connections_count": 62,
576 "mainnet": true,
577 "nettype": "mainnet",
578 "offline": false,
579 "outgoing_connections_count": 1143,
580 "restricted": false,
581 "rpc_connections_count": 1,
582 "stagenet": false,
583 "start_time": 1720462427,
584 "status": "OK",
585 "synchronized": true,
586 "target": 120,
587 "target_height": 0,
588 "testnet": false,
589 "top_block_hash": "bdf06d18ed1931a8ee62654e9b6478cc459bc7072628b8e36f4524d339552946",
590 "top_hash": "",
591 "tx_count": 43205750,
592 "tx_pool_size": 12,
593 "untrusted": false,
594 "update_available": false,
595 "version": "0.18.3.3-release",
596 "was_bootstrap_ever_used": false,
597 "white_peerlist_size": 1000,
598 "wide_cumulative_difficulty": "0x514bf349299d2eb",
599 "wide_difficulty": "0x415c05a7a2"
600 }
601}"#;
602}
603
604define_request_and_response! {
605 hard_fork_info (json_rpc),
606 HARD_FORK_INFO: &str,
607 Request =
608r#"{
609 "jsonrpc": "2.0",
610 "id": "0",
611 "method": "hard_fork_info",
612 "params": {
613 "version": 16
614 }
615}"#;
616 Response =
617r#"{
618 "id": "0",
619 "jsonrpc": "2.0",
620 "result": {
621 "credits": 0,
622 "earliest_height": 2689608,
623 "enabled": true,
624 "state": 0,
625 "status": "OK",
626 "threshold": 0,
627 "top_hash": "",
628 "untrusted": false,
629 "version": 16,
630 "votes": 10080,
631 "voting": 16,
632 "window": 10080
633 }
634}"#;
635}
636
637define_request_and_response! {
638 set_bans (json_rpc),
639 SET_BANS: &str,
640 Request =
641r#"{
642 "jsonrpc": "2.0",
643 "id": "0",
644 "method": "set_bans",
645 "params": {
646 "bans": [{
647 "host": "192.168.1.51",
648 "ban": true,
649 "seconds": 30
650 }]
651 }
652}"#;
653 Response =
654r#"{
655 "id": "0",
656 "jsonrpc": "2.0",
657 "result": {
658 "status": "OK",
659 "untrusted": false
660 }
661}"#;
662}
663
664define_request_and_response! {
665 set_bans (json_rpc),
666 SET_BANS_IP: &str,
669 Request =
670r#"{
671 "jsonrpc": "2.0",
672 "id": "0",
673 "method": "set_bans",
674 "params": {
675 "bans": [{
676 "ip": 838969536,
677 "ban": true,
678 "seconds": 30
679 }]
680 }
681}"#;
682 Response =
683r#"{
684 "id": "0",
685 "jsonrpc": "2.0",
686 "result": {
687 "status": "OK",
688 "untrusted": false
689 }
690}"#;
691}
692
693define_request_and_response! {
694 get_bans (json_rpc),
695 GET_BANS: &str,
696 Request =
697r#"{
698 "jsonrpc": "2.0",
699 "id": "0",
700 "method": "get_bans"
701}"#;
702 Response =
703r#"{
704 "id": "0",
705 "jsonrpc": "2.0",
706 "result": {
707 "bans": [{
708 "host": "104.248.206.131",
709 "ip": 2211379304,
710 "seconds": 689754
711 },{
712 "host": "209.222.252.0\/24",
713 "ip": 0,
714 "seconds": 689754
715 }],
716 "status": "OK",
717 "untrusted": false
718 }
719}"#;
720}
721
722define_request_and_response! {
723 banned (json_rpc),
724 BANNED: &str,
725 Request =
726r#"{
727 "jsonrpc": "2.0",
728 "id": "0",
729 "method": "banned",
730 "params": {
731 "address": "95.216.203.255"
732 }
733}"#;
734 Response =
735r#"{
736 "id": "0",
737 "jsonrpc": "2.0",
738 "result": {
739 "banned": true,
740 "seconds": 689655,
741 "status": "OK"
742 }
743}"#;
744}
745
746define_request_and_response! {
747 flush_txpool (json_rpc),
748 FLUSH_TRANSACTION_POOL: &str,
749 Request =
750r#"{
751 "jsonrpc": "2.0",
752 "id": "0",
753 "method": "flush_txpool",
754 "params": {
755 "txids": ["dc16fa8eaffe1484ca9014ea050e13131d3acf23b419f33bb4cc0b32b6c49308"]
756 }
757}"#;
758 Response =
759r#"{
760 "id": "0",
761 "jsonrpc": "2.0",
762 "result": {
763 "status": "OK"
764 }
765}"#;
766}
767
768define_request_and_response! {
769 get_output_histogram (json_rpc),
770 GET_OUTPUT_HISTOGRAM: &str,
771 Request =
772r#"{
773 "jsonrpc": "2.0",
774 "id": "0",
775 "method": "get_output_histogram",
776 "params": {
777 "amounts": [20000000000]
778 }
779}"#;
780 Response =
781r#"{
782 "id": "0",
783 "jsonrpc": "2.0",
784 "result": {
785 "credits": 0,
786 "histogram": [{
787 "amount": 20000000000,
788 "recent_instances": 0,
789 "total_instances": 381490,
790 "unlocked_instances": 0
791 }],
792 "status": "OK",
793 "top_hash": "",
794 "untrusted": false
795 }
796}"#;
797}
798
799define_request_and_response! {
800 get_coinbase_tx_sum (json_rpc),
801 GET_COINBASE_TX_SUM: &str,
802 Request =
803r#"{
804 "jsonrpc": "2.0",
805 "id": "0",
806 "method": "get_coinbase_tx_sum",
807 "params": {
808 "height": 1563078,
809 "count": 2
810 }
811}"#;
812 Response =
813r#"{
814 "id": "0",
815 "jsonrpc": "2.0",
816 "result": {
817 "credits": 0,
818 "emission_amount": 9387854817320,
819 "emission_amount_top64": 0,
820 "fee_amount": 83981380000,
821 "fee_amount_top64": 0,
822 "status": "OK",
823 "top_hash": "",
824 "untrusted": false,
825 "wide_emission_amount": "0x889c7c06828",
826 "wide_fee_amount": "0x138dae29a0"
827 }
828}"#;
829}
830
831define_request_and_response! {
832 get_version (json_rpc),
833 GET_VERSION: &str,
834 Request =
835r#"{
836 "jsonrpc": "2.0",
837 "id": "0",
838 "method": "get_version"
839}"#;
840 Response =
841r#"{
842 "id": "0",
843 "jsonrpc": "2.0",
844 "result": {
845 "current_height": 3195051,
846 "hard_forks": [{
847 "height": 1,
848 "hf_version": 1
849 },{
850 "height": 1009827,
851 "hf_version": 2
852 },{
853 "height": 1141317,
854 "hf_version": 3
855 },{
856 "height": 1220516,
857 "hf_version": 4
858 },{
859 "height": 1288616,
860 "hf_version": 5
861 },{
862 "height": 1400000,
863 "hf_version": 6
864 },{
865 "height": 1546000,
866 "hf_version": 7
867 },{
868 "height": 1685555,
869 "hf_version": 8
870 },{
871 "height": 1686275,
872 "hf_version": 9
873 },{
874 "height": 1788000,
875 "hf_version": 10
876 },{
877 "height": 1788720,
878 "hf_version": 11
879 },{
880 "height": 1978433,
881 "hf_version": 12
882 },{
883 "height": 2210000,
884 "hf_version": 13
885 },{
886 "height": 2210720,
887 "hf_version": 14
888 },{
889 "height": 2688888,
890 "hf_version": 15
891 },{
892 "height": 2689608,
893 "hf_version": 16
894 }],
895 "release": true,
896 "status": "OK",
897 "untrusted": false,
898 "version": 196621
899 }
900}"#;
901}
902
903define_request_and_response! {
904 get_fee_estimate (json_rpc),
905 GET_FEE_ESTIMATE: &str,
906 Request =
907r#"{
908 "jsonrpc": "2.0",
909 "id": "0",
910 "method": "get_fee_estimate"
911}"#;
912 Response =
913r#"{
914 "id": "0",
915 "jsonrpc": "2.0",
916 "result": {
917 "credits": 0,
918 "fee": 20000,
919 "fees": [20000,80000,320000,4000000],
920 "quantization_mask": 10000,
921 "status": "OK",
922 "top_hash": "",
923 "untrusted": false
924 }
925}"#;
926}
927
928define_request_and_response! {
929 get_alternate_chains (json_rpc),
930 GET_ALTERNATE_CHAINS: &str,
931 Request =
932r#"{
933 "jsonrpc": "2.0",
934 "id": "0",
935 "method": "get_alternate_chains"
936}"#;
937 Response =
938r#"{
939 "id": "0",
940 "jsonrpc": "2.0",
941 "result": {
942 "chains": [{
943 "block_hash": "4826c7d45d7cf4f02985b5c405b0e5d7f92c8d25e015492ce19aa3b209295dce",
944 "block_hashes": ["4826c7d45d7cf4f02985b5c405b0e5d7f92c8d25e015492ce19aa3b209295dce"],
945 "difficulty": 357404825113208373,
946 "difficulty_top64": 0,
947 "height": 3167471,
948 "length": 1,
949 "main_chain_parent_block": "69b5075ea627d6ba06b1c30b7e023884eeaef5282cf58ec847dab838ddbcdd86",
950 "wide_difficulty": "0x4f5c1cb79e22635"
951 },{
952 "block_hash": "33ee476f5a1c5b9d889274cbbe171f5e0112df7ed69021918042525485deb401",
953 "block_hashes": ["33ee476f5a1c5b9d889274cbbe171f5e0112df7ed69021918042525485deb401"],
954 "difficulty": 354736121711617293,
955 "difficulty_top64": 0,
956 "height": 3157465,
957 "length": 1,
958 "main_chain_parent_block": "fd522fcc4cefe5c8c0e5c5600981b3151772c285df3a4e38e5c4011cf466d2cb",
959 "wide_difficulty": "0x4ec469f8b9ee50d"
960 }],
961 "status": "OK",
962 "untrusted": false
963 }
964}"#;
965}
966
967define_request_and_response! {
968 relay_tx (json_rpc),
969 RELAY_TX: &str,
970 Request =
971r#"{
972 "jsonrpc": "2.0",
973 "id": "0",
974 "method": "relay_tx",
975 "params": {
976 "txids": ["9fd75c429cbe52da9a52f2ffc5fbd107fe7fd2099c0d8de274dc8a67e0c98613"]
977 }
978}"#;
979 Response =
980r#"{
981 "id": "0",
982 "jsonrpc": "2.0",
983 "result": {
984 "status": "OK"
985 }
986}"#;
987}
988
989define_request_and_response! {
990 sync_info (json_rpc),
991 SYNC_INFO: &str,
992 Request =
993r#"{
994 "jsonrpc": "2.0",
995 "id": "0",
996 "method": "sync_info"
997}"#;
998 Response =
999r#"{
1000 "id": "0",
1001 "jsonrpc": "2.0",
1002 "result": {
1003 "credits": 0,
1004 "height": 3195157,
1005 "next_needed_pruning_seed": 0,
1006 "overview": "[]",
1007 "peers": [{
1008 "info": {
1009 "address": "142.93.128.65:44986",
1010 "address_type": 1,
1011 "avg_download": 1,
1012 "avg_upload": 1,
1013 "connection_id": "a5803c4c2dac49e7b201dccdef54c862",
1014 "current_download": 2,
1015 "current_upload": 1,
1016 "height": 3195157,
1017 "host": "142.93.128.65",
1018 "incoming": true,
1019 "ip": "142.93.128.65",
1020 "live_time": 18,
1021 "local_ip": false,
1022 "localhost": false,
1023 "peer_id": "6830e9764d3e5687",
1024 "port": "44986",
1025 "pruning_seed": 0,
1026 "recv_count": 20340,
1027 "recv_idle_time": 0,
1028 "rpc_credits_per_hash": 0,
1029 "rpc_port": 18089,
1030 "send_count": 32235,
1031 "send_idle_time": 6,
1032 "state": "normal",
1033 "support_flags": 1
1034 }
1035 },{
1036 "info": {
1037 "address": "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion:18083",
1038 "address_type": 4,
1039 "avg_download": 0,
1040 "avg_upload": 0,
1041 "connection_id": "277f7c821bc546878c8bd29977e780f5",
1042 "current_download": 0,
1043 "current_upload": 0,
1044 "height": 3195157,
1045 "host": "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion",
1046 "incoming": false,
1047 "ip": "",
1048 "live_time": 2246,
1049 "local_ip": false,
1050 "localhost": false,
1051 "peer_id": "0000000000000001",
1052 "port": "",
1053 "pruning_seed": 389,
1054 "recv_count": 65164,
1055 "recv_idle_time": 15,
1056 "rpc_credits_per_hash": 0,
1057 "rpc_port": 0,
1058 "send_count": 99120,
1059 "send_idle_time": 15,
1060 "state": "normal",
1061 "support_flags": 0
1062 }
1063 }],
1064 "status": "OK",
1065 "target_height": 0,
1066 "top_hash": "",
1067 "untrusted": false
1068 }
1069}"#;
1070}
1071
1072define_request_and_response! {
1095 get_output_distribution (json_rpc),
1096 GET_OUTPUT_DISTRIBUTION: &str,
1097 Request =
1098r#"{
1099 "jsonrpc": "2.0",
1100 "id": "0",
1101 "method": "get_output_distribution",
1102 "params": {
1103 "amounts": [628780000],
1104 "from_height": 1462078
1105 }
1106}"#;
1107 Response =
1108r#"{
1109 "id": "0",
1110 "jsonrpc": "2.0",
1111 "result": {
1112 "credits": 0,
1113 "distributions": [{
1114 "amount": 2628780000,
1115 "base": 0,
1116 "distribution": "",
1117 "start_height": 1462078,
1118 "binary": false
1119 }],
1120 "status": "OK",
1121 "top_hash": "",
1122 "untrusted": false
1123 }
1124}"#;
1125}
1126
1127define_request_and_response! {
1128 get_miner_data (json_rpc),
1129 GET_MINER_DATA: &str,
1130 Request =
1131r#"{
1132 "jsonrpc": "2.0",
1133 "id": "0",
1134 "method": "get_miner_data"
1135}"#;
1136 Response =
1137r#"{
1138 "id": "0",
1139 "jsonrpc": "2.0",
1140 "result": {
1141 "already_generated_coins": 18186022843595960691,
1142 "difficulty": "0x48afae42de",
1143 "height": 2731375,
1144 "major_version": 16,
1145 "median_weight": 300000,
1146 "prev_id": "78d50c5894d187c4946d54410990ca59a75017628174a9e8c7055fa4ca5c7c6d",
1147 "seed_hash": "a6b869d50eca3a43ec26fe4c369859cf36ae37ce6ecb76457d31ffeb8a6ca8a6",
1148 "status": "OK",
1149 "tx_backlog": [{
1150 "fee": 30700000,
1151 "id": "9868490d6bb9207fdd9cf17ca1f6c791b92ca97de0365855ea5c089f67c22208",
1152 "weight": 1535
1153 },{
1154 "fee": 44280000,
1155 "id": "b6000b02bbec71e18ad704bcae09fb6e5ae86d897ced14a718753e76e86c0a0a",
1156 "weight": 2214
1157 }],
1158 "untrusted": false
1159 }
1160}"#;
1161}
1162
1163define_request_and_response! {
1164 prune_blockchain (json_rpc),
1165 PRUNE_BLOCKCHAIN: &str,
1166 Request =
1167r#"{
1168 "jsonrpc": "2.0",
1169 "id": "0",
1170 "method": "prune_blockchain",
1171 "params": {
1172 "check": true
1173 }
1174}"#;
1175 Response =
1176r#"{
1177 "id": "0",
1178 "jsonrpc": "2.0",
1179 "result": {
1180 "pruned": true,
1181 "pruning_seed": 387,
1182 "status": "OK",
1183 "untrusted": false
1184 }
1185}"#;
1186}
1187
1188define_request_and_response! {
1189 calc_pow (json_rpc),
1190 CALC_POW: &str,
1191 Request =
1192r#"{
1193 "jsonrpc": "2.0",
1194 "id": "0",
1195 "method": "calc_pow",
1196 "params": {
1197 "major_version": 14,
1198 "height": 2286447,
1199 "block_blob": "0e0ed286da8006ecdc1aab3033cf1716c52f13f9d8ae0051615a2453643de94643b550d543becd0000000002abc78b0101ffefc68b0101fcfcf0d4b422025014bb4a1eade6622fd781cb1063381cad396efa69719b41aa28b4fce8c7ad4b5f019ce1dc670456b24a5e03c2d9058a2df10fec779e2579753b1847b74ee644f16b023c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051399a1bc46a846474f5b33db24eae173a26393b976054ee14f9feefe99925233802867097564c9db7a36af5bb5ed33ab46e63092bd8d32cef121608c3258edd55562812e21cc7e3ac73045745a72f7d74581d9a0849d6f30e8b2923171253e864f4e9ddea3acb5bc755f1c4a878130a70c26297540bc0b7a57affb6b35c1f03d8dbd54ece8457531f8cba15bb74516779c01193e212050423020e45aa2c15dcb",
1200 "seed_hash": "d432f499205150873b2572b5f033c9c6e4b7c6f3394bd2dd93822cd7085e7307"
1201 }
1202}"#;
1203 Response =
1204r#"{
1205 "id": "0",
1206 "jsonrpc": "2.0",
1207 "result": "d0402d6834e26fb94a9ce38c6424d27d2069896a9b8b1ce685d79936bca6e0a8"
1208}"#;
1209}
1210
1211define_request_and_response! {
1212 flush_cache (json_rpc),
1213 FLUSH_CACHE: &str,
1214 Request =
1215r#"{
1216 "jsonrpc": "2.0",
1217 "id": "0",
1218 "method": "flush_cache",
1219 "params": {
1220 "bad_txs": true,
1221 "bad_blocks": true
1222 }
1223}"#;
1224 Response =
1225r#"{
1226 "id": "0",
1227 "jsonrpc": "2.0",
1228 "result": {
1229 "status": "OK",
1230 "untrusted": false
1231 }
1232}"#;
1233}
1234
1235define_request_and_response! {
1236 add_aux_pow (json_rpc),
1237 ADD_AUX_POW: &str,
1238 Request =
1239r#"{
1240 "jsonrpc": "2.0",
1241 "id": "0",
1242 "method": "add_aux_pow",
1243 "params": {
1244 "blocktemplate_blob": "1010f4bae0b4069d648e741d85ca0e7acb4501f051b27e9b107d3cd7a3f03aa7f776089117c81a0000000002c681c30101ff8a81c3010180e0a596bb11033b7eedf47baf878f3490cb20b696079c34bd017fe59b0d070e74d73ffabc4bb0e05f011decb630f3148d0163b3bd39690dde4078e4cfb69fecf020d6278a27bad10c58023c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
1245 "aux_pow": [{
1246 "id": "3200b4ea97c3b2081cd4190b58e49572b2319fed00d030ad51809dff06b5d8c8",
1247 "hash": "7b35762de164b20885e15dbe656b1138db06bb402fa1796f5765a23933d8859a"
1248 }]
1249 }
1250}"#;
1251 Response =
1252r#"{
1253 "id": "0",
1254 "jsonrpc": "2.0",
1255 "result": {
1256 "aux_pow": [{
1257 "hash": "7b35762de164b20885e15dbe656b1138db06bb402fa1796f5765a23933d8859a",
1258 "id": "3200b4ea97c3b2081cd4190b58e49572b2319fed00d030ad51809dff06b5d8c8"
1259 }],
1260 "blockhashing_blob": "1010ee97e2a106e9f8ebe8887e5b609949ac8ea6143e560ed13552b110cb009b21f0cfca1eaccf00000000b2685c1283a646bc9020c758daa443be145b7370ce5a6efacb3e614117032e2c22",
1261 "blocktemplate_blob": "1010f4bae0b4069d648e741d85ca0e7acb4501f051b27e9b107d3cd7a3f03aa7f776089117c81a0000000002c681c30101ff8a81c3010180e0a596bb11033b7eedf47baf878f3490cb20b696079c34bd017fe59b0d070e74d73ffabc4bb0e05f011decb630f3148d0163b3bd39690dde4078e4cfb69fecf020d6278a27bad10c58023c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
1262 "merkle_root": "7b35762de164b20885e15dbe656b1138db06bb402fa1796f5765a23933d8859a",
1263 "merkle_tree_depth": 0,
1264 "status": "OK",
1265 "untrusted": false
1266 }
1267}"#;
1268}
1269
1270define_request_and_response! {
1271 UNDOCUMENTED_METHOD (json_rpc),
1272 GET_TX_IDS_LOOSE: &str,
1273 Request =
1274r#"{
1275 "jsonrpc": "2.0",
1276 "id": "0",
1277 "method": "get_txids_loose",
1278 "params": {
1279 "txid_template": "0000000000000000aea473c43708aa50b2c9eaf0e441aa209afc9b43458fb09e",
1280 "num_matching_bits": 192
1281 }
1282}"#;
1283 Response =
1284r#"{
1285 "id": "0",
1286 "jsonrpc": "2.0",
1287 "result": {
1288 "txids": "",
1289 "status": "OK",
1290 "untrusted": false
1291 }
1292}"#;
1293}
1294
1295#[cfg(test)]
1297mod test {
1298 }