Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support determining return addresses for a given UTXO #435

Open
coderofstuff opened this issue Mar 13, 2024 · 1 comment
Open

Support determining return addresses for a given UTXO #435

coderofstuff opened this issue Mar 13, 2024 · 1 comment
Assignees

Comments

@coderofstuff
Copy link
Collaborator

coderofstuff commented Mar 13, 2024

Given a new UTXO, support a way to determine the UTXOs that were spent in order to create that UTXO. This is relevant for instance for determining return addresses for a UTXO.

Scenario

  • A client follows the utxo-change events on a specific address he is interested in tracking payments to
  • A utxo arrives (as a result of a newly accepted transaction), the client wants to know what is the sending address

Challenge

The utxo outpoint id can be used to get the recent tx which created it (pending txindex pr #401), but that tx only holds the outpoints of the utxos it spent (which do not include the script-public-key/address info). The full utxo was recently known by the node, but this info seems supposedly lost. Note that the original tx might be old and thus pruned.

Solution

In order to be able to reorg the virtual chain, the node saves a full utxo diff from each chain block to its selected parent block. This means that daa score of the new utxo entry can be used to binary search chain blocks in that area and find the spent utxos contained in their persisted utxo diff structure

@coderofstuff coderofstuff converted this from a draft issue Mar 13, 2024
@coderofstuff coderofstuff changed the title Support determining spent UTXOs given a UTXO Support determining return addresses for a given UTXO Mar 13, 2024
@coderofstuff coderofstuff self-assigned this Mar 15, 2024
@coderofstuff
Copy link
Collaborator Author

As discussed with @aspect this needs to return only a single return address - the first one in the inputs. So response can just be Option<Address>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant