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

Adding multisig capabilities to wallet #279

Merged
merged 9 commits into from
Oct 26, 2023

Conversation

biryukovmaxim
Copy link
Collaborator

@biryukovmaxim biryukovmaxim commented Sep 12, 2023

add functionality of creating, importing, exporting multisig wallet

@biryukovmaxim biryukovmaxim marked this pull request as draft September 12, 2023 16:07
@biryukovmaxim biryukovmaxim force-pushed the feat-multisig-wallet branch 3 times, most recently from 5d7c30c to 3c67a9d Compare September 13, 2023 16:01
@biryukovmaxim biryukovmaxim marked this pull request as ready for review September 13, 2023 18:10
@biryukovmaxim biryukovmaxim force-pushed the feat-multisig-wallet branch 4 times, most recently from 7e15a73 to a376602 Compare September 20, 2023 09:47
@biryukovmaxim biryukovmaxim changed the title Feat multisig wallet Adding multisig capabilities to wallet Sep 20, 2023
@biryukovmaxim biryukovmaxim force-pushed the feat-multisig-wallet branch 2 times, most recently from f72cc96 to c75844a Compare October 6, 2023 08:37
Introduced logic for creating MultiSig accounts including multisig account arguments and logic to execute and create a multisig account, and the update of existing variables for multisig accounts. Removed initial warning which stated MultiSig accounts are not supported. Also added a new file for 'as_slice' functionality. This update provides a valuable addition to wallet functionality by allowing multiple signatures for account access, greatly enhancing security.
Updated wallet core and CLI to support the creation of multisig accounts. New error types were added to cater to potential failures during this operation. Added a new 'multisig' account type to the CLI. The functionality to filter accounts based on their private key data was reworked to accommodate multisig accounts. Moreover, logic to create a multisig address was incorporated into the derivation module. The use of multisig addresses also required storage updates and changes in the runtime configuration. Also, the creation wizard in the CLI was updated to include promotional messages regarding multisig addresses.
Errors while getting the manager keys in the wallet derivation module are now properly handled. Instead of a potential panic when a `None` value was encountered, a more error-resilient approach is used. This improves error management and the overall robustness of the key derivation process.
This commit extends the import feature of the wallet by adding support for multi-signature accounts. The updated functionality allows users to import multi-signature wallets using mnemonics and an optional payment password, and adjust the number of required signatures to finalize transactions.
The 'payment_secret' field has been removed from the MultisigCreateArgs structure and all associated logic in wallet.rs and account.rs. This change is made to simplify the account creation process as the 'payment_secret' was optional and it was causing confusion. Now the account creation relies solely on prv_key_data_ids, making the flow more straightforward and user-friendly.
This commit adds the ability to export MultiSig accounts in the Kaspa CLI. Previously, only SingleKey accounts were supported for export.

This update adds conditions to check the kind of account (via the account_kind() method) before proceeding with the export process. For MultiSig accounts, the export_multisig_account function is invoked which retrieves the private key data IDs, asks for the wallet password and prints the required number of signatures and all associated mnemonics. If additional xpub_keys are found, they will also be printed.

This change allows users to backup their MultiSig account data as conveniently as for SingleKey accounts, improving the CLI's functionality. The MultiSig struct has been updated to expose the necessary fields for this feature.
To improve readability and maintainability, MultiSig struct instances creation scattered in different places are now replaced with a new factory method `MultiSig::new()`. Other changes include reduction of redundant struct declaration and removed the Debug trait from the Secret struct.
Copy link
Collaborator

@aspect aspect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I have been following this development, everything looks good. Merging so that we can continue the integration of this codebase against other ongoing work in the wallet.

@aspect aspect merged commit 83f840a into kaspanet:master Oct 26, 2023
smartgoo pushed a commit to smartgoo/rusty-kaspa that referenced this pull request Jun 18, 2024
* Create MultiSig account functionality

Introduced logic for creating MultiSig accounts including multisig account arguments and logic to execute and create a multisig account, and the update of existing variables for multisig accounts. Removed initial warning which stated MultiSig accounts are not supported. Also added a new file for 'as_slice' functionality. This update provides a valuable addition to wallet functionality by allowing multiple signatures for account access, greatly enhancing security.

* "Add multisig account creation support to wallet core and CLI"

Updated wallet core and CLI to support the creation of multisig accounts. New error types were added to cater to potential failures during this operation. Added a new 'multisig' account type to the CLI. The functionality to filter accounts based on their private key data was reworked to accommodate multisig accounts. Moreover, logic to create a multisig address was incorporated into the derivation module. The use of multisig addresses also required storage updates and changes in the runtime configuration. Also, the creation wizard in the CLI was updated to include promotional messages regarding multisig addresses.

* Improve error handling in key derivation

Errors while getting the manager keys in the wallet derivation module are now properly handled. Instead of a potential panic when a `None` value was encountered, a more error-resilient approach is used. This improves error management and the overall robustness of the key derivation process.

* "Add multi-signature account import functionality to wallet"

This commit extends the import feature of the wallet by adding support for multi-signature accounts. The updated functionality allows users to import multi-signature wallets using mnemonics and an optional payment password, and adjust the number of required signatures to finalize transactions.

* Remove payment secret from multi-signature accounts

The 'payment_secret' field has been removed from the MultisigCreateArgs structure and all associated logic in wallet.rs and account.rs. This change is made to simplify the account creation process as the 'payment_secret' was optional and it was causing confusion. Now the account creation relies solely on prv_key_data_ids, making the flow more straightforward and user-friendly.

* "Add support for exporting MultiSig account"

This commit adds the ability to export MultiSig accounts in the Kaspa CLI. Previously, only SingleKey accounts were supported for export.

This update adds conditions to check the kind of account (via the account_kind() method) before proceeding with the export process. For MultiSig accounts, the export_multisig_account function is invoked which retrieves the private key data IDs, asks for the wallet password and prints the required number of signatures and all associated mnemonics. If additional xpub_keys are found, they will also be printed.

This change allows users to backup their MultiSig account data as conveniently as for SingleKey accounts, improving the CLI's functionality. The MultiSig struct has been updated to expose the necessary fields for this feature.

* Refactor MultiSig creation to factory method

To improve readability and maintainability, MultiSig struct instances creation scattered in different places are now replaced with a new factory method `MultiSig::new()`. Other changes include reduction of redundant struct declaration and removed the Debug trait from the Secret struct.

---------

Co-authored-by: aspect <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants