Monero: Preserve the transaction key of outgoing transactions - #1086
Open
j0ntz wants to merge 1 commit into
Open
Monero: Preserve the transaction key of outgoing transactions#1086j0ntz wants to merge 1 commit into
j0ntz wants to merge 1 commit into
Conversation
2 tasks
Contributor
Author
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
marked this pull request as ready for review
August 12, 2026 02:11
j0ntz
force-pushed
the
jon/monero-tx-key
branch
from
August 12, 2026 02:11
8689506 to
ab17a76
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
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-moneroimplementation settxSecret: result.tx_keyon the transactionmakeSpendreturned. Thereact-native-moneroreplacement does not, andtxSecretis 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 thesaveTxright after the broadcast. The sync path's existingtxSecret: tx.txKeytherefore never reaches disk for a transaction we sent ourselves, because that file already exists by then.Two changes:
broadcastTxreads the transaction key from the native wallet and puts it on the returned transaction. It has to be read there rather than inmakeSpend: 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.emitStoredTxSecretsre-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.broadcastTxnow reads the key from the native pending set after commit and attaches it astxSecret, so the core can persist it on the immediatesaveTx. 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
emitStoredTxSecretspass 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.