<p>Yes, once the PSBT is finalized you can extract a fully-signed raw transaction from it (using the <code>finalizepsbt</code> RPC). As your PSBT does not have signatures yet, there is no point in constructing an actual transaction from it yet.</p>

CC BY-SA 4.0
2020-12-07T21:00:50.400Z
I see, so:
a) Using the CLI how would you sign the PSBT transaction with a key not in the wallet as *signrawtransactionwithkey* takes a raw (not PSBT) transaction as an argument?
b) Is *finalizepsbt* the only way in the RPC to convert from PSBT to raw transaction?
Amit
CC BY-SA 4.0
2020-12-07T21:23:18.723Z
You either use a raw transaction workflow or a PSBT workflow. Mixing them is bound to cause problems. PSBT signing will generally involve `walletprocesspsbt`, or using something like the HWI project to sign using hardware wallets.
Pieter Wuille
CC BY-SA 4.0
2020-12-07T21:26:23.473Z
Perhaps part of the confusion is that raw transactions serve two distinct purposes: an unsigned form that you pass around while gathering signatures, and a fully-signed form that can be broadcast on the network. PSBT wholly replaces the first one, but not the second. In PSBT you'd use RPCs like `createpsbt`, `walletcreatefundedpsbt`, `utxoupdatepsbt`, `walletprocesspsbt`, `combinepsbt`, `finalizepsbt`. Only after the last of those do you have a (signed) raw transaction.
Pieter Wuille
CC BY-SA 4.0
2020-12-07T21:27:39.000Z
You *can* still use raw transaction RPCs, and then convert to PSBT using `converttopsbt` but that's just for compatibility with (the very first step) of a raw-transaction based workflow.
Pieter Wuille
CC BY-SA 4.0
2020-12-07T21:28:28.643Z
Bitcoin Core currently has no RPC to sign PSBT using a key not in a wallet.
Pieter Wuille
CC BY-SA 4.0
2020-12-07T20:30:30.210Z
2020-12-07T20:36:42.600Z
2020-12-07T20:36:42.600Z
Pieter Wuille
<p>Bitcoin Core's CLI has a <a href="https://developer.bitcoin.org/reference/rpc/converttopsbt.html" rel="nofollow noreferrer"><em>converttopsbt</em></a> command used to convert from raw transaction to PSBT transaction but how is it possible to convert <strong>from PSBT transaction to raw transaction</strong> using Bitcoin Core (or if not possible using another client like Electrum)?</p>
<p>Example of a PSBT transaction (testnet):</p>
<blockquote>
<p>cHNidP8BAHECAAAAAW4TCBaK74DxafvrRdWpF32Gg5eVRs1DJX9YHz2v9jduAQAAAAD9////AugDAAAAAAAAFgAUlZYmgEZt2xztxXvON/MpazPDg7h4fAEAAAAAABYAFAos5SNG8ZD0bYuTY1T3lwWbt6XcC+8cAAABAN4CAAAAAAEBtxgls3RExZgey5D+Apcb7GIFdINeRlmY05VOQwZ7LtoBAAAAAP3///8CCgAAAAAAAAAWABSdRgMHmJrQiGsOWa+Ue5R6hDsGJlCBAQAAAAAAFgAUgIISApOAGqWF1K6dU+ANtN8F53kCRzBEAiAL3rtr0r5eB/U3HFRFKEWCJ/MuHEIetMi/5W/Pdw2tOAIgNSY0WkLk1lDHFxJIYgISnlr/0ZZu6YNExTLAGmgoca4BIQNc7DqYfFYpf3ejWJHMoMS+SGNnQh+QcpG8DXyPT1mnHgPvHAAiBgIDWK/NdMjNwkMIwK+D39jKrQQdd8QVK/Kmur/hQm0ACQy0x7YSAQAAAAEAAAAAIgICoL287OJyWbD9uT1ATxNQaD9VqKoAKdvQ6mRatmnd5zMMtMe2EgAAAAABAAAAACICAkaw3TsIUUYODFTLGB5brpjvHFDF7dG63Mg9m/KFHmMzDLTHthIBAAAAAgAAAAA=</p>
</blockquote>

