keep-network / keep-core

The smart contracts and reference client behind the Keep network
https://keep.network
MIT License
113 stars 72 forks source link

Moving funds SPV proofs #3785

Closed tomaszslabon closed 4 months ago

tomaszslabon commented 5 months ago

Refs: https://github.com/keep-network/keep-core/issues/3735.

This PR adds functionalities for creating and submitting moving funds transaction SPV proofs.

Finding the possible unproven moving funds transactions is done by retrieving MovingFundsCommitmentSubmitted events and looking at the recent transactions of target wallets from each event as well as the wallet public key hash from the event. It's enough to just look at one of the target wallets (e.g. the first one) and retrieve all the transactions that pay to that target wallet. The unproven moving funds transaction must match both the input - it must be the current wallet's main UTXO and all the outputs - they must match the target wallets.

Once the unproven moving funds transactions are found, they are proven.