Commit graph

3,029 commits

Author SHA1 Message Date
d9e2449429
tx: allow zero send amount for deposit transactions (bugfix)
Fixes a critical bug whereby the memoless registration transaction spent all the
RUNE in the account.

Note that memoless swaps are enabled in the test suite only, so the bug could
not have led to loss of user funds.

As an added safeguard, the patch also disables zero send amounts for non-deposit
transactions.
2026-10-15 09:35:53 +00:00
08376aba3f
mmgen-regtest: set --bdb-wallet according to coin 2026-10-15 09:35:53 +00:00
e3b02b7098
test/cmdtest.py xmr_autosign: alice -> user 2026-10-15 09:35:53 +00:00
c7980fb553
minor changes, fixes and cleanups 2026-10-15 09:35:52 +00:00
f7e6904d6d
help, tool, tx.base_swap: remove swap-proto-dependent code 2026-10-15 09:35:52 +00:00
c29fd6a828
tx.info: improve header display for memoless swap transactions 2026-10-15 09:35:47 +00:00
ffe488ffbd
THORChain memoless swaps
Memoless swaps permit coins with long addresses and/or restricted memo space,
such as Monero, for example, to be swapped on THORChain.  They introduce added
complexity, along with certain privacy and security tradeoffs, so should only
be used for assets that cannot be swapped the usual way.

A reference request transaction (a.k.a. registration transaction) containing
the memo is sent to the THORChain network, which assigns it a number.  This
number is then encoded in the send amount of the swap transaction in lieu of
a memo.

See https://dev.thorchain.org/swap-guide/memoless-swaps.html for technical
details.

While this patch fully implements the feature in MMGen Wallet, it’s disabled
on mainnet for the time being.  Mainnet will be enabled after memoless swaps
are unhalted on THORChain mainnet and the feature can undergo live testing.

The following example is provided for purposes of illustration only. Normally
we would swap LTC to BCH the standard way.

Sample LTC-to-BCH memoless swap workflow (assumes --autosign):

    # Create the reference request transaction (pass 1):
    $ mmgen-swaptxcreate --memoless LTC 1.2345 BCH

    # Autosign the reference request transaction and send it:
    $ mmgen-txsend
    => TxID

    # Get the reference number from the THORChain network:
    $ mmgen-remote --coin=rune get_refnum TxID
    => REFNUM

    # Create the swap transaction (pass 2):
    $ mmgen-swaptxcreate --refnum=REFNUM LTC 1.2345 BCH

    # Sign and send the swap transaction:
    $ mmgen-txsend

    # Monitor your BCH wallet for the funds:
    $ mmgen-tool --coin=bch twview

Testing/demo:

    $ test/cmdtest.py -e swap.memoless

Note that the real send amount is the amount specified in the second invocation
of ‘mmgen-swaptxcreate’ (i.e. the swap transaction or second pass).  If you
omit the --trade-limit option, the amounts in the two invocations can differ,
otherwise amount and trade limit must be identical for both invocations.

Before sending, the software checks that the provided reference number is valid
and points to an address in the user’s tracking wallet.  Thus funds cannot be
sent to the wrong destination as a result of user error.

References remain valid for approximately six hours.  Before sending, the
software checks that the reference is valid, but not whether it is close to
expiration.  If the reference later expires before the swap transaction is
confirmed, there’s a danger of funds loss.  Therefore, it’s recommended to
create and broadcast the swap transaction without delay.  If necessary, the
transaction can be bumped to ensure timely confirmation.

In order to create and send the reference request transaction, the user must
have some RUNE in their wallet.  The current cost per transaction is 0.2 RUNE.

Also be aware of the privacy implications.  Swaps can easily be correlated if
their registration transactions spend from the same RUNE address, or from RUNE
addresses that can be linked via chain analysis.

More complete documentation will be provided at a later date.
2026-10-12 10:04:48 +00:00
9ad34f5001
various changes and cleanups 2026-10-12 10:04:48 +00:00
5d3ac1d99d
new BaseSwapMethods class 2026-10-12 10:04:48 +00:00
fcb5924fe8
SwapAsset: new sanitize_input param 2026-10-12 10:04:48 +00:00
226995cfc7
tx.new_swap, tx.base, ThornodeRPCServer: minor fixes and cleanups 2026-10-12 10:04:48 +00:00
8da39e9c9e
tx.new: convert amount to CoinAmt after parsing 2026-10-12 10:04:48 +00:00
00781a3554
Thornode -> ThornodeQuote 2026-10-12 10:04:47 +00:00
048e2e7505
main_txcreate: cleanups 2026-10-12 10:04:42 +00:00
13623ed9e5
mmgen-swaptxcreate: add --quote option
Display a swap quote and exit without creating a transaction.

