swaptxcreate.py 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2025 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-wallet
  9. # https://gitlab.com/mmgen/mmgen-wallet
  10. """
  11. help.swaptxcreate: swaptxcreate and swaptxdo help notes for the MMGen Wallet suite
  12. """
  13. def help(proto, cfg):
  14. return """
  15. This script is similar in operation to ‘mmgen-txcreate’, only with additional
  16. steps. Users are advised to first familiarize themselves with the use of that
  17. script before attempting to perform a swap with this one.
  18. The tracking wallets of both the send and receive coins must be available when
  19. the script is invoked. If the two coin daemons are running on different hosts
  20. than the script, or with non-standard ports, coin-specific RPC options may be
  21. required (see EXAMPLES below).
  22. The swap protocol’s quote server on the Internet must be reachable either
  23. directly or via the SOCKS5 proxy specified with the --proxy option. To improve
  24. privacy, it’s recommended to proxy requests to the quote server via Tor or
  25. some other anonymity network.
  26. The resulting transaction file is saved, signed, sent, and optionally bumped,
  27. exactly the same way as one created with ‘mmgen-txcreate’. Autosign with
  28. automount is likewise supported via the --autosign option.
  29. The command line must contain at minimum a send coin (COIN1) and receive coin
  30. (COIN2) symbol. Currently supported coins are BTC, LTC and BCH. All other
  31. arguments are optional. If AMT is specified, the specified value of send coin
  32. will be swapped and the rest returned to a change address in the originating
  33. tracking wallet. Otherwise, the entire value of the interactively selected
  34. inputs will be swapped.
  35. By default, the change and destination addresses are chosen automatically by
  36. finding the lowest-indexed unused addresses of the preferred address types in
  37. the send and receive tracking wallets. Types ‘B’, ‘S’ and ‘C’ (see ADDRESS
  38. TYPES below) are searched in that order for unused addresses.
  39. If the wallet contains eligible unused addresses with multiple Seed IDs, the
  40. user will be presented with a list of the lowest-indexed addresses of
  41. preferred type for each Seed ID and prompted to choose from among them.
  42. Change and destination addresses may also be specified manually with the
  43. CHG_ADDR and ADDR arguments. These may be given as full MMGen IDs or in the
  44. form ADDRTYPE_CODE or SEED_ID:ADDRTYPE_CODE (see EXAMPLES below and the
  45. ‘mmgen-txcreate’ help screen for details).
  46. While discouraged, sending change or swapping to non-wallet addresses is also
  47. supported, in which case the signing script (‘mmgen-txsign’ or ‘mmgen-
  48. autosign’, as applicable) must be invoked with the --allow-non-wallet-swap
  49. option.
  50. Rather than specifying a transaction fee on the command line, it’s advisable
  51. to start with the fee suggested by the swap protocol quote server (the script
  52. does this automatically) and then adjust the fee interactively if desired.
  53. When choosing a fee, bear in mind that the longer the transaction remains
  54. unconfirmed, the greater the risk that the vault address will expire, leading
  55. to loss of funds. It’s therefore advisable to learn how to create, sign and
  56. send replacement transactions with ‘mmgen-txbump’ before performing a swap
  57. with this script. When bumping a stuck swap transaction, the safest option
  58. is to create a replacement transaction with one output that returns funds back
  59. to the originating tracking wallet, thus aborting the swap, rather than one
  60. that merely increases the fee (see EXAMPLES below).
  61. Before broadcasting the transaction, it’s advisable to double-check the vault
  62. address on a block explorer such as thorchain.net or runescan.io.
  63. The MMGen Node Tools suite contains two useful tools to help with fine-tuning
  64. transaction fees, ‘mmnode-feeview’ and ‘mmnode-blocks-info’, in addition to
  65. ‘mmnode-ticker’, which can be used to calculate the current cross-rate between
  66. the asset pair of a swap, as well as the total receive value in terms of the
  67. send value.
  68. """