xmrwallet.py 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. #!/usr/bin/env python3
  2. #
  3. # mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
  4. # Copyright (C)2013-2023 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen
  9. # https://gitlab.com/mmgen/mmgen
  10. """
  11. help.xmrwallet: xmrwallet help notes for MMGen suite
  12. """
  13. def help(proto,cfg):
  14. return """
  15. Many operations take an optional ‘wallets’ argument: one or more address
  16. indexes (expressed as a comma-separated list and/or hyphenated range) in
  17. the default or specified key-address file, each corresponding to a Monero
  18. wallet with the same index. If the argument is omitted, all wallets are
  19. operated upon.
  20. All operations except for ‘relay’ require a running Monero daemon (monerod).
  21. Unless --daemon is specified, the daemon is assumed to be listening on
  22. localhost at the default RPC port.
  23. If --tx-relay-daemon is specified, the monerod at HOST:PORT will be used to
  24. relay any created transactions. PROXY_HOST:PROXY_PORT, if specified, may
  25. point to a SOCKS proxy, in which case HOST may be a Tor onion address.
  26. All communications use the RPC protocol via SSL (HTTPS) or Tor. RPC over
  27. plain HTTP is not supported.
  28. SUPPORTED OPERATIONS
  29. create - create wallet for all or specified addresses in key-address file
  30. sync - sync wallet for all or specified addresses in key-address file
  31. list - same as ‘sync’, but also list detailed address info for accounts
  32. label - set a label for an address
  33. new - create a new account in a wallet, or a new address in an account
  34. transfer - transfer specified XMR amount from specified wallet:account to
  35. specified address
  36. sweep - sweep funds in specified wallet:account to new address in same
  37. account or new account in another wallet
  38. relay - relay a transaction from a transaction file created using ‘sweep’
  39. or ‘transfer’ with the --no-relay option
  40. txview - view a transaction file or files created using ‘sweep’ or
  41. ‘transfer’ with the --no-relay option
  42. ‘LABEL’ OPERATION NOTES
  43. This operation takes a LABEL_SPEC arg with the following format:
  44. WALLET:ACCOUNT:ADDRESS,"label text"
  45. where WALLET is a wallet number, ACCOUNT an account index, and ADDRESS an
  46. address index.
  47. ‘NEW’ OPERATION NOTES
  48. This operation takes a NEW_ADDRESS_SPEC arg with the following format:
  49. WALLET[:ACCOUNT][,"label text"]
  50. where WALLET is a wallet number and ACCOUNT an account index. If ACCOUNT is
  51. omitted, a new account will be created in the wallet, otherwise a new address
  52. will be created in the specified account. An optional label text may be
  53. appended to the spec following a comma.
  54. ‘TRANSFER’ OPERATION NOTES
  55. The transfer operation takes a TRANSFER_SPEC arg with the following format:
  56. SOURCE:ACCOUNT:ADDRESS,AMOUNT
  57. where SOURCE is a wallet number; ACCOUNT the source account index; and ADDRESS
  58. and AMOUNT the destination Monero address and XMR amount, respectively.
  59. ‘SWEEP’ OPERATION NOTES
  60. The sweep operation takes a SWEEP_SPEC arg with the following format:
  61. SOURCE:ACCOUNT[,DEST]
  62. where SOURCE and DEST are wallet numbers and ACCOUNT an account index.
  63. If DEST is omitted, a new address will be created in ACCOUNT of SOURCE and
  64. all funds from ACCOUNT of SOURCE will be swept into it.
  65. If DEST is included, all funds from ACCOUNT of SOURCE will be swept into a
  66. newly created account in DEST, or the last existing account, if requested
  67. by the user.
  68. The user is prompted before addresses are created or funds are transferred.
  69. Note that multiple sweep operations may be required to sweep all the funds
  70. in an account.
  71. ‘RELAY’ OPERATION NOTES
  72. By default, transactions are relayed to a monerod running on localhost at the
  73. default RPC port. To relay transactions to a remote or non-default monerod
  74. via optional SOCKS proxy, use the --tx-relay-daemon option described above.
  75. SECURITY WARNING
  76. To avoid exposing your private keys on a network-connected machine, you’re
  77. strongly advised to create all transactions offline using the --no-relay
  78. option. For this, a monerod with a fully synced blockchain must be running
  79. on the offline machine. The resulting transaction files are then sent using
  80. the 'relay' operation.
  81. EXAMPLES
  82. Generate an XMR key-address file with 5 addresses from your default wallet:
  83. $ mmgen-keygen --coin=xmr 1-5
  84. Create 3 Monero wallets from the key-address file:
  85. $ mmgen-xmrwallet create *.akeys.mmenc 1-3
  86. After updating the blockchain, sync wallets 1 and 2:
  87. $ mmgen-xmrwallet sync *.akeys.mmenc 1,2
  88. Sweep all funds from account #0 of wallet 1 to a new address:
  89. $ mmgen-xmrwallet sweep *.akeys.mmenc 1:0
  90. Same as above, but use a TX relay on the Tor network:
  91. $ mmgen-xmrwallet --tx-relay-daemon=abcdefghijklmnop.onion:127.0.0.1:9050 sweep *.akeys.mmenc 1:0
  92. Sweep all funds from account #0 of wallet 1 to wallet 2:
  93. $ mmgen-xmrwallet sweep *.akeys.mmenc 1:0,2
  94. Send 0.1 XMR from account #0 of wallet 2 to an external address:
  95. $ mmgen-xmrwallet transfer *.akeys.mmenc 2:0:<monero address>,0.1
  96. Sweep all funds from account #0 of wallet 2 to a new address, saving the
  97. transaction to a file:
  98. $ mmgen-xmrwallet --no-relay sweep *.akeys.mmenc 2:0
  99. Relay the created sweep transaction via a host on the Tor network:
  100. $ mmgen-xmrwallet --tx-relay-daemon=abcdefghijklmnop.onion:127.0.0.1:9050 relay *XMR*.sigtx
  101. Create a new account in wallet 2:
  102. $ mmgen-xmrwallet new *.akeys.mmenc 2
  103. Create a new address in account 1 of wallet 2, with label:
  104. $ mmgen-xmrwallet new *.akeys.mmenc 2:1,"from ABC exchange"
  105. View all the XMR transaction files in the current directory, sending output
  106. to pager:
  107. $ mmgen-xmrwallet --pager txview *XMR*.sigtx
  108. """.strip()