All data is from the remote endpoint — no running daemons are required.
2026-10-08 13:12:03 +00:00
da989ccf8b
NewSwap: new display_quote() method 2026-10-08 13:12:03 +00:00
cef8ed21e1
Thornode: new trade_limit property 2026-10-08 13:12:03 +00:00
549751e59c
NewSwap: minor fixes, cleanups, renames 2026-10-08 13:11:58 +00:00
4fa8e32400
mmgen-remote: new quote command 2026-10-07 16:40:39 +00:00
8e75f9f23d
Thornode.get_quote(): get data via remote RPC interface 2026-10-07 16:40:39 +00:00
3b1839c734
rpc: new get_remote_rpc() function 2026-10-07 16:40:39 +00:00
2c4f96e6a4
cfg, opt: improve parsing of regtest opts 2026-10-07 16:40:39 +00:00
f558e4ec21
minor fixes, cleanups, renames 2026-10-07 16:40:39 +00:00
0dd511bafc
whitespace 2026-10-07 16:40:39 +00:00
1356325bf4
init_proto(): remove testnet and regtest params 2026-10-07 16:40:39 +00:00
99b9081640
mmgen-swaptxcreate: check network before creating and sending TX 2026-10-07 16:40:39 +00:00
235c91bf7c
ThornodeServer: new setvar method 2026-10-07 16:40:38 +00:00
d5b4e94676
cmdtest.py remote: add mimir test 2026-10-07 16:40:38 +00:00
dba333306d
whitespace, variable renames 2026-10-07 16:40:33 +00:00
abcb40a74f
remove shebangs and exec perms from mods where applicable (392 files) 2026-10-05 14:30:06 +00:00
1057012524
remove empty __init__ mods 2026-10-05 14:30:06 +00:00
00407d0b5b
extended Monero MMGenID: use / as initial separator 2026-10-05 14:30:05 +00:00
3d8fbca67e
TwAddresses.get_change_address(): support full-list matching 2026-10-05 14:30:05 +00:00
527fedd7d5
TwAddresses: clean up bisect func, move to algo mod, add key-getting funcs 2026-10-05 14:30:05 +00:00
1422e89eaf
TwAddresses.get_change_address(): remove one indentation level 2026-10-05 14:30:05 +00:00
c61d120d94
tw.addresses: add autochg_ignore_labels attr 2026-10-05 14:30:05 +00:00
82f1756413
tx.new: add label to autoselect prompt if present 2026-10-05 14:30:05 +00:00
b2ff67b36c
minor cleanups, variable renames, whitespace 2026-10-05 14:30:05 +00:00
3d435165a7
cfg: restore exec_wrapper and devtools config vars 2026-10-05 14:30:05 +00:00
7fc70f725a
cmdtest.py remote: cleanups, add log test 2026-10-05 14:30:00 +00:00
8a23f9867f
new mmgen-remote utility
Command invocation syntax is the same as for the `mmgen-tool` utility.

Currently, only THORChain public endpoints are supported

Help:

    $ mmgen-remote --coin=rune --help

Sample invocation:

    $ mmgen-remote --log --proxy=localhost:9050 --coin=rune lastblock coin=btc

Testing:

    $ test/cmdtest.py -e remote
2026-10-02 10:02:32 +00:00
bc03ffc69e
ui: new colorize_json() func 2026-10-02 10:02:32 +00:00
55dfcb8f8d
minor fixes and cleanups 2026-10-02 10:02:32 +00:00
2c6473ec3d
http: new RemoteJSONClient class 2026-10-02 10:02:32 +00:00
68d1d2e812
cmdtest_d.swap: new start_thornode_servers() method 2026-10-02 10:02:32 +00:00
a94ddb5f01
function/method renames 2026-10-02 10:02:27 +00:00
4e825a58ef
proto.rune.tx.protobuf: replace build_swap_tx() function 2026-09-29 09:23:31 +00:00
384384c260
rune: support user-specified transaction fees 2026-09-29 09:23:31 +00:00
dc7f256270
protocol: set type of max_tx_fee after it’s set from cfg file 2026-09-29 09:23:31 +00:00
2ad20df8ad
rune_swap_tx_parms: add synth, trade, secured dfl fields 2026-09-29 09:23:31 +00:00