keep-network / keep-core

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

Moved funds sweep Bitcoin transaction #3790

Closed tomaszslabon closed 6 months ago

tomaszslabon commented 7 months ago

Closes https://github.com/keep-network/keep-core/issues/3737.

This PR introduces the creation of Bitcoin moved funds sweep transaction which allows the target wallet to merge funds moved from the source wallet with the target wallet's main UTXO.

The creation of the Bitcoin moved funds sweep transaction is the responsibility of movedFundsSweepAction which is executed after the moved funds sweep proposal has been prepared.

Executing the movedFundsSweepAction consists of several steps: initial validation of the moved funds sweep proposal against the Ethereum network assembling the moved funds sweep Bitcoin transaction signing the moved funds sweep Bitcoin transaction broadcasting the moved funds sweep Bitcoin transaction The moved funds sweep Bitcoin transaction always consists of one input (the UTXO moved from the source wallet) and optionally the second input (wallet's main UTXO). There is always one output which transfers the funds back to the wallet and becomes the wallet's new main UTXO.