wallet-rpc.md 32.5 KB
Newer Older
D Sal's avatar
D Sal committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
layout: static_page
title: "Wallet RPC documentation"
title-pre-kick: "Developer Guide: "
title-kick: "Wallet RPC documentation "
title-post-kick: ""
kick-class: "green-kicks"
icon: "icon_client"
attribution: "<!-- Icon is based on work by Freepik (http://www.freepik.com) and is licensed under Creative Commons BY 3.0 -->"
---

## Introduction

This is a list of the monero-wallet-rpc calls, their inputs and outputs, and examples of each. The program monero-wallet-rpc replaced the rpc interface that was in simplewallet and then monero-wallet-cli.

All monero-wallet-rpc methods use the same JSON RPC interface. For example:

Mike C's avatar
Mike C committed
18
19
20
21
22
23
24
25
26
27
```
IP=127.0.0.1
PORT=18082
METHOD="make_integrated_address"
PARAMS="{\"payment_id\":\"1234567890123456789012345678900012345678901234567890123456789000\"}"
curl \
    -X POST http://$IP:$PORT/json_rpc \
    -d '{"jsonrpc":"2.0","id":"0","method":"'$METHOD'","params":'"$PARAMS"'}' \
    -H 'Content-Type: application/json'
```
D Sal's avatar
D Sal committed
28
29
30

If the monero-wallet-rpc was executed with the `--rpc-login` argument as `username:password`, then follow this example:

Mike C's avatar
Mike C committed
31
32
33
34
35
36
37
38
39
40
41
```
IP=127.0.0.1
PORT=18082
METHOD="make_integrated_address"
PARAMS="{\"payment_id\":\"1234567890123456789012345678900012345678901234567890123456789000\"}"
curl \
    -u username:password --digest \
    -X POST http://$IP:$PORT/json_rpc \
    -d '{"jsonrpc":"2.0","id":"0","method":"'$METHOD'","params":'"$PARAMS"'}' \
    -H 'Content-Type: application/json'
```
D Sal's avatar
D Sal committed
42
43
44
45
46
47
48
49
50
51
52

Note: "atomic units" refer to the smallest fraction of 1 XMR according to the monerod implementation. **1 XMR = 1e12 atomic units.**

### Index of JSON RPC Methods:

