CALLEPSEPSBT – Earlybirds Invest https://earlybirdsinvest.com Latest Crypto News Sat, 14 Jun 2025 00:30:50 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.7 https://i0.wp.com/earlybirdsinvest.com/wp-content/uploads/2024/12/cropped-New-Project-2024-12-17T235703.455.png?fit=32%2C32&ssl=1 CALLEPSEPSBT – Earlybirds Invest https://earlybirdsinvest.com 32 32 240146708 How do I calculate the transaction fee for a CALL to CALLEPSEPSBT()? https://earlybirdsinvest.com/how-do-i-calculate-the-transaction-fee-for-a-call-to-callepsepsbt/ https://earlybirdsinvest.com/how-do-i-calculate-the-transaction-fee-for-a-call-to-callepsepsbt/#respond Sat, 14 Jun 2025 00:30:49 +0000 https://earlybirdsinvest.com/how-do-i-calculate-the-transaction-fee-for-a-call-to-callepsepsbt/ When my user calls my app, he is passed as an input parameter. Call it to create a PSBT createpsbt(). Full control over input and output decisions. For example, I don’t call walletcreatefundedpsbt()Because I don’t want to choose input on my behalf to bitcoind. I have a chicken and egg problem in that I need to call createpsbt() To determine the size of TX in bytes, you must specify the fee amount before the call createpsbt(). The best solution I can think of is to perform a dummy call createpsbt() Use the dummy fee value to measure the size of the TX and make the actual call createpsbt() After calculating the fee amount correctly. Is there a better way?

edit: I want to use all utxos. You need two outputs. One receives a fixed amount and the other receives a change in the fee. I have tried many spells, I can’t make it work. Here is my latest attempt:

raw_psbt = rpc.walletcreatefundedpsbt(
    # all UTXOs, as returned by listunspent():
    inputs,
    # one recipient: ( { addr : amount } )
    outputs,
    0,  # locktime
    {
        "replaceable" : True,
        # I would like for the change less the fee to go here:
        "changeAddress" : xxx,
        "includeWatching" : True,
        "feeRate" : 0.005,
    }
)

This fails Signing transaction failed (-4). Are you thinking about what I’m doing?

Edit #2: Cannot be used walletcreatefundedpsbt() As suggested below, in my environment, in order to create a PSBT, its input must be “solvable” in that function. Details of this link:

Error in walletcreatefundedpsbt & Unweldable utxos

So my original question remains unresolved at this point.

Edit #3: So I asked in Slack. The problem is that Bitcoin core does not have a way to calculate the TX size before TX is signed, since UTXOS cannot be expressed in 1) in a descriptor language, rather than 2) in a descriptor language. Apparently, you will need to do the calculations manually, as explained in the attached screenshot.Slack Chat

]]>
https://earlybirdsinvest.com/how-do-i-calculate-the-transaction-fee-for-a-call-to-callepsepsbt/feed/ 0 41887