Bitcoin Forum
May 26, 2024, 01:56:53 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Core PSBT creates huge to be signed file  (Read 57 times)
Gabrics (OP)
Full Member
***
Offline Offline

Activity: 183
Merit: 112

Just digging around


View Profile WWW
March 29, 2021, 09:39:44 AM
 #1

Hi,

I am trying to set-up a ColdCard to work air-gapped with Bitcoin Core (via SD card). Latest Bitcoin Core 0.21.0 and latest ColdCard firmware used.

- I create a watch-only non-descriptor wallet and I execute the importmulti command created by ColdCard (2x5000 addresses), OK
- I receive the correct addresses from Core which are watch only, OK

- I do a two simle (1in 1 out) test transactions (main-net) when all looks good. Core exports the PSBT ~600 bytes. Coldcard signs it and creates the final TXN ~400 bytes. All good.

BUT:
Later nothing changed (I mean Core closed and reopened few hours later, that's all). New TX arrives. Trying to do the same spend and PSBT export is now ~176 Kilobytes. Takes minutes while ColdCard digs through all of that and finally signs the one used and produces a ~400 bytes TXN.

Nothing fancy is going on, no multisig, no nothing. Why does Core include a lot/all addresses in a PSBT, but only the needed one at the beginning?

Any help would be appreciated as I seem to be stuck.

Thanks
Gabor
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6761


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 29, 2021, 10:30:10 AM
 #2

Why does Core include a lot/all addresses in a PSBT, but only the needed one at the beginning?

If you run that through bitcoin-cli decodepsbt, do you have several entries inside the "input", "output" or "unknown" fields?

Code:
{
 "tx": {
...
  },
  "unknown": {
     <--- check how big this field is
  },
  "inputs": [
    {
    <--- check how big this field is
    }
  ],
  "outputs": [
    {
     <--- check how big this field is
    }
  ]
}

If the new transaction is particularly large, as in has a lot of inputs/outputs, maybe that "leaked" over to the corresponding inputs and outputs fields (not vin/vout).

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Gabrics (OP)
Full Member
***
Offline Offline

Activity: 183
Merit: 112

Just digging around


View Profile WWW
March 29, 2021, 05:36:16 PM
Merited by HCP (2)
 #3

Just posting here, may helps someone:
(answer from Core user forum)
>>>
This is expected behavior. Bitcoin Core is not including a lot of addresses in the PSBT. It is including an entire previous transaction which happens to be enormous. Due to the way that signing works currently, many airgapped/offline/hardware signers need the entire previous transaction for each input in order to verify the correctness of amounts before they sign the transaction. As such, PSBT includes entire previous transactions. Sometimes this results in very large PSBTs when previous transactions are themselves large. In this case, the previous transaction for the input in this transaction is very large - it is 131953 bytes. You can see this in the non_witness_utxo field of the input.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!