Skip to content

Monero: Preserve the transaction key of outgoing transactions - #1086

Open
j0ntz wants to merge 1 commit into
masterfrom
jon/monero-tx-key
Open

Monero: Preserve the transaction key of outgoing transactions#1086
j0ntz wants to merge 1 commit into
masterfrom
jon/monero-tx-key

Conversation

@j0ntz

@j0ntz j0ntz commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

Outgoing Monero transactions have shown an empty Transaction Key since Edge 4.49.0, so senders cannot prove a payment. At least one user has been stuck on a swap because of it.

The old edge-currency-monero implementation set txSecret: result.tx_key on the transaction makeSpend returned. The react-native-monero replacement does not, and txSecret is the only thing the core stores the key from: it writes the key into the transaction's metadata file the first time it sees the transaction, which for our own sends is the saveTx right after the broadcast. The sync path's existing txSecret: tx.txKey therefore never reaches disk for a transaction we sent ourselves, because that file already exists by then.

Two changes:

  • broadcastTx reads the transaction key from the native wallet and puts it on the returned transaction. It has to be read there rather than in makeSpend: the native wallet only records the key once the transaction is committed. A key we cannot read is not worth failing an already-broadcast payment over, so a failure logs and reports no key.
  • emitStoredTxSecrets re-reports stored transactions that carry a key, once per engine session, so the core can save a key it never stored. That covers sends made while the send path was reporting none, on any device whose Monero wallet cache still holds the key. It uses a session flag rather than a stored migration flag, so it does not depend on which package publishes first, and it is a no-op for a transaction whose key the core already has.

The core-side half, which saves a secret onto a metadata file that already exists, is EdgeApp/edge-core-js#735.

A key that was never persisted anywhere is gone for good: Monero picks the transaction key at random while building the transaction (device_default::open_tx), so it cannot be regenerated from the seed.

Asana: https://app.asana.com/0/1215088146871429/1216965258637021


Note

Medium Risk
Touches the Monero broadcast path and transaction-secret reporting used as payment proof. Broadcast still succeeds if the key cannot be read, limiting fund-movement risk.

Overview
Restores Monero transaction keys (the sender's only proof of payment) that were dropped after the move to react-native-monero.

broadcastTx now reads the key from the native pending set after commit and attaches it as txSecret, so the core can persist it on the immediate saveTx. Failures to read the key are logged and return no secret rather than failing an already-broadcast payment.

Also adds a one-time-per-session emitStoredTxSecrets pass that re-reports stored txs that already carry a key, so the core can backfill secrets for sends made while the send path reported none.

Reviewed by Cursor Bugbot for commit ab17a76. Bugbot is set up for automated code reviews on this repo. Configure here.

@j0ntz

j0ntz commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

📸 Test evidence

xmr send ready

xmr send ready

xmr transaction key

xmr transaction key

Captured by the agent's in-app test run (build-and-test).

The transaction key proves a payment, and Monero picks it at random while
building the transaction, so only the sending wallet ever holds it. Read it
from the native wallet right after the broadcast and put it on the returned
transaction, which is what the core saves.

Transactions sent before this reported no key, and the core only stores a
key the first time it sees a transaction, so re-report the stored
transactions that do have one, once per session, to give the core a chance
to save the keys it missed.
@j0ntz
j0ntz marked this pull request as ready for review August 12, 2026 02:11
@j0ntz
j0ntz force-pushed the jon/monero-tx-key branch from 8689506 to ab17a76 Compare August 12, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant