vulpemventures / marina

Liquid Wallet browser extension
MIT License
37 stars 17 forks source link

The user should be able to receive and send Transfer Restricted Assets #233

Open louisinger opened 2 years ago

louisinger commented 2 years ago

Multisig Accounts management

Send

Clicking on Send button should let the user to choose the account to use. If the user wants to send funds using the Multisignature account, Marina will:

  1. create the tx according to (asset, amount) to send and the Multisignature utxos.
  2. partially sign the PSET.
  3. if multi-signature type is 1-of-X, no need to countersign so the user can broadcast directly the tx.
  4. if type is (y-of-X with y > 1), the user can't send the PSET so we just display the PSET base64 (the user should be able to copy paste it).

Receive

Same behavior of "single sig accounts", we just use the pubkeys of cosigners in order to generate addresses.

Settings

@tiero

tiero commented 2 years ago

the Marina provider should handle setAccount. Need some changes in redux state to handle multiple accounts.

Let's not mix the HD BIP44 accounts with user-facing account concept. We are not handing this now

user should be able to add (i.e create or restore) a Multisig account in Marina

I would not go for "generalize" Liquid multisig wallets, but be specific to the "Transfer Restricted Asset" kind of use-case. First because there is not really need for such types of multisig in Liquid (I keep BTC cold on mainchain If I need that or use set of hardware wallets, not a key in a browser extension hot) and also Specter and other dedicated solution and UX are coming.

Therefore, we should strive to get support for 2of2 timelocked script types first and handing the network communication needed with a cosigner server.

tiero commented 2 years ago

Wallet domain

The wallet domain assumes now to always have a single-Sig type of script, when now we need to support also an extra cosigner pub key and timelocked release to configurable address. A nicer way would be to create a dedicate domain for this like "ICosignerWallet" and duplicate the mnemonic or reference it from IWallet eventually.

Pairing

User should be able to opt-in/opt-out from the creation of this Cosigner account, if is a new user there will be in full-screen on-boarding, and if already onboarded, we should handle the migration and expose this option in Settings.

This pairing will consists in sending our own and receiving the xpub from the cosigner server, along with additionally data such as the SIGHASH type configured and the address where the user decides to send funds after the timelock expires.

Receive

When a user chooses a "Transfer restricted assets" from the list, it will get an external address combining our own xpub and the cosigner one.

Balances are checked against these scripts.

Send

When a user chooses a "Transfer restricted assets" from the list, it will select coins for that specific utxos and build and partially sign the transaction. At this point, interactivity with cosigner is needed, to upload the transaction.