<p>I think this should work (this is from just looking at the API, I have not tested this flow):</p>
<p>Use <a href="https://bitcoincore.org/en/doc/24.0.0/rpc/rawtransactions/createrawtransaction/" rel="nofollow noreferrer"><code>createrawtransaction</code></a> to specify the two inputs you want to use and the recipient output. Use the resulting hex in <a href="https://bitcoincore.org/en/doc/24.0.0/rpc/rawtransactions/fundrawtransaction/" rel="nofollow noreferrer"><code>fundrawtransaction</code></a> with <code>add_inputs: false</code> to specify the <code>fee_rate</code> and automatically create a change output. Verify that the resulting transaction matches your intent. Then call <code>signrawtransaction</code> and <code>sendrawtransaction</code>.</p>
<p>If any of this gives you grief about the inputs already being spent, you may need to call <a href="https://bitcoincore.org/en/doc/24.0.0/rpc/wallet/abandontransaction/" rel="nofollow noreferrer"><code>abandontransaction</code></a> on the transaction you’re trying to replace.</p>
<p>I think you could also use <code>createrawtransaction</code> to do it all, but in that case you need to explicitly define the change output (and to know the amount for the latter, manually calculate the appropriate fee).</p>

CC BY-SA 4.0
2023-05-12T15:15:01.170Z
2023-05-12T19:20:01.910Z
2023-05-12T19:20:01.910Z
Murch
<p>Save these nodes in config and run bitcoin core with <code>mempoolfullrbf=1</code>:</p>
<pre><code>addnode=full-rbf1.btc.petertodd.net
addnode=full-rbf2.btc.petertodd.net
addnode=full-rbf3.btc.petertodd.net
addnode=full-rbf4.btc.petertodd.net
</code></pre>
<p>Use <code>walletcreatefundedpsbt</code> to create a transaction with 2 inputs, 1 output and appropriate fee rate. Finalize and broadcast this transaction to replace earlier transaction.</p>

CC BY-SA 4.0
2023-05-10T07:25:15.893Z
The transaction already signals for RBF so there is no need for preferential peering. And `walletcreatefundedpsbt` would not re-spend coins already spent by an unconfirmed transaction.
Antoine Poinsot
CC BY-SA 4.0
2023-05-10T07:11:26.613Z
2023-05-10T07:11:26.613Z
cobol
<p>I have a 3 days old unconfirmed Bitcoin transaction that has 13 inputs, 2 outputs and a low fee.</p>
<p>I want to remove the small value inputs because as it increases the size, it also increases the minimum fee needed for the transaction to be confirmed and it's not worth to include them.</p>
<p><a href="https://www.blockchain.com/explorer/transactions/btc/4ec9b5b267fd4e58137d805544dbb6728f2f0a69df5913b6266405790092be58" rel="nofollow noreferrer">https://www.blockchain.com/explorer/transactions/btc/4ec9b5b267fd4e58137d805544dbb6728f2f0a69df5913b6266405790092be58</a></p>
<p>So I would like a transaction to replace the above one and only include these 2 inputs</p>
<ul>
<li>0.09980000 BTC (bc1q5mzf7fhs8h4vz28aerd464wsswxys9qalm63jj)</li>
<li>0.00040000 BTC (bc1qgq84rlg2mgjz39cg8hqu0fz398830zk42lvcx5)</li>
</ul>
<p>How can I achieve this using the Bitcoin Core Windows client console ?</p>
<p>Also, how about the low value inputs, are there anyways of consolidating them into a single wallet so I can make any use of them?</p>
<p>Thanks</p>

<bitcoin-core><transaction-fees><unconfirmed-transactions><replace-by-fee><bip-125-replaceable>
How can I change the inputs and fee of an unconfirmed Bitcoin transaction?
Bruno
# How can I change the inputs and fee of an unconfirmed Bitcoin transaction?

(Asked by: username_0 on 2023-05-09)

I have a 3 days old unconfirmed Bitcoin transaction that has 13 inputs, 2 outputs and a low fee.

I want to remove the small value inputs because as it increases the size, it also increases the minimum fee needed for the transaction to be confirmed and it's not worth to include them.

<https://www.blockchain.com/explorer/transactions/btc/4ec9b5b267fd4e58137d805544dbb6728f2f0a69df5913b6266405790092be58>

So I would like a transaction to replace the above one and only include these 2 inputs

* 0.09980000 BTC (bc1q5mzf7fhs8h4vz28aerd464wsswxys9qalm63jj)
* 0.00040000 BTC (bc1qgq84rlg2mgjz39cg8hqu0fz398830zk42lvcx5)

How can I achieve this using the Bitcoin Core Windows client console ?

Also, how about the low value inputs, are there anyways of consolidating them into a single wallet so I can make any use of them?

Thanks

**Tags:** bitcoin-core, transaction-fees, unconfirmed-transactions, replace-by-fee, bip-125-replaceable


---

## 2 answers

### Answer by username_1 on 2023-05-12. Score: 2

I think this should work (this is from just looking at the API, I have not tested this flow):

Use [`createrawtransaction`](https://bitcoincore.org/en/doc/24.0.0/rpc/rawtransactions/createrawtransaction/) to specify the two inputs you want to use and the recipient output. Use the resulting hex in [`fundrawtransaction`](https://bitcoincore.org/en/doc/24.0.0/rpc/rawtransactions/fundrawtransaction/) with `add_inputs: false` to specify the `fee_rate` and automatically create a change output. Verify that the resulting transaction matches your intent. Then call `signrawtransaction` and `sendrawtransaction`.

If any of this gives you grief about the inputs already being spent, you may need to call [`abandontransaction`](https://bitcoincore.org/en/doc/24.0.0/rpc/wallet/abandontransaction/) on the transaction you’re trying to replace.

I think you could also use `createrawtransaction` to do it all, but in that case you need to explicitly define the change output (and to know the amount for the latter, manually calculate the appropriate fee).


---

### Answer by username_2 on 2023-05-10. Score: 0

Save these nodes in config and run bitcoin core with mempoolfullrbf=1:
addnode=full-rbf1.btc.petertodd.net
addnode=full-rbf2.btc.petertodd.net
addnode=full-rbf3.btc.petertodd.net
addnode=full-rbf4.btc.petertodd.net

Use walletcreatefundedpsbt to create a transaction with 2 inputs, 1 output and appropriate fee rate. Finalize and broadcast this transaction to replace earlier transaction.

> **Comments:**
> **username_3**: The transaction already signals for RBF so there is no need for preferential peering. And `walletcreatefundedpsbt` would not re-spend coins already spent by an unconfirmed transaction.  

---

