stratisproject / StratisBitcoinFullNode

Bitcoin full node in C#
https://stratisplatform.com
MIT License
783 stars 315 forks source link

Create funds recovery tx #4189

Closed quantumagi closed 3 years ago

quantumagi commented 4 years ago

This tool fits into step 4 of the following overall process related to changing a federation's multisig members.

The order of these steps are important:

1. Notify all parties and update documentation etc. Decide when to update wallet UI.
2. Ensure both sides haven't seen any transfers within maxreorg blocks.
3. STOP the UP-TO-DATE old federation nodes and BACK-UP the data folders.
4. Collect signatures and generate the sidechain and mainchain funds-recovery transactions (will provide this tool. The tool will run against the backed up data folder.)
then IF SUCCESSFUL in generating the funds-recovery transaction:
5. Move all new-federation wallet nodes to the new address.
6. Move all funds to new addresses using the funds-recovery transactions.
7. Revert anything sent erroneously to old wallet? (a future tool). Will require collecting signature again.
else IF UNSUCCESSFUL:
8. Restore the backup, if necessary, and restart the old federation, then back to step 1.
fassadlr commented 3 years ago

@quantumagi how are you able to prove that this works?

quantumagi commented 3 years ago

@fassadlr , if you guys are happy with the basic approach I can submit the generated transaction to the test network and see if the funds get transferred. Alteratively, for now, you may want to comment on the layout of the transaction - e.g. multiple inputs to a single output. We may want to map many inputs to the same number of outputs instead.

quantumagi commented 3 years ago

The methodology for testing this will be to run a federation consisting of 3 federation members - i.e. 3 sidechain daemons and 3 mainchain daemons. Will run this on testnet with a local cirrus chain. Once this is fully synced I will stop the federation, backup the data folder and create a funds recovery transaction using this tool. Next step will be to reconfigure the federation with the new address (consisting of 2 members and requiring both signatures) and then submit the funds recovery transaction via the API.

quantumagi commented 3 years ago

Ran tool for gateway1: image Copied generated files to 2nd gateway2 then: image Recovery files generated: image

quantumagi commented 3 years ago

Before submitting the funds-recovery transaction for StratisTest: image

quantumagi commented 3 years ago

image

quantumagi commented 3 years ago

image

quantumagi commented 3 years ago

image

image

quantumagi commented 3 years ago

image image image image

quantumagi commented 3 years ago

Tested successfully!

codingupastorm commented 3 years ago

If we've tested on the testnet then it looks good to me.