<bitcoin-core><client><raw-transaction><bitcoin-cli><bip174-psbt>
How to convert PSBT transaction (base64) to raw/serialized (hex) transaction?
Amit
# How to convert PSBT transaction (base64) to raw/serialized (hex) transaction?

(Asked by: username_0 on 2020-12-07)

Bitcoin Core's CLI has a [*converttopsbt*](https://developer.bitcoin.org/reference/rpc/converttopsbt.html) command used to convert from raw transaction to PSBT transaction but how is it possible to convert **from PSBT transaction to raw transaction** using Bitcoin Core (or if not possible using another client like Electrum)?

Example of a PSBT transaction (testnet):

> cHNidP8BAHECAAAAAW4TCBaK74DxafvrRdWpF32Gg5eVRs1DJX9YHz2v9jduAQAAAAD9////AugDAAAAAAAAFgAUlZYmgEZt2xztxXvON/MpazPDg7h4fAEAAAAAABYAFAos5SNG8ZD0bYuTY1T3lwWbt6XcC+8cAAABAN4CAAAAAAEBtxgls3RExZgey5D+Apcb7GIFdINeRlmY05VOQwZ7LtoBAAAAAP3///8CCgAAAAAAAAAWABSdRgMHmJrQiGsOWa+Ue5R6hDsGJlCBAQAAAAAAFgAUgIISApOAGqWF1K6dU+ANtN8F53kCRzBEAiAL3rtr0r5eB/U3HFRFKEWCJ/MuHEIetMi/5W/Pdw2tOAIgNSY0WkLk1lDHFxJIYgISnlr/0ZZu6YNExTLAGmgoca4BIQNc7DqYfFYpf3ejWJHMoMS+SGNnQh+QcpG8DXyPT1mnHgPvHAAiBgIDWK/NdMjNwkMIwK+D39jKrQQdd8QVK/Kmur/hQm0ACQy0x7YSAQAAAAEAAAAAIgICoL287OJyWbD9uT1ATxNQaD9VqKoAKdvQ6mRatmnd5zMMtMe2EgAAAAABAAAAACICAkaw3TsIUUYODFTLGB5brpjvHFDF7dG63Mg9m/KFHmMzDLTHthIBAAAAAgAAAAA=

**Tags:** bitcoin-core, client, raw-transaction, bitcoin-cli, bip174-psbt


---

## 1 answers

### Answer by username_1 on 2020-12-07. Score: 4 | Accepted answer

Yes, once the PSBT is finalized you can extract a fully-signed raw transaction from it (using the `finalizepsbt` RPC). As your PSBT does not have signatures yet, there is no point in constructing an actual transaction from it yet.

> **Comments:**
> **username_0**: I see, so: a) Using the CLI how would you sign the PSBT transaction with a key not in the wallet as *signrawtransactionwithkey* takes a raw (not PSBT) transaction as an argument? b) Is *finalizepsbt* the only way in the RPC to convert from PSBT to raw transaction?  
> **username_1**: You either use a raw transaction workflow or a PSBT workflow. Mixing them is bound to cause problems. PSBT signing will generally involve `walletprocesspsbt`, or using something like the HWI project to sign using hardware wallets.  
> **username_1**: Perhaps part of the confusion is that raw transactions serve two distinct purposes: an unsigned form that you pass around while gathering signatures, and a fully-signed form that can be broadcast on the network. PSBT wholly replaces the first one, but not the second. In PSBT you'd use RPCs like `createpsbt`, `walletcreatefundedpsbt`, `utxoupdatepsbt`, `walletprocesspsbt`, `combinepsbt`, `finalizepsbt`. Only after the last of those do you have a (signed) raw transaction.  
> **username_1**: You *can* still use raw transaction RPCs, and then convert to PSBT using `converttopsbt` but that's just for compatibility with (the very first step) of a raw-transaction based workflow.  
> **username_1**: Bitcoin Core currently has no RPC to sign PSBT using a key not in a wallet.  

---

