Fonta1n3 / FullyNoded

Self sovereign, secure, powerful, easy to use wallet that utilizes your own node as a backend. Powered by PSBT's and descriptors. Acts as an offline signer using your node as a watch-only wallet. C-Lightning compatible for instant, unfairly cheap payments.
https://fullynoded.app
Other
201 stars 31 forks source link

Support for Glacier Protocol? #5

Closed bitcoinhodler closed 5 years ago

bitcoinhodler commented 5 years ago

I'm a user and maintainer of Glacier, a paper wallet system for personal cold storage. Today it uses an online block explorer to find UTXOs but I would like to change that (or fork Glacier) to use a full node and PSBT: Use full node instead of third-party services.

It seems to me that a phone/tablet app would be the best way to achieve this. I would provide the address & redeem script to the app, then let it handle constructing PSBTs for withdrawals. The Glacier quarantined laptops would scan the PSBT from the phone, then sign the transaction. The phone then scans out the signed transaction (or PSBT), decodes it, and transmits it to the network after confirmation.

Would this be an appropriate feature for Fully Noded?

Once such a system is up and running with today's Glacier, it will enable many more features and capabilities, such as HD multisig, for future Glacier revisions.

Fonta1n3 commented 5 years ago

I would be happy to add a "Glacier Withdrawal" feature.

To be clear you can accomplish that without having to add any features to Fully Noded. You would want to:

bitcoinhodler commented 5 years ago

That sounds very useful, though I think the workflow would need some tweaks for Glacier usage:

Another concern that you may not be used to considering is long-term availability. Glacier coins are intended to be stored for lengthy periods, possibly years. The user needs to have confidence that come withdrawal time, the tools will still be available and their coins won't be stuck.

For now this is just exploration, as Glacier would need a lot of work to support PSBTs, but I appreciate your interest and feedback.

Fonta1n3 commented 5 years ago

Is manual UTXO selection required? Seems unnecessary, as Core's walletcreatefundedpsbt can do the UTXO selection for me today. No it is not required, I was just explaining how to do what you described as the app stands, it would be worth trying out, it is not as complex as it sounds and is a nice flow. Using walletcreatefundedpsbt would work but you would still need to call listunspent first to fetch the necessary UTXO's and manually supply them to walletcreatefundedpsbt, what would be ideal is if the user imported their multisig pubkeys first so that there is no need to programmatically fetch the UTXO's and we can simply call walletcreatefundedpsbt and let the node do all the work for us. If user wants 100% coin control then manually selecting UTXO's in the app is ideal.

For now this is just exploration, as Glacier would need a lot of work to support PSBTs, but I appreciate your interest and feedback. As Fully Noded stands you can go to "Transactions" -> "External Wallet" and it allows you to build an unsigned raw transaction from any address (see image), user needs to specify the spending address, receiving address and change address. That would be compatible with Glacier Protocol as it stands unless I am missing something. It is using listunspent to fetch the UTXO's and createrawtransaction

IMG_9503

I would be happy to add the same "External Wallet" functionality for PSBT.

Fonta1n3 commented 5 years ago

Here is an issue I raised in the Glacier repo that is relevant to what you are proposing: https://github.com/GlacierProtocol/GlacierProtocol/issues/74

bitcoinhodler commented 5 years ago

As Fully Noded stands you can go to "Transactions" -> "External Wallet" and it allows you to build an unsigned raw transaction from any address (see image), user needs to specify the spending address, receiving address and change address. That would be compatible with Glacier Protocol as it stands unless I am missing something. It is using listunspent to fetch the UTXO's and createrawtransaction

GlacierScript today cannot accept a raw transaction directly, and it would not be secure to do so. That's one reason that PSBT was created. Glacier needs to verify the amounts on the inputs to be sure that the miner fee is reasonable, and without SegWit (and older Glacier addresses are pre-SegWit) that requires the complete input transaction. The PSBT will include that, but since Glacier predates PSBT, it's designed to accept each input transaction, one by one.

Fonta1n3 commented 5 years ago

You mean it can only accept unsigned raw transactions with one input?

bitcoinhodler commented 5 years ago

No, it does not accept unsigned raw transactions at all. It can accept any number of input transactions, whose UTXOs will then become inputs for the raw transaction constructed by GlacierScript. But in order to be secure, it needs to see the entire transaction that each UTXO comes from.

Fonta1n3 commented 5 years ago

What you are trying to accomplish is 100% working in the app as is. Just import your multisig set up, then go to PSBT's -> toggle on "spend from cold" -> and it will create an unsigned psbt with bip32 derivs from your multisig setup.