Skip to content

Commit

Permalink
Merge pull request #1346 from ndeet/psbt-signing
Browse files Browse the repository at this point in the history
Adding docs for PSBT signing with Sparrow wallet and BitBox02.
  • Loading branch information
pavlenex authored Nov 13, 2023
2 parents 11b6134 + 0a73a2c commit 75e4160
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 3 deletions.
9 changes: 9 additions & 0 deletions docs/FAQ/Wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ In the future they may become unified but for the time being, to manage your Lig

## Is there a mobile app for BTCPay Server wallet?

:::tip
Update 11/2023:
There will be a mobile app for BTCPay Server wallet in the future. [It is currently in development](https://twitter.com/BtcpayServer/status/1699114457421447543).
:::

BTCPay Server is a web app (not a mobile app) and may be viewed using any device that can display a web browser. There are mobile apps which allow you to connect to your BTCPay Server Lightning node (Zeus, Zap, etc.).

You can also use mobile apps to connect to your Bitcoin full node using either P2P or RPC. If you are on iOS you can easily connect to your Bitcoin full node using Fully Noded.
Expand All @@ -150,3 +155,7 @@ To connect your BTCPay node to Fully Noded:
Here are some node statuses and network information you can easily monitor from your Fully Noded:

![Fully Noded](../img/FullyNoded.png)

## How can I use PSBT (partially signed bitcoin transactions) with BTCPay Server?

You can use BTCPay Server to create and/or broadcast PSBT. Check our guides to [Sign a PSBT transaction with ColdCard hardware wallet](./ColdCardWallet.md#spending-from-btcpay-server-wallet-with-coldcard-psbt) and [create and sign a PSBT transaction with Sparrow wallet](./Sign-PSBT-with-sparrow-wallet.md).
85 changes: 85 additions & 0 deletions docs/Sign-PSBT-with-sparrow-wallet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Creating a PSBT with BTCPay Server and Sparrow wallet

This guide explains how you can create a partially signed bitcoin transaction (PSBT) on BTCPay Server and sign and broadcast it with [Sparrow wallet](https://www.sparrowwallet.com/). We use [BitBox02](https://bitbox.swiss/) hardware wallet in this example, but it will work with any other supported hardware wallet. This can be useful if you have an airgapped setup or persons creating the transaction and signing it are different people.

[[toc]]

## 1. Creating a transaction (on BTCPay Server):

* Log into your BTCPay Server and select the store you want to send from
* Under "Wallets" select "Bitcoin"
* Click on button **[Send]**

### On send screen:

![BTCPay: Create transaction on BTCPay Server](./img/psbt-send-sparrow/btcpay-1-send.png "Create a transaction")

* Enter the destination bitcoin address
* Enter the amount
* Optional: Change fee rate (get the current fee rate on [mempool.space](https://mempool.space) depending on how fast you want the transaction to be confirmed)
* **Important**: click on "Advanced Settings" so it expands and check "**Always include non-witness UTXO if available**" (this is needed so hardware wallets like BitBox02 can sign the transaction)
* Optional: on "Allow fee increase (RBF)", set to "Yes" (this is useful if you select a too low fee you can bump the fee so your transaction is not stuck and get’s confirmed)
* Click **[Sign transaction]** button

### On choosing signing method screen:

![BTCPay: Choose signing method: Partially Signed Bitcoin Transaction](./img/psbt-send-sparrow/btcpay-2-choose-signing-method.png "Select Partially Signed Bitcoin Transaction")

* Select "Partially Signed Bitcoin Transaction"

### On PSBT screen:

![BTCPay: Download the PSBT file](./img/psbt-send-sparrow/btcpay-3-download-psbt.png "PSBT screen overview, download PSBT")

* Open the accordion of "Export PSBT for signing" click on button **[Download PSBT file]**
* Store the file on hard-drive (you can use it to sign the PSBT yourself, or you can send it to somebody doing the signing on Sparrow wallet, see below); e.g. psbt-export.psbt


## 2. Signing and sending the PSBT (on Sparrow wallet)

* Open your Sparrow wallet app and corresponding wallet holding the data for the xPub used in your store
* Next, import the PSBT file you created on BTCPay Server
* In menu: File -> Open Transaction -> File...
* Select the file you stored (or got sent from accounting) e.g. psbt-export.psbt

### On showing the imported PSBT transaction:

![Sparrow wallet: Load the PSBT file](./img/psbt-send-sparrow/sparrow-1-loaded-psbt-for-signing.png "Loaded PSBT for signing")

* Make sure under headline "Signatures:" the "signing wallet" matches the wallet you want to sent from
* Click on **[Finalize Transaction for Signing]**

### Signing the transaction:

![Sparrow wallet: PSBT loaded, ready for signing](./img/psbt-send-sparrow/sparrow-2-loaded-psbt-sign.png)

* Click on **[Sign]**

### Connect Hardware wallet popup:

![Sparrow wallet: connect to hardware wallet (e.g. in our case BitBox02)](./img/psbt-send-sparrow/sparrow-3-scan-for-hww.png "Connect your hardware wallet")

* Plug-in your hardware wallet (BitBox02 in our case)
* Enter your hardware wallet pin (for BitBox02 it shows on screen open BitBox app but you do not need to, wait until you can enter the pin)
* After BitBox02 unlocked, click **[Scan...]**, your hardware wallet will show up

### Wallet connected successfully:

![Sparrow wallet: hardware wallet successfully connected](./img/psbt-send-sparrow/sparrow-4-unlocked-hww.png "BitBox02 successfully connected")

* Click **[Sign]**
* A summary of the transaction will be shown on the BitBox02 device, you need to confirm it there

### Broadcasting the transaction:

![Sparrow wallet: broadcast the transaction](./img/psbt-send-sparrow/sparrow-5-broadcast-transaction.png "Broadcast the transaction")

* After signing was successful you need to broadcast the transaction to the Bitcoin network
* Click **[Broadcast Transaction]**

:::tip
Alternatively, instead of broadcasting the transaction from Sparrow wallet (e.g. if you have an airgapped setup) you could also copy and paste the signed transaction PSBT from the textbox and upload it to your BTCPay Server and let it broadcast the transaction to the network.
:::

**Congrats, done!**

6 changes: 4 additions & 2 deletions docs/Wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ If you set up an [existing wallet with your BTCPay Server](./WalletSetup.md#use-

##### Signing with a wallet supporting PSBT

PSBT (**Partially Signed Bitcoin transactions**) is an interchange format for Bitcoin transactions that are not fully signed yet.
PSBT (**Partially Signed Bitcoin Transactions**) is an interchange format for Bitcoin transactions that are not fully signed yet.
PSBT is supported in BTCPay Server and can be signed with compatible hardware and software wallets.

The construction of a fully signed Bitcoin transaction goes through the following steps:
Expand All @@ -71,7 +71,9 @@ The construction of a fully signed Bitcoin transaction goes through the followin
- BTCPay Server produces the final Bitcoin transaction
- You verify the result and broadcast it to the network

Check this tutorial on how to [sign a PSBT transaction with ColdCard Hardware Wallet](./ColdCardWallet.md#spending-from-btcpay-server-wallet-with-coldcard-psbt), completely offline/air-gapped.
Tutorials:
- [Sign a PSBT transaction with ColdCard Hardware Wallet](./ColdCardWallet.md#spending-from-btcpay-server-wallet-with-coldcard-psbt) (completely offline/air-gapped)
- [Create and sign a PSBT transaction with Sparrow wallet](./Sign-PSBT-with-sparrow-wallet.md)

##### Signing with a hardware wallet

Expand Down
2 changes: 1 addition & 1 deletion docs/WooCommerce.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ You can either click on the notifications link saying "**please configure the pl
### 2.1 Connect using the API key wizard (recommended)

1. In the field "**BTCPay Server URL**", enter the full URL of your host (including the https) – https://btcpay.mydomain.com
2. Click on the link below the "**BTCPay Api Key**" field that says "\*_click here to generate API keys_" (you will be redirected to BTCPay Server "Authorization request" page.
2. Click on the button [Generate API key] (you will be redirected to BTCPay Server "Authorization request" page.
![BTCPay WordPress V2: Link to BTCPay Settings](./img/woocommerce/btcpay-wc-2--03-settings--api-key-redirect.png)

3. If you are not logged in to your BTCPay Server instance, do so now. (optional)
Expand Down
Binary file added docs/img/psbt-send-sparrow/btcpay-1-send.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 75e4160

Please sign in to comment.