txcreate.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2026 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.txcreate: txcreate and txdo help notes for the MMGen Wallet suite
  12. """
  13. def help(proto, cfg):
  14. outputs_info = (
  15. """
  16. Outputs are specified in the form ADDRESS,AMOUNT or ADDRESS. The first form
  17. creates an output sending the given amount to the given address. The bare
  18. address form designates the given address as either the change output or the
  19. sole output of the transaction (excluding any data output). Exactly one bare
  20. address argument is required.
  21. For convenience, the bare address argument may be given as ADDRTYPE_CODE or
  22. SEED_ID:ADDRTYPE_CODE (see ADDRESS TYPES below). In the first form, the first
  23. unused address of type ADDRTYPE_CODE for each Seed ID in the tracking wallet
  24. will be displayed in a menu, with the user prompted to select one. In the
  25. second form, the user specifies the Seed ID as well, allowing the script to
  26. select the transaction’s change output or single output without prompting.
  27. See EXAMPLES below.
  28. A single DATA_SPEC argument may also be given on the command line to create
  29. an OP_RETURN data output with a zero spend amount. This is the preferred way
  30. to embed data in the blockchain. DATA_SPEC may be of the form "data":DATA
  31. or "hexdata":DATA. In the first form, DATA is a string in your system’s native
  32. encoding, typically UTF-8. In the second, DATA is a hexadecimal string (with
  33. the leading ‘0x’ omitted) encoding the binary data to be embedded. In both
  34. cases, the resulting byte string must not exceed {bl} bytes in length.
  35. """.format(bl=proto.max_op_return_data_len)
  36. if proto.base_proto == 'Bitcoin' else """
  37. The transaction output is specified in the form ADDRESS,AMOUNT.
  38. """)
  39. fee_info = """
  40. If the transaction fee is not specified on the command line (see FEE
  41. SPECIFICATION below), it will be calculated dynamically using network fee
  42. estimation for the default (or user-specified) number of confirmations.
  43. If network fee estimation fails, the user will be prompted for a fee.
  44. Network-estimated fees will be multiplied by the value of --fee-adjust, if
  45. specified.
  46. """ if proto.has_usr_fee else ''
  47. return f"""
  48. The transaction’s output is listed on the command line, while its input
  49. is chosen via an interactive menu.
  50. {outputs_info}{fee_info}""" if proto.base_proto == 'Monero' else f"""
  51. The transaction’s outputs are listed on the command line, while its inputs
  52. are chosen from a list of the wallet’s unspent outputs via an interactive
  53. menu. Alternatively, inputs may be specified using the --inputs option.
  54. Addresses on the command line can be either native coin addresses or MMGen
  55. IDs in the form SEED_ID:ADDRTYPE_CODE:INDEX.
  56. {outputs_info}{fee_info}"""