* [getbalance](#getbalance)
* [getaddress](#getaddress)
* [getheight](#getheight)
* [transfer](#transfer)
* [transfer_split](#transfersplit)
* [sweep_dust](#sweepdust)
53
* [sweep_all](#sweepall)
D Sal's avatar
D Sal committed
54
55
56
57
* [store](#store)
* [get_payments](#getpayments)
* [get_bulk_payments](#getbulkpayments)
* [get_transfers](#gettransfers)
58
* [get_transfer_by_txid](#gettransferbytxid)
D Sal's avatar
D Sal committed
59
60
61
62
63
* [incoming_transfers](#incomingtransfers)
* [query_key](#querykey)
* [make_integrated_address](#makeintegratedaddress)
* [split_integrated_address](#splitintegratedaddress)
* [stop_wallet](#stopwallet)
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
* [make_uri](#makeuri)
* [parse_uri](#parseuri)
* [rescan_blockchain](#rescanblockchain)
* [set_tx_notes](#settxnotes)
* [get_tx_notes](#gettxnotes)
* [sign](#sign)
* [verify](#verify)
* [export_key_images](#exportkeyimages)
* [import_key_images](#importkeyimages)
* [get_address_book](#getaddressbook)
* [add_address_book](#addaddressbook)
* [delete_address_book](#deleteaddressbook)
* [rescan_spent](#rescanspent)
* [start_mining](#startmining)
* [stop_mining](#stopmining)
* [get_languages](#getlanguages)
* [create_wallet](#createwallet)
* [open_wallet](#openwallet)
D Sal's avatar
D Sal committed
82
83
84
85
86

---

## JSON RPC Methods:

Mike C's avatar
Mike C committed
87
### **getbalance**
D Sal's avatar
D Sal committed
88
89
90
91
92
93
94
95
96
97
98
99

Return the wallet's balance.

Inputs: *None*.

Outputs:

* *balance* - unsigned int; The total balance of the current monero-wallet-rpc in session.
* *unlocked_balance* - unsigned int; Unlocked funds are those funds that are sufficiently deep enough in the Monero blockchain to be considered safe to spend.

Example:

Mike C's avatar
Mike C committed
100
101
102
103
104
105
106
107
108
109
110
111
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getbalance"}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "balance": 140000000000,
    "unlocked_balance": 50000000000
  }
}
```
D Sal's avatar
D Sal committed
112
113


Mike C's avatar
Mike C committed
114
### **getaddress**
D Sal's avatar
D Sal committed
115
116
117
118
119
120
121
122
123
124
125

Return the wallet's address.

Inputs: *None*.

Outputs:

* *address* - string; The 95-character hex address string of the monero-wallet-rpc in session.

Example:

Mike C's avatar
Mike C committed
126
127
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getaddress"}' -H 'Content-Type: application/json'
D Sal's avatar
D Sal committed
128

Mike C's avatar
Mike C committed
129
130
131
132
133
134
135
136
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "address": "427ZuEhNJQRXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CGuJiWFQjhnhhwiH1FsHYGQGaDsaBA"
  }
}
```
D Sal's avatar
D Sal committed
137

Mike C's avatar
Mike C committed
138
139

### **getheight**
D Sal's avatar
D Sal committed
140
141
142
143
144
145
146

Returns the wallet's current block height.

Inputs: *None*.

Outputs:

147
* *height* - unsigned int; The current monero-wallet-rpc's blockchain height. If the wallet has been offline for a long time, it may need to catch up with the daemon.
D Sal's avatar
D Sal committed
148
149
150

Example:

Mike C's avatar
Mike C committed
151
152
153
154
155
156
157
158
159
160
161
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getheight"}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "height": 994310
  }
}
```
D Sal's avatar
D Sal committed
162
163


Mike C's avatar
Mike C committed
164
### **transfer**
D Sal's avatar
D Sal committed
165
166
167
168
169
170
171
172
173
174
175
176
177

Send monero to a number of recipients.

Inputs:

* *destinations* - array of destinations to receive XMR:
  * *amount* - unsigned int; Amount to send to each destination, in atomic units.
  * *address* - string; Destination public address.
* *fee* - unsigned int; Ignored, will be automatically calculated.
* *mixin* - unsigned int; Number of outpouts from the blockchain to mix with (0 means no mixing).
* *unlock_time* - unsigned int; Number of blocks before the monero can be spent (0 to not add a lock).
* *payment_id* - string; (Optional) Random 32-byte/64-character hex string to identify a transaction.
* *get_tx_key* - boolean; (Optional) Return the transaction key after sending.
178
179
180
181
* *priority* - unsigned int; Set a priority for the transaction. Accepted Values are: 0-3 for: default, unimportant, normal, elevated, priority.
* *do_not_relay* - boolean; (Optional) If true, the newly created transaction will not be relayed to the monero network. (Defaults to false)
* *get_tx_hex* - boolean; Return the transaction as hex string after sending

182

D Sal's avatar
D Sal committed
183
184
185
186
187
Outputs:

* *fee* - Integer value of the fee charged for the txn.
* *tx_hash* - String for the publically searchable transaction hash
* *tx_key* - String for the transaction key if get_tx_key is true, otherwise, blank string.
188
189
* *tx_blob* - Transaction as hex string if get_tx_hex is true

D Sal's avatar
D Sal committed
190
191
192

Example:

Mike C's avatar
Mike C committed
193
194
195
196
197
198
199
200
201
202
203
204
205
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"transfer","params":{"destinations":[{"amount":100000000,"address":"9wNgSYy2F9qPZu7KBjvsFgZLTKE2TZgEpNFbGka9gA5zPmAXS35QzzYaLKJRkYTnzgArGNX7TvSqZC87tBLwtaC5RQgJ8rm"},{"amount":200000000,"address":"9vH5D7Fv47mbpCpdcthcjU34rqiiAYRCh1tYywmhqnEk9iwCE9yppgNCXAyVHG5qJt2kExa42TuhzQfJbmbpeGLkVbg8xit"}],"mixin":4,"get_tx_key": true}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "fee": 48958481211,
    "tx_hash": "985180f468637bc6d2f72ee054e1e34b8d5097988bb29a2e0cb763e4464db23c",
    "tx_key": "8d62e5637f1fcc9a8904057d6bed6c697618507b193e956f77c31ce662b2ee07"
  }
}
```
D Sal's avatar
D Sal committed
206
207


Mike C's avatar
Mike C committed
208
### **transfer_split**
D Sal's avatar
D Sal committed
209
210
211
212
213
214
215
216
217
218
219
220

Same as transfer, but can split into more than one tx if necessary.

Inputs:

* *destinations* - array of destinations to receive XMR:
  * *amount* - unsigned int; Amount to send to each destination, in atomic units.
  * *address* - string; Destination public address.
* *fee* - unsigned int; Ignored, will be automatically calculated.
* *mixin* - unsigned int; Number of outpouts from the blockchain to mix with (0 means no mixing).
* *unlock_time* - unsigned int; Number of blocks before the monero can be spent (0 to not add a lock).
* *payment_id* - string; (Optional) Random 32-byte/64-character hex string to identify a transaction.
221
222
223
224
* *get_tx_keys* - boolean; (Optional) Return the transaction keys after sending. -- Ignored
* *priority* - unsigned int; Set a priority for the transactions. Accepted Values are: 0-3 for: default, unimportant, normal, elevated, priority.
* *do_not_relay* - boolean; (Optional) If true, the newly created transaction will not be relayed to the monero network. (Defaults to false)
* *get_tx_hex* - boolean; Return the transactions as hex string after sending
D Sal's avatar
D Sal committed
225
226
227
228
* *new_algorithm* - boolean; True to use the new transaction construction algorithm, defaults to false.

Outputs:

229
230
231
232
233
* *fee_list* - array of: integer. The amount of fees paid for every transaction.
* *tx_hash_list* - array of: string. The tx hashes of every transaction.
* *tx_blob_list* - array of: string. The tx as hex string for every transaction.
* *amount_list* - array of: integer. The amount transferred for every transaction..
* *tx_key_list* - array of: string. The transaction keys for every transaction.
D Sal's avatar
D Sal committed
234
235
236

Example:

Mike C's avatar
Mike C committed
237
238
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"transfer_split","params":{"destinations":[{"amount":100000000,"address":"9wNgSYy2F9qPZu7KBjvsFgZLTKE2TZgEpNFbGka9gA5zPmAXS35QzzYaLKJRkYTnzgArGNX7TvSqZC87tBwtaC5RQgJ8rm"},{"amount":200000000,"address":"9vH5D7Fv47mbpCpdcthcjU34rqiiAYRCh1tYywmhqnEk9iwCE9yppgNCXAyVHG5qJt2kExa42TuhzQfJbmbpeGLkVbg8xit"},{"amount":200000000,"address":"9vC5Q25cR1d3WzKX6dpTaLJaqZyDrtTnfadTmVuB1Wue2tyFGxUhiE4RGa74pEDJv7gSySzcd1Ao6G1nzSaqp78vLfP6MPj"},{"amount":200000000,"address":"A2MSrn49ziBPJBh8ZNEhhbfyLMou6mao4C1F5TLGUatmUnCxZArDYkcbAnVkVEopWVeak2rKDrmc8JpoS7n5dvfN9YDPBTG"},{"amount":200000000,"address":"9tEDyVQ8zgRQbDYiykTdpw5kZ6qWQWcKfExEj9eQshjpGb3sdr3UyWE2AHWzUGzJjaH9HN1DdGBdyQQ4AqGMc7rr5xYwZWW"}],"mixin":4,"get_tx_key": true, "new_algorithm": true}}' -H 'Content-Type: application/json'
D Sal's avatar
D Sal committed
239

Mike C's avatar
Mike C committed
240
241
242
243
244
245
246
247
248
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "fee_list": [97916962422],
    "tx_hash_list": ["c5c389846e701c27aaf1f7ab8b9dc457b471fcea5bc9710e8020d51275afbc54"]
  }
}
```
D Sal's avatar
D Sal committed
249

Mike C's avatar
Mike C committed
250
251

### **sweep_dust**
D Sal's avatar
D Sal committed
252
253
254
255
256
257
258
259
260
261
262
263

Send all dust outputs back to the wallet's, to make them easier to spend (and mix).

Inputs: *None*.

Outputs:

* *tx_hash_list* - list of: string

Example (In this example, `sweep_dust` returns an error due to insufficient funds to sweep):


Mike C's avatar
Mike C committed
264
265
266
267
268
269
270
271
272
273
274
275
276
277
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sweep_dust"}' -H 'Content-Type: application/json'

{
  "error": {
    "code": -4,
    "message": "not enough money"
  },
  "id": "0",
  "jsonrpc": "2.0"
}
```

### **sweep_all**
278
279
280
281
282
283
284
285
286
287

Send all unlocked balance to an address.

Inputs:

* *address* - string; Destination public address.
* *priority* - unsigned int; (Optional)
* *mixin* - unsigned int; Number of outpouts from the blockchain to mix with (0 means no mixing).
* *unlock_time* - unsigned int; Number of blocks before the monero can be spent (0 to not add a lock).
* *payment_id* - string; (Optional) Random 32-byte/64-character hex string to identify a transaction.
288
* *get_tx_keys* - boolean; (Optional) Return the transaction keys after sending.
289
290
* *below_amount* - unsigned int; (Optional)
* *do_not_relay* - boolean; (Optional)
291
* *get_tx_hex* - boolean; (Optional) return the transactions as hex encoded string.
292
293
294
295
296

Outputs:

* *tx_hash_list* - array of string;
* *tx_key_list* - array of string;
297
* *tx_blob_list* - array of string; 
298
299
300

Example:

Mike C's avatar
Mike C committed
301
302
```
$ curl -X POST http://localhost:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sweep_all","params":{"address":"9sS8eRU2b5ZbN2FPSrpkiab1bjbHE5XtL6Ti6We3Fhw5aQPudRfVVypjgzKDNkxtvTQSPs122NKggb2mqcqkKSeMNVu59S","mixin":2,"unlock_time":0,"get_tx_keys":true}}' -H 'Content-Type: application/json'
303

Mike C's avatar
Mike C committed
304
305
306
307
308
309
310
311
312
313
314
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "tx_hash_list": ["53a3648797d5524dd037d4105e067fa61468faecab41927fc43adbb26c202d22"],
    "tx_key_list": ["e83b3b78235e36cd7e4d9695efd81a3b3e64c7d1f1ebd61892f0a7add6a50301"]
  }
}
```

### **store**
D Sal's avatar
D Sal committed
315
316
317
318
319
320
321
322
323

Save the blockchain.

Inputs: *None*.

Outputs: *None*.

Example:

Mike C's avatar
Mike C committed
324
325
326
327
328
329
330
331
332
333
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"store"}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}
```
D Sal's avatar
D Sal committed
334
335


Mike C's avatar
Mike C committed
336
### **get_payments**
D Sal's avatar
D Sal committed
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354

Get a list of incoming payments using a given payment id.

Inputs:

* *payment_id* - string

Outputs:

* *payments* - list of:
  * *payment_id* - string
  * *tx_hash* - string
  * *amount* - unsigned int
  * *block_height* - unsigned int
  * *unlock_time* - unsigned int

Example:

Mike C's avatar
Mike C committed
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_payments","params":{"payment_id":"4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030"}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "payments": [{
      "amount": 10350000000000,
      "block_height": 994327,
      "payment_id": "4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030",
      "tx_hash": "c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1",
      "unlock_time": 0
    }]
  }
}
```
D Sal's avatar
D Sal committed
372
373


Mike C's avatar
Mike C committed
374
### **get_bulk_payments**
D Sal's avatar
D Sal committed
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393

Get a list of incoming payments using a given payment id, or a list of payments ids, from a given height. This method is the preferred method over `get_payments` because it has the same functionality but is more extendable. Either is fine for looking up transactions by a single payment ID.

Inputs:

* *payment_ids* - array of: string
 * *min_block_height* - unsigned int; The block height at which to start looking for payments.

Outputs:

* *payments* - list of:
  * *payment_id* - string
  * *tx_hash* - string
  * *amount* - unsigned int
  * *block_height* - unsigned int
  * *unlock_time* - unsigned int

Example:

Mike C's avatar
Mike C committed
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_bulk_payments","params":{"payment_ids":["4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030"],"min_block_height":990000}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "payments": [{
      "amount": 10350000000000,
      "block_height": 994327,
      "payment_id": "4279257e0a20608e25dba8744949c9e1caff4fcdafc7d5362ecf14225f3d9030",
      "tx_hash": "c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1",
      "unlock_time": 0
    }]
  }
}
```

D Sal's avatar
D Sal committed
412

Mike C's avatar
Mike C committed
413
### **get_transfers**
D Sal's avatar
D Sal committed
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

Returns a list of transfers.

Inputs:

* *in* - boolean;
* *out* - boolean;
* *pending* - boolean;
* *failed* - boolean;
* *pool* - boolean;
* *filter_by_height* - boolean;
* *min_height* - unsigned int;
* *max_height* - unsigned int;

Outputs:

* *in* array of transfers:
  * *txid* - string;
  * *payment_id* - string;
  * *height* - unsigned int;
  * *timestamp* - unsigned int;
  * *amount* - unsigned int;
  * *fee* - unsigned int;
  * *note* - string;
  * *destinations* - std::list<transfer_destination>;
  * *type* - string;
* *out* array of transfers
* *pending* array of transfers
* *failed* array of transfers
* *pool* array of transfers


Example:

Mike C's avatar
Mike C committed
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_transfers","params":{"pool":true}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "pool": [{
      "amount": 500000000000,
      "fee": 0,
      "height": 0,
      "note": "",
      "payment_id": "758d9b225fda7b7f",
      "timestamp": 1488312467,
      "txid": "da7301d5423efa09fabacb720002e978d114ff2db6a1546f8b820644a1b96208",
      "type": "pool"
    }]
  }
}
```

### **get_transfer_by_txid**
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490

Show information about a transfer to/from this address.

Inputs:

* *txid* - string

Outputs:

* *transfer* - JSON object containing parment information:
  * *amount* - unsigned int
  * *fee* - unsigned int
  * *height* - unsigned int
  * *note* - string
  * *payment_id* - string
  * *timestamp* - unsigned int
  * *txid* - string
  * *type* - string

Example:

Mike C's avatar
Mike C committed
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
```
$ curl -X POST http://localhost:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_transfer_by_txid","params":{"txid":"f2d33ba969a09941c6671e6dfe7e9456e5f686eca72c1a94a3e63ac6d7f27baf"}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "transfer": {
      "amount": 10000000000000,
      "fee": 0,
      "height": 1316388,
      "note": "",
      "payment_id": "0000000000000000",
      "timestamp": 1495539310,
      "txid": "f2d33ba969a09941c6671e6dfe7e9456e5f686eca72c1a94a3e63ac6d7f27baf",
      "type": "in"
507
    }
Mike C's avatar
Mike C committed
508
509
510
511
  }
}
```

D Sal's avatar
D Sal committed
512

Mike C's avatar
Mike C committed
513
### **incoming_transfers**
D Sal's avatar
D Sal committed
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531

Return a list of incoming transfers to the wallet.

Inputs:

* *transfer_type* - string; "all": all the transfers, "available": only transfers which are not yet spent, OR "unavailable": only transfers which are already spent.

Outputs:

* *transfers* - list of:
  * *amount* - unsigned int
  * *spent* - boolean
  * *global_index* - unsigned int; Mostly internal use, can be ignored by most users.
  * *tx_hash* - string; Several incoming transfers may share the same hash if they were in the same transaction.
  * *tx_size* - unsigned int

Example (Return "all" transaction types):

Mike C's avatar
Mike C committed
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
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"incoming_transfers","params":{"transfer_type":"all"}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "transfers": [{
      "amount": 10000000000000,
      "global_index": 711506,
      "spent": false,
      "tx_hash": "&lt;c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1&gt;",
      "tx_size": 5870
    },{
      "amount": 300000000000,
      "global_index": 794232,
      "spent": false,
      "tx_hash": "&lt;c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1&gt;",
      "tx_size": 5870
    },{
      "amount": 50000000000,
      "global_index": 213659,
      "spent": false,
      "tx_hash": "&lt;c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1&gt;",
      "tx_size": 5870
    }]
  }
}
```
D Sal's avatar
D Sal committed
561
562
563

Example (Return "available" transactions):

Mike C's avatar
Mike C committed
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
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"incoming_transfers","params":{"transfer_type":"available"}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "transfers": [{
      "amount": 10000000000000,
      "global_index": 711506,
      "spent": false,
      "tx_hash": "&lt;c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1&gt;",
      "tx_size": 5870
    },{
      "amount": 300000000000,
      "global_index": 794232,
      "spent": false,
      "tx_hash": "&lt;c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1&gt;",
      "tx_size": 5870
    },{
      "amount": 50000000000,
      "global_index": 213659,
      "spent": false,
      "tx_hash": "&lt;c391089f5b1b02067acc15294e3629a463412af1f1ed0f354113dd4467e4f6c1&gt;",
      "tx_size": 5870
    }]
  }
}
```
D Sal's avatar
D Sal committed
593
594
595

Example (Return "unavailable" transaction. Note that this particular example returns 0 unavailable transactions):

Mike C's avatar
Mike C committed
596
597
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"incoming_transfers","params":{"transfer_type":"unavailable"}}' -H 'Content-Type: application/json'
D Sal's avatar
D Sal committed
598

Mike C's avatar
Mike C committed
599
600
601
602
603
604
605
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}
```
D Sal's avatar
D Sal committed
606

Mike C's avatar
Mike C committed
607
608

### **query_key**
D Sal's avatar
D Sal committed
609
610
611
612
613
614
615
616
617
618
619
620
621

Return the spend or view private key.

Inputs:

* *key_type* - string; Which key to retrieve: "mnemonic" - the mnemonic seed (older wallets do not have one) OR "view_key" - the view key

Outputs:

* *key* - string; The view key will be hex encoded, while the mnemonic will be a string of words.

Example (Query view key):

Mike C's avatar
Mike C committed
622
623
624
625
626
627
628
629
630
631
632
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"query_key","params":{"key_type":"view_key"}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "key": "7e341d..."
  }
}
```
D Sal's avatar
D Sal committed
633
634
635

Example (Query mnemonic key):

Mike C's avatar
Mike C committed
636
637
638
639
640
641
642
643
644
645
646
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"query_key","params":{"key_type":"mnemonic"}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "key": "adapt adapt nostril ..."
  }
}
```
D Sal's avatar
D Sal committed
647
648


Mike C's avatar
Mike C committed
649
### **make_integrated_address**
D Sal's avatar
D Sal committed
650
651
652
653
654
655
656
657
658
659
660
661
662

Make an integrated address from the wallet address and a payment id.

Inputs:

* *payment_id* - string; hex encoded; can be empty, in which case a random payment id is generated

Outputs:

* *integrated_address* - string

Example (Payment ID is empty, use a random ID):

Mike C's avatar
Mike C committed
663
664
665
666
667
668
669
670
671
672
673
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"make_integrated_address","params":{"payment_id":""}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "integrated_address": "4BpEv3WrufwXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CGuJiWFQjhnhhwiH1FsHYGQQ8H2RRJveAtUeiFs6J"
  }
}
```
D Sal's avatar
D Sal committed
674
675


Mike C's avatar
Mike C committed
676
### **split_integrated_address**
D Sal's avatar
D Sal committed
677
678
679
680
681
682
683
684
685
686
687
688
689
690

Retrieve the standard address and payment id corresponding to an integrated address.

Inputs:

* *integrated_address* - string

Outputs:

* *standard_address* - string
* *payment* - string; hex encoded

Example:

Mike C's avatar
Mike C committed
691
692
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"split_integrated_address","params":{"integrated_address": "4BpEv3WrufwXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CGuJiWFQjhnhhwiH1FsHYGQQ8H2RRJveAtUeiFs6J"}}' -H 'Content-Type: application/json'
D Sal's avatar
D Sal committed
693

Mike C's avatar
Mike C committed
694
695
696
697
698
699
700
701
702
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "payment_id": "&lt;420fa29b2d9a49f5&gt;",
    "standard_address": "427ZuEhNJQRXoyJAeEoBaNW56ScQaLXyyQWgxeRL9KgAUhVzkvfiELZV7fCPBuuB2CGuJiWFQjhnhhwiH1FsHYGQGaDsaBA"
  }
}
```
D Sal's avatar
D Sal committed
703

Mike C's avatar
Mike C committed
704
705

### **stop_wallet**
D Sal's avatar
D Sal committed
706
707
708
709
710
711
712
713
714

Stops the wallet, storing the current state.

Inputs: *None*.

Outputs: *None*.

Example:

Mike C's avatar
Mike C committed
715
716
717
718
719
720
721
722
723
724
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"stop_wallet"}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}
```
D Sal's avatar
D Sal committed
725
726


Mike C's avatar
Mike C committed
727
### **make_uri**
D Sal's avatar
D Sal committed
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744

Create a payment URI using the official URI spec.

Inputs:

* *address* - wallet address string
* *amount* (optional) - the integer amount to receive, in **atomic** units
* *payment_id* (optional) - 16 or 64 character hexadecimal payment id string
* *recipient_name* (optional) - string name of the payment recipient
* *tx_description* (optional) - string describing the reason for the tx

Outputs:

* *uri* - a string containing all the payment input information as a properly formatted payment URI

Example:

Mike C's avatar
Mike C committed
745
746
747
748
749
750
751
752
753
754
755
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"make_uri","params":{"address":"44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A","amount":10,"payment_id":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef","tx_description":"Testing out the make_uri function.","recipient_name":"Monero Project donation address"}}'  -H 'Content-Type: application/json'

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": {
    "uri": "monero:44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A?tx_payment_id=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef&tx_amount=0.000000000010&recipient_name=Monero%20Project%20donation%20address&tx_description=Testing%20out%20the%20make_uri%20function."
  }
}
```
D Sal's avatar
D Sal committed
756
757


Mike C's avatar
Mike C committed
758
### **parse_uri**
D Sal's avatar
D Sal committed
759
760
761
762
763
764
765
766
767

Parse a payment URI to get payment information.

Inputs:

* *uri* - a string containing all the payment input information as a properly formatted payment URI

Outputs:

768
* *uri* - JSON object containing payment information:
D Sal's avatar
D Sal committed
769
770
771
772
773
774
775
776
  * *address* - wallet address string
  * *amount* - the decimal amount to receive, in **coin** units (0 if not provided)
  * *payment_id* - 16 or 64 character hexadecimal payment id string (empty if not provided)
  * *recipient_name* - string name of the payment recipient (empty if not provided)
  * *tx_description* - string describing the reason for the tx (empty if not provided)

Example:

Mike C's avatar
Mike C committed
777
778
779
780
781
782
783
784
785
786
787
788
789
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"parse_uri","params":{"uri":"monero:44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A?tx_payment_id=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef&tx_amount=0.000000000010&recipient_name=Monero%20Project%20donation%20address&tx_description=Testing%20out%20the%20make_uri%20function."}}' -H 'Content-Type: application/json'

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": {
    "uri": {
      "address": "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A",
      "amount": 10,
      "payment_id": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
      "recipient_name": "Monero Project donation address",
      "tx_description": "Testing out the make_uri function."
D Sal's avatar
D Sal committed
790
    }
Mike C's avatar
Mike C committed
791
792
793
794
  }
}
```

795

Mike C's avatar
Mike C committed
796
### **rescan_blockchain**
797
798
799
800
801
802
803
804
805

Rescan blockchain from scratch.

Inputs: *None*.

Outputs: *None*.

Example:

Mike C's avatar
Mike C committed
806
807
808
809
810
811
812
813
814
815
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"rescan_blockchain" -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}
```
816

Mike C's avatar
Mike C committed
817
818

### **set_tx_notes**
819

cryptobadger's avatar
cryptobadger committed
820
Set arbitrary string notes for transactions.
821
822
823

Inputs:

cryptobadger's avatar
cryptobadger committed
824
825
* *txids* - array of string; transaction ids
* *notes* - array of string; notes for the transactions
826

cryptobadger's avatar
cryptobadger committed
827
Outputs: *None*.
828
829
830

Example:

Mike C's avatar
Mike C committed
831
832
833
834
835
836
837
838
839
840
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"set_tx_notes","params":{"txids":["6a1a100c079c236e2cbf36f7760e8ef1a9e8357c434aa790a8c78de653ec4cf2"],"notes":["This is an example"]}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
  }
}
```
841

Mike C's avatar
Mike C committed
842
843

### **get_tx_notes**
844

cryptobadger's avatar
cryptobadger committed
845
Get string notes for transactions.
846
847
848

Inputs:

cryptobadger's avatar
cryptobadger committed
849
* *txids* - array of string; transaction ids
850
851
852

Outputs:

cryptobadger's avatar
cryptobadger committed
853
* *notes* - array of string; notes for the transactions
854
855
856

Example:

Mike C's avatar
Mike C committed
857
858
859
860
861
862
863
864
865
866
867
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_tx_notes","params":{"txids":["6a1a100c079c236e2cbf36f7760e8ef1a9e8357c434aa790a8c78de653ec4cf2"]}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "notes": ["This is an example"]
  }
}
```
868

Mike C's avatar
Mike C committed
869
870

### **sign**
871
872
873
874
875
876
877
878
879
880
881
882
883

Sign a string.

Inputs:

* *data* - string;

Outputs:

* *signature* - string;

Example:

Mike C's avatar
Mike C committed
884
885
886
887
888
889
890
891
892
893
894
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"sign","params":{"data":"This is sample data to be signed"}}' -H 'Content-Type: application/json'

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "signature": "SigV1Xp61ZkGguxSCHpkYEVw9eaWfRfSoAf36PCsSCApx4DUrKWHEqM9CdNwjeuhJii6LHDVDFxvTPijFsj3L8NDQp1TV"
  }
}
```
895

Mike C's avatar
Mike C committed
896
897

### **verify**
898

cryptobadger's avatar
cryptobadger committed
899
Verify a signature on a string.
900
901
902
903
904
905
906
907
908
909
910
911
912

Inputs:

* *data* - string;
* *address* - string;
* *signature* - string;

Outputs:

* *good* - boolean;

Example:

Mike C's avatar
Mike C committed
913
914
```
$ curl -X POST http://127.0.0.1:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"verify","params":{"data":"This is sample data to be signed","address":"9sS8eRU2b5ZbN2FPSrpkiab1bjbHE5XtL6Ti6We3Fhw5aQPudRfVVypjgzKDNkxtvTQZSPs122NKggb2mqcqkKSeMNVu59S","signature":"SigV1Xp61ZkGguxSCHpkYEVw9eaWfRfSoAf36PCsSCApx4DUrKWHEqM9CdNwjeuhJii6LHDVDFxvTPijFsj3L8NDQp1TV"}}' -H 'Content-Type: application/json'
915

Mike C's avatar
Mike C committed
916
917
918
919
920
921
922
923
924
925
926
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "good": true
  }
}
```


### **export_key_images**
927
928
929
930
931
932
933
934
935
936
937
938
939

Export a signed set of key images.

Inputs: *None*.

Outputs:

* *signed_key_images* - array of signed key images:
  * *key_image* - string;
  * *signature* - string;

Example:

Mike C's avatar
Mike C committed
940
941
```
$ curl -X POST http://localhost:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"export_key_images"}' -H 'Content-Type: application/json'
942

Mike C's avatar
Mike C committed
943
944
945
946
947
948
949
950
951
952
953
954
955
956
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "signed_key_images": [{
      "key_image": "62b83df78baad99e23b5ad3f667bc6f8d388a13d9e84c7bb6c223a556dfd34af",
      "signature": "b87b7e989aa85aa3a2a7cd8adcb3a848d3512ff718b168e15217ff3e5da29c0183c0328b97cc052fcb5ee3548aa5e41e530ba9d854199ea19d7ddaf6a54a4c0a"
    }]
  }
}
```


### **import_key_images**
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973

Import signed key images list and verify their spent status.

Inputs:

* *signed_key_images* - array of signed key images:
  * *key_image* - string;
  * *signature* - string;

Outputs:

* *height* - unsigned int;
* *spent* - unsigned int;
* *unspent* - unsigned int;

Example:

Mike C's avatar
Mike C committed
974
975
```
$ curl -X POST http://localhost:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"import_key_images", "params":{"signed_key_images":[{"key_image":"63b83df78cafd99e23b5ad3f667bc6f8d38813d9e84c7bb6c223a556dfd34af","signature":"b87b7e989aa86aa2a7a7cd8adcb3a848d3512ff718b168e15217ff3e5da29c0183c0328b97cc052fcb5ee3548aa5e41e530ba9d854199ea19d7ddaf6a54a4c0a"},{"key_image":"44ec12fbc56c533a30b09de8ae26febd515528c4957dfe875430377a7e212b4e","signature":"91105f15be0b25bc2a94bd78a7e261608974d6d888080b9f1815655b98af190340325ea1a0840a5951dacf913d4de1b2bd33ea59c1cb7bce1b6648afa7133d03"}]}}' -H 'Content-Type: application/json'
976

Mike C's avatar
Mike C committed
977
978
979
980
981
982
983
984
985
986
987
988
989
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "height": 986050,
    "spent": 10000100000000,
    "unspent": 4979852760000
  }
}
```


### **get_address_book**
990
991
992
993
994
995
996
997
998
999
1000

Retrieves entries from the address book.

Inputs:

* *entries* - array of unsigned int; indices of the requested address book entries

Outputs:

* *entries* - array of entries:
  * *address* - string;