Pages:
Author

Topic: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet - page 2. (Read 723 times)

HCP
legendary
Activity: 2086
Merit: 4363
Presumably, the first map after the Global map is an Input map. And the last map in the transaction is an Output map. But, what about the maps in-between? How can we tell if it an input map or an output map?
Each input in the transaction has to have a matching input map... so 2 inputs = 2 input maps... 2 outputs = 2 output maps. So, I think you actually need to decode the raw transaction, and work out how many inputs/outputs you have.


Here is the full breakdown of the psbt that I had earlier (showing the different keys/values etc):

Raw PSBT HEX:
Code:
70736274ff0100a002000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb0000000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf60000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac89021d00000100df0200000001bdecc2290de66382eb8c5384f1d9c4482cfbb00c4f6db71db427105b7fa3308d000000006a47304402200a0b02f5bc346324aedac80490af39d2d2d639e01dee391f6629b9fea9c0891e0220754e4ee039e2cd6a483269a572ecf2cabaeec55d6b8d37e487b2e592f661bf72012103b0ef8a6bb035b3d710faa53dc03479ea13f724a358b35208b2c7bd8f835186fafdffffff0222939800000000001976a914aebd0267e135531212e791eb225510be66f03cfe88ac00e1f5050000000017a914a74bd62f91c707ea86bd70a4fab9a650639e8a38876f311b00220602636f8fefa33369d4d2c07c07b00432ede5a155688c7b4fccda7fe845f119e74c0c6b163ff90100000022000000000100e20200000001959746d8e586847e97285ebc2f5ec2fe9e495a04fa396dd31c8e65f0a9cc43c0000000006b483045022100875c175edebd0618155d041ac2723ecd6fc97e4d29ce1f8df5414cad1d29501b02200745ce579fbbe5da28e838ec45330bfe53091f3074d40ae0371870c7b329d2f80121032a614933ee74e2dbfa8196e4c1eadca9d5a13c37760fadb91a2365199eed58eafdffffff0256889800000000001976a9142909ed18fc26e7c67315a57a340266f48c1d454788ac80969800000000001976a9145e32926e03c3c26cb21ce44abca1cdb73ca77c4f88ac09041800220602029734bd50b3af7a9f6d9710009c52f2b740b9ee5bf2251020d6126a1b8d8c380c6b163ff901000000150000000022020206dbf0c9c69646b18c80405e109116c434a57379b8e4fc0c273a6ece707795930c6b163ff9010000002b000000002202033ba344a7661a33329ae181ecb34171cba5a0e56ffc03af440a134166bffbc3510c6b163ff9000000000000000000

Split PSBT HEX:
Code:
70736274 - Magic Bytes
ff - Global Separator

01 - Key Length = 1 byte
00 - Key Data = 00 -> Unsigned Transaction
a0 - Value length = a0 bytes = 160 bytes
02000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb0000000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf60000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac89021d00

00 - Separator

INPUT MAP #1 Starts here!

01 - Key length = 1 byte
00 - Key Data = 00 -> PSBT_IN_NON_WITNESS_UTXO
df - Value length = df bytes = 446 bytes
0200000001bdecc2290de66382eb8c5384f1d9c4482cfbb00c4f6db71db427105b7fa3308d000000006a47304402200a0b02f5bc346324aedac80490af39d2d2d639e01dee391f6629b9fea9c0891e0220754e4ee039e2cd6a483269a572ecf2cabaeec55d6b8d37e487b2e592f661bf72012103b0ef8a6bb035b3d710faa53dc03479ea13f724a358b35208b2c7bd8f835186fafdffffff0222939800000000001976a914aebd0267e135531212e791eb225510be66f03cfe88ac00e1f5050000000017a914a74bd62f91c707ea86bd70a4fab9a650639e8a38876f311b00

22 - Key Length = 34 bytes
0602636f8fefa33369d4d2c07c07b00432ede5a155688c7b4fccda7fe845f119e74c - Key Data
=> 06 - PSBT_IN_BIP32_DERIVATION
=> 2636f8fefa33369d4d2c07c07b00432ede5a155688c7b4fccda7fe845f119e74c - Public Key
0c - Value Length = 12 bytes
6b163ff90100000022000000 - Value Data
=> 6b163ff9 - Master Key Fingerprint
=> 0100000022000000 = Derivation path 01000000\22000000 (little endian!) => m\1\34

00 - Separator

INPUT MAP #2 starts here!

01 - Key Length = 1 byte
00 - Key Data == 00 -> PSBT_IN_NON_WITNESS_UTXO
e2 - Value length = e2 bytes = 452 bytes
0200000001959746d8e586847e97285ebc2f5ec2fe9e495a04fa396dd31c8e65f0a9cc43c0000000006b483045022100875c175edebd0618155d041ac2723ecd6fc97e4d29ce1f8df5414cad1d29501b02200745ce579fbbe5da28e838ec45330bfe53091f3074d40ae0371870c7b329d2f80121032a614933ee74e2dbfa8196e4c1eadca9d5a13c37760fadb91a2365199eed58eafdffffff0256889800000000001976a9142909ed18fc26e7c67315a57a340266f48c1d454788ac80969800000000001976a9145e32926e03c3c26cb21ce44abca1cdb73ca77c4f88ac09041800

22 - key length = 34 bytes
0602029734bd50b3af7a9f6d9710009c52f2b740b9ee5bf2251020d6126a1b8d8c38 - Key Data
=> 06 - PSBT_IN_BIP32_DERIVATION
=> 02029734bd50b3af7a9f6d9710009c52f2b740b9ee5bf2251020d6126a1b8d8c38 - Public Key
0c - value length = 12 bytes
6b163ff90100000015000000 - Value Data
=> 6b163ff9 - Master Key Fingerprint
=> 0100000015000000 = Derivation Path 01000000\15000000 (little endian!) => m\1\21

00 - separator

Output Map #1 starts here!

22 - key length = 34 bytes
020206dbf0c9c69646b18c80405e109116c434a57379b8e4fc0c273a6ece70779593 - Key Data
=> 02 - PSBT_OUT_BIP32_DERIVATION
=> 0206dbf0c9c69646b18c80405e109116c434a57379b8e4fc0c273a6ece70779593 - Public Key
0c - value length = 12 bytes
6b163ff9010000002b000000 - Value Data
=> 6b163ff9 - Master Key Fingerprint
=> 010000002b000000 = Derivation Path 01000000\2b000000 (little endian!) => m\1\43

00 - Separator

Output Map #2 starts here!

22 - Key length = 34 bytes
02033ba344a7661a33329ae181ecb34171cba5a0e56ffc03af440a134166bffbc351 - Key data
=> 02 - PSBT_OUT_BIP32_DERIVATION
=> 033ba344a7661a33329ae181ecb34171cba5a0e56ffc03af440a134166bffbc351 - Public Key
0c - value length = 12 bytes
6b163ff90000000000000000 - Value Data
=> 6b163ff9 - Master Key Fingerprint
=> 0000000000000000 = Derivation Path 00000000\00000000 => m\0\0

00 - Separator


NOTE: I had an issue with some other PSBT that I was trying to "decode" manually... the "length" values are in "compact sized unsigned int" form... ie. if the "length" is > 252, it'll actually be displayed as 3 bytes... starting "fd"... and in little endian!!?!

so "fd0201" (the example I was looking at) actually means 0x0102 == 258 bytes Roll Eyes
newbie
Activity: 19
Merit: 4
Thank you HCP,

I think I understand 95% of this now. I did review the specification again and I do see my mistake. It is one Global Map followed by 1 or more Input maps followed by 1 or more Output maps.

I can see how to parse out all of the key-value maps. I am still confused how to determine where Input maps end and the Output maps start. The keys are only unique in the same "scope." IE PSBT_IN_NON_WITNESS_UTXO = 0x00, PSBT_OUT_REDEEM_SCRIPT = 0x00. Presumably, the first map after the Global map is an Input map. And the last map in the transaction is an Output map. But, what about the maps in-between? How can we tell if it an input map or an output map?

James.


As an aside, I decided that I am going to configure my old Win XP, to be a duel boot with ubuntu. Sadly, the hardware does not support boot from USB and I don't own a DVD burner. So I ordered a cheap one off of ebay and will have to try to install the os after that arrives.
HCP
legendary
Activity: 2086
Merit: 4363
I am able to follow what you are saying. However, I am still a little confused about the rest of your transaction. The specification at https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#cite_note-6 says the PSBT should have 3 sets of key-value maps. (Global, input, and output). Your transaction appears to have 5 sets of maps.
...
I also decided to look at the example I first started with. I found it contained one extra set of key-value maps.

Do you know what this extra data is used for?
You can have multiple input and output key-value maps...

Looking at the data (and what Bitcoin Core outputs when I used decodepsbt with that, they appear to be BIP32 derivation info for outputs (pubkey, master_fingerprint and path etc)




It's a hex format and how did you get the parse error it should be work unless you create an unsigned transaction which is not yours?
...
If you create an unsigned transaction from a watch-only wallet(Electrum 4.0.9) it should look like this.
*snip*
It's a hex transaction you need to copy that thing to a notepad to transfer it to the offline machine and paste that thing into your offline wallet(Electrum 2.9.0).
Do it again by exporting the unsigned transaction and use "copy to clipboard" and paste it to notepad to transfer it to the offline machine then repeat the procedure above.
That doesn't work any longer, and hasn't for a while (changed in 4.0.1 - https://github.com/spesmilo/electrum/blob/master/RELEASE-NOTES#L123)... Electrum has moved away from it's old "custom" unsigned transaction format and it is no longer supported. Electrum is now using "Partially Signed Bitcoin Transaction" PSBT format. Using "copy to clipboard" now gives a Base64 encoded "PSBT"...

As noted in the release notes:
* Partially Signed Bitcoin Transactions (PSBT, BIP-174) are supported
   (#5721). The previous Electrum partial transaction format is no
   longer supported, i.e. this is an incompatible change. Users should
   make sure that all instances of Electrum they use to co-sign or
   offline sign, are updated together.

legendary
Activity: 3472
Merit: 3217
Playbet.io - Crypto Casino and Sportsbook

BitMaxz, your idea is very intriguing. However, I tried what you suggested and am getting an unable to parse error in 2.9.0. I am not sure what format it is expecting. I tried with Base64. Is it hex, or json? I have never used this feature before.


It's a hex format and how did you get the parse error it should be work unless you create an unsigned transaction which is not yours?

If you create an unsigned transaction from a watch-only wallet(Electrum 4.0.9) it should look like this.
Code:
0100000008b3cf1f8b710cad071bc0f4dd97626e37e6a77e57eae56438c53460b995a613d3000000001f148d7a0a3461e3891723e5fdf8129caa0075060cff0008f01f010000000000fdffffff9e13b269032bf0fb679afee85d6e5254711eb0e4993d73cd72b9ea2912e35f0a000000001f148d7a0a3461e3891723e5fdf8129caa0075060cff00086179020000000000fdffffff8527f6bbde7b77e4296817ad53c803712778d98821bcfeb5d30ce88aad01f5d1000000001f148d7a0a3461e3891723e5fdf8129caa0075060cff0008b63e1a0000000000fdffffff054b71be6d3a28fbe86b893a2381ffe5443dae08b687e2c753b31e645d666efd000000001f148d7a0a3461e3891723e5fdf8129caa0075060cff000890e7140000000000fdffffffa05368a4d3427ee61294e2683d5650ade5c31cabc46e7ce794524fbc9ebf38c7000000001f148d7a0a3461e3891723e5fdf8129caa0075060cff000890e7140000000000fdffffffd3c0e20d475704318636bf99a0cd1a77ef5ce61f782b12f318bdd5713095bd25000000001f148d7a0a3461e3891723e5fdf8129caa0075060cff000890e7140000000000fdffffff356739d57633167f606370be79711eaea05ed7ba7de56f5c7663b738653b5b04000000001f148d7a0a3461e3891723e5fdf8129caa0075060cff0008703f230000000000fdffffffaa72a90408fd72cd3523099e4a32a6e4894931735213af6259f473f2b8d03c0a000000001f148d7a0a3461e3891723e5fdf8129caa0075060cff00089076120000000000fdffffff01e73c9200000000001976a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac00000000

It's a hex transaction you need to copy that thing to a notepad to transfer it to the offline machine and paste that thing into your offline wallet(Electrum 2.9.0).
Do it again by exporting the unsigned transaction and use "copy to clipboard" and paste it to notepad to transfer it to the offline machine then repeat the procedure above.

If it doesn't work I think you can download this page https://coinb.in/#sign and transfer it to your offline machine use a browser that supports javascript. Use that page to sign the transaction that you made from your watch-only wallet. It needs a private key so you need to export the private key from your offline Electrum wallet.
newbie
Activity: 19
Merit: 4
Thank you HCP,

I am able to follow what you are saying. However, I am still a little confused about the rest of your transaction. The specification at https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#cite_note-6 says the PSBT should have 3 sets of key-value maps. (Global, input, and output). Your transaction appears to have 5 sets of maps.

70736274ff0100a002000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829c b0000000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e06 4cf60000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e9 44306d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488 ac89021d00000100df0200000001bdecc2290de66382eb8c5384f1d9c4482cfbb00c4f6db71db427105b7fa3308 d000000006a47304402200a0b02f5bc346324aedac80490af39d2d2d639e01dee391f6629b9fea9 c0891e0220754e4ee039e2cd6a483269a572ecf2cabaeec55d6b8d37e487b2e592f661bf7201210 3b0ef8a6bb035b3d710faa53dc03479ea13f724a358b35208b2c7bd8f835186fafdffffff022293 9800000000001976a914aebd0267e135531212e791eb225510be66f03cfe88ac00e1f5050000000 017a914a74bd62f91c707ea86bd70a4fab9a650639e8a38876f311b00220602636f8fefa33369d4 d2c07c07b00432ede5a155688c7b4fccda7fe845f119e74c0c6b163ff90100000022000000000100e20200000001959746d8e586847e97285ebc2f5ec2fe9e495a04fa396dd31c8e65f0a9cc43c 0000000006b483045022100875c175edebd0618155d041ac2723ecd6fc97e4d29ce1f8df5414cad 1d29501b02200745ce579fbbe5da28e838ec45330bfe53091f3074d40ae0371870c7b329d2f8012 1032a614933ee74e2dbfa8196e4c1eadca9d5a13c37760fadb91a2365199eed58eafdffffff0256 889800000000001976a9142909ed18fc26e7c67315a57a340266f48c1d454788ac8096980000000 0001976a9145e32926e03c3c26cb21ce44abca1cdb73ca77c4f88ac09041800220602029734bd50 b3af7a9f6d9710009c52f2b740b9ee5bf2251020d6126a1b8d8c380c6b163ff9010000001500000 00022020206dbf0c9c69646b18c80405e109116c434a57379b8e4fc0c273a6ece707795930c6b163ff 9010000002b000000002202033ba344a7661a33329ae181ecb34171cba5a0e56ffc03af440a134166bffbc3510c6b163ff 9000000000000000000


The first separator "ff" appears at position 8. The global map follows. The second separator "00" appears at position 336. The input map follows. The third separator "00" appears at position 886. The output map follows.

There are 2 more separators with key-value maps following. They are at position 1442 and 1540. In blue. There is a final separator at 1638 which terminates the transaction.


I also decided to look at the example I first started with. I found it contained one extra set of key-value maps.

Do you know what this extra data is used for?

Thank you,
James.









legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
The real cold computer  has not to go online even at the time of OS  registration. I have the legal WIN 10 license (in fact that is a volume license) but didn't  use it for  OS on my cold computer and found the way how to work around the limitation of trial period.  Couple of other notebooks that I have for online work  use that license.

slmgr doesn't connect to the internet, it's just a VBS script that resets the trial to the way it was when you installed Windows and you have to restart the computer for the changes to apply. There is no Internet connectivity involved at all.

But it's a pretty dumb solution for cold storage if you ask me since you still only get 120 days max, at least your method gives you an unlimited number of days.
HCP
legendary
Activity: 2086
Merit: 4363
Maybe we can back up the discussion a little bit and you guys could help me understand the different formats we are dealing with.
Using 4.0.9 I can choose to "export", and "copy to clipboard". This gives the transaction encoded in base64? And if I choose to "export to file" that is same base64 converted to ASCII?
Not quite correct... Electrum now uses the "Partially Signed Bitcoin Transaction" (aka PSBT) format when exporting "unsigned" transactions. As already noted, this psbt file format is defined here. The important thing to note is that it is a binary file format... there is unlikely to be any human readable text contained within it (aside from the "psbt" magic bytes at the the beginning of the file)

As far as the Electrum exports are concerned:

- When you use "copy to clipboard"... Electrum encodes that psbt binary data into Base64 text format (as copy/pasting "binary" data can be somewhat problematic).
- When you use "export to file"... Electrum simply writes the psbt binary data into the file directly.


Is there anyway to take either of these representations of the transaction and convert it to something that is in a human readable form? I thought I could take base64 string from the clipboard and convert it to hex using:  https://cryptii.com/pipes/base64-to-hex  Then, take the hex and use a tool like https://live.blockcypher.com/btc/decodetx/ to decode the hex to a json representation of the transaction. But this does not work. I think the hex is bad, but not sure.
Correct... using that base64-to-hex converter will indeed convert the "Copy to Clipboard" Base64 encoded psbt data from Electrum into the "hex" output...

The problem you have is that this hex is in psbt format... which is NOT the same format as a standard bitcoin transaction. This is why you get errors when trying to use a Bitcoin Transaction decoder. Having said that, the "raw unsigned transaction is actually contained in the psbt... and, the bonus is that it is included right at the beginning!

So... the basic format of the psbt file is:

4 bytes - Magic Bytes - 0x70736274 (Magic bytes which are ASCII for psbt)
1 byte - separator - 0xff

Then it should be the "global" key-value "map"... this is "variable" length, but the format is:

key length - int specifying number of bytes of the key
key data - the actual key data
value length - int specifying number of bytes of the value data
value data - the actual value data

It looks quite confusing... but hopefully an example will give you some hope... Wink

Here is a PBST from the "copy to clipboard"... so it's in Base64 format:
Code:
cHNidP8BAKACAAAAAo6AHdHDG49pUtMKtxy4zCwK7QY0CtCwfwiV6Lh2yCnLAAAAAAD9////3pHCZunJoabQc89f5IJTdjhVVp/AeJ4l5/H07F4GTPYAAAAAAP3///8CgoOYAAAAAAAZdqkUB/HU3mNuQvFvSZiMjcF+lEMG0mWIrICWmAAAAAAAGXapFFC6xnhio5hP5yg5rw8U4roI5nZkiKyJAh0AAAEA3wIAAAABvezCKQ3mY4LrjFOE8dnESCz7sAxPbbcdtCcQW3+jMI0AAAAAakcwRAIgCgsC9bw0YySu2sgEkK850tLWOeAd7jkfZim5/qnAiR4CIHVOTuA54s1qSDJppXLs8sq67sVda4035Iey5ZL2Yb9yASEDsO+Ka7A1s9cQ+qU9wDR56hP3JKNYs1IIsse9j4NRhvr9////AiKTmAAAAAAAGXapFK69AmfhNVMSEueR6yJVEL5m8Dz+iKwA4fUFAAAAABepFKdL1i+Rxwfqhr1wpPq5plBjnoo4h28xGwAiBgJjb4/vozNp1NLAfAewBDLt5aFVaIx7T8zaf+hF8RnnTAxrFj/5AQAAACIAAAAAAQDiAgAAAAGVl0bY5YaEfpcoXrwvXsL+nklaBPo5bdMcjmXwqcxDwAAAAABrSDBFAiEAh1wXXt69BhgVXQQawnI+zW/Jfk0pzh+N9UFMrR0pUBsCIAdFzlefu+XaKOg47EUzC/5TCR8wdNQK4DcYcMezKdL4ASEDKmFJM+504tv6gZbkwercqdWhPDd2D625GiNlGZ7tWOr9////AlaImAAAAAAAGXapFCkJ7Rj8JufGcxWlejQCZvSMHUVHiKyAlpgAAAAAABl2qRReMpJuA8PCbLIc5Eq8oc23PKd8T4isCQQYACIGAgKXNL1Qs696n22XEACcUvK3QLnuW/IlECDWEmobjYw4DGsWP/kBAAAAFQAAAAAiAgIG2/DJxpZGsYyAQF4QkRbENKVzebjk/AwnOm7OcHeVkwxrFj/5AQAAACsAAAAAIgIDO6NEp2YaMzKa4YHss0Fxy6Wg5W/8A69EChNBZr/7w1EMaxY/+QAAAAAAAAAAAA==


We run that through the "Base64 to hex" converter (set "Group By" = None), which gives us this:
Code:
70736274ff0100a002000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb0000000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf60000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac89021d00000100df0200000001bdecc2290de66382eb8c5384f1d9c4482cfbb00c4f6db71db427105b7fa3308d000000006a47304402200a0b02f5bc346324aedac80490af39d2d2d639e01dee391f6629b9fea9c0891e0220754e4ee039e2cd6a483269a572ecf2cabaeec55d6b8d37e487b2e592f661bf72012103b0ef8a6bb035b3d710faa53dc03479ea13f724a358b35208b2c7bd8f835186fafdffffff0222939800000000001976a914aebd0267e135531212e791eb225510be66f03cfe88ac00e1f5050000000017a914a74bd62f91c707ea86bd70a4fab9a650639e8a38876f311b00220602636f8fefa33369d4d2c07c07b00432ede5a155688c7b4fccda7fe845f119e74c0c6b163ff90100000022000000000100e20200000001959746d8e586847e97285ebc2f5ec2fe9e495a04fa396dd31c8e65f0a9cc43c0000000006b483045022100875c175edebd0618155d041ac2723ecd6fc97e4d29ce1f8df5414cad1d29501b02200745ce579fbbe5da28e838ec45330bfe53091f3074d40ae0371870c7b329d2f80121032a614933ee74e2dbfa8196e4c1eadca9d5a13c37760fadb91a2365199eed58eafdffffff0256889800000000001976a9142909ed18fc26e7c67315a57a340266f48c1d454788ac80969800000000001976a9145e32926e03c3c26cb21ce44abca1cdb73ca77c4f88ac09041800220602029734bd50b3af7a9f6d9710009c52f2b740b9ee5bf2251020d6126a1b8d8c380c6b163ff901000000150000000022020206dbf0c9c69646b18c80405e109116c434a57379b8e4fc0c273a6ece707795930c6b163ff9010000002b000000002202033ba344a7661a33329ae181ecb34171cba5a0e56ffc03af440a134166bffbc3510c6b163ff9000000000000000000


Now, looking at the beginning of the file...
Quote
70736274ff0100a002000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb00000 00000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf600 00000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d 26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac8902 1d00000100df02000000....

We see:

70736274 == magic bytes
ff == separator

Then the "global key-value map" starts:
01 == length of key == 0x01 == 1 byte
00 == key value = 0x00 == "Unsigned Transaction PSBT_GLOBAL_UNSIGNED_TX" <--- This is the "key" we're after! Wink
a0 == length of data = 0xa0 == 160 bytes == 320 chars
02000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb00000 00000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf600 00000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d 26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac8902 1d00 == actual data value == the unsigned transaction hex! SUCCESS! Wink

If we put that hex into the decodetx utility... we get:
Code:
{
    "addresses": [
        "1j1S6J5Azgju5PtpkwMLd5YMHBDD14BeP",
        "18Mroim7a2auG6C9X8QEDAUgUx5hDKMzZj"
    ],
    "block_height": -1,
    "block_index": -1,
    "confirmations": 0,
    "double_spend": false,
    "fees": 0,
    "hash": "0334ca8de093b635b490ec4480764b8e4a5a0c524ae2825135dd2aa4e2903822",
    "inputs": [
        {
            "age": 0,
            "output_index": 0,
            "prev_hash": "cb29c876b8e895087fb0d00a3406ed0a2cccb81cb70ad352698f1bc3d11d808e",
            "script_type": "empty",
            "sequence": 4294967293
        },
        {
            "age": 0,
            "output_index": 0,
            "prev_hash": "f64c065eecf4f1e7259e78c09f565538765382e45fcf73d0a6a1c9e966c291de",
            "script_type": "empty",
            "sequence": 4294967293
        }
    ],
    "lock_time": 1901193,
    "opt_in_rbf": true,
    "outputs": [
        {
            "addresses": [
                "1j1S6J5Azgju5PtpkwMLd5YMHBDD14BeP"
            ],
            "script": "76a91407f1d4de636e42f16f49988c8dc17e944306d26588ac",
            "script_type": "pay-to-pubkey-hash",
            "value": 9995138
        },
        {
            "addresses": [
                "18Mroim7a2auG6C9X8QEDAUgUx5hDKMzZj"
            ],
            "script": "76a91450bac67862a3984fe72839af0f14e2ba08e6766488ac",
            "script_type": "pay-to-pubkey-hash",
            "value": 10000000
        }
    ],
    "preference": "low",
    "received": "2020-12-29T08:05:12.865990958Z",
    "relayed_by": "3.86.86.99",
    "size": 160,
    "total": 19995138,
    "ver": 2,
    "vin_sz": 2,
    "vout_sz": 2
}

Obviously, it won't always be 160 bytes for every psbt that you create, so you'd need to find and calculate the "data length" value and then extract the appropriate number of following bytes...





Otherwise, another somewhat simpler (and less error-prone) option is to use NodeJS and the 'psbt' package with it's decodePsbt() method. We simply pass in the psbt "hex" and it outputs the fully decoded "psbt" with the raw transaction displayed at the end, like so:
Code:
> const psbt = require('psbt')
> psbt.decodePsbt({psbt:'70736274ff0100a002000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb0000000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf60000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac89021d00000100df0200000001bdecc2290de66382eb8c5384f1d9c4482cfbb00c4f6db71db427105b7fa3308d000000006a47304402200a0b02f5bc346324aedac80490af39d2d2d639e01dee391f6629b9fea9c0891e0220754e4ee039e2cd6a483269a572ecf2cabaeec55d6b8d37e487b2e592f661bf72012103b0ef8a6bb035b3d710faa53dc03479ea13f724a358b35208b2c7bd8f835186fafdffffff0222939800000000001976a914aebd0267e135531212e791eb225510be66f03cfe88ac00e1f5050000000017a914a74bd62f91c707ea86bd70a4fab9a650639e8a38876f311b00220602636f8fefa33369d4d2c07c07b00432ede5a155688c7b4fccda7fe845f119e74c0c6b163ff90100000022000000000100e20200000001959746d8e586847e97285ebc2f5ec2fe9e495a04fa396dd31c8e65f0a9cc43c0000000006b483045022100875c175edebd0618155d041ac2723ecd6fc97e4d29ce1f8df5414cad1d29501b02200745ce579fbbe5da28e838ec45330bfe53091f3074d40ae0371870c7b329d2f80121032a614933ee74e2dbfa8196e4c1eadca9d5a13c37760fadb91a2365199eed58eafdffffff0256889800000000001976a9142909ed18fc26e7c67315a57a340266f48c1d454788ac80969800000000001976a9145e32926e03c3c26cb21ce44abca1cdb73ca77c4f88ac09041800220602029734bd50b3af7a9f6d9710009c52f2b740b9ee5bf2251020d6126a1b8d8c380c6b163ff901000000150000000022020206dbf0c9c69646b18c80405e109116c434a57379b8e4fc0c273a6ece707795930c6b163ff9010000002b000000002202033ba344a7661a33329ae181ecb34171cba5a0e56ffc03af440a134166bffbc3510c6b163ff9000000000000000000'});
{
  inputs: [
    {
      non_witness_utxo: '0200000001bdecc2290de66382eb8c5384f1d9c4482cfbb00c4f6db71db427105b7fa3308d000000006a47304402200a0b02f5bc346324aedac80490af39d2d2d639e01dee391f6629b9fea9c0891e0220754e4ee039e2cd6a483269a572ecf2cabaeec55d6b8d37e487b2e592f661bf72012103b0ef8a6bb035b3d710faa53dc03479ea13f724a358b35208b2c7bd8f835186fafdffffff0222939800000000001976a914aebd0267e135531212e791eb225510be66f03cfe88ac00e1f5050000000017a914a74bd62f91c707ea86bd70a4fab9a650639e8a38876f311b00',
      bip32_derivations: [Array]
    },
    {
      non_witness_utxo: '0200000001959746d8e586847e97285ebc2f5ec2fe9e495a04fa396dd31c8e65f0a9cc43c0000000006b483045022100875c175edebd0618155d041ac2723ecd6fc97e4d29ce1f8df5414cad1d29501b02200745ce579fbbe5da28e838ec45330bfe53091f3074d40ae0371870c7b329d2f80121032a614933ee74e2dbfa8196e4c1eadca9d5a13c37760fadb91a2365199eed58eafdffffff0256889800000000001976a9142909ed18fc26e7c67315a57a340266f48c1d454788ac80969800000000001976a9145e32926e03c3c26cb21ce44abca1cdb73ca77c4f88ac09041800',
      bip32_derivations: [Array]
    }
  ],
  outputs: [ { bip32_derivation: [Object] }, { bip32_derivation: [Object] } ],
  pairs: [
    {
      type: '00',
      value: '02000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb0000000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf60000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac89021d00'
    },
    {
      type: '00',
      value: '0200000001bdecc2290de66382eb8c5384f1d9c4482cfbb00c4f6db71db427105b7fa3308d000000006a47304402200a0b02f5bc346324aedac80490af39d2d2d639e01dee391f6629b9fea9c0891e0220754e4ee039e2cd6a483269a572ecf2cabaeec55d6b8d37e487b2e592f661bf72012103b0ef8a6bb035b3d710faa53dc03479ea13f724a358b35208b2c7bd8f835186fafdffffff0222939800000000001976a914aebd0267e135531212e791eb225510be66f03cfe88ac00e1f5050000000017a914a74bd62f91c707ea86bd70a4fab9a650639e8a38876f311b00'
    },
    {
      type: '0602636f8fefa33369d4d2c07c07b00432ede5a155688c7b4fccda7fe845f119e74c',
      value: '6b163ff90100000022000000'
    },
    {
      type: '00',
      value: '0200000001959746d8e586847e97285ebc2f5ec2fe9e495a04fa396dd31c8e65f0a9cc43c0000000006b483045022100875c175edebd0618155d041ac2723ecd6fc97e4d29ce1f8df5414cad1d29501b02200745ce579fbbe5da28e838ec45330bfe53091f3074d40ae0371870c7b329d2f80121032a614933ee74e2dbfa8196e4c1eadca9d5a13c37760fadb91a2365199eed58eafdffffff0256889800000000001976a9142909ed18fc26e7c67315a57a340266f48c1d454788ac80969800000000001976a9145e32926e03c3c26cb21ce44abca1cdb73ca77c4f88ac09041800'
    },
    {
      type: '0602029734bd50b3af7a9f6d9710009c52f2b740b9ee5bf2251020d6126a1b8d8c38',
      value: '6b163ff90100000015000000'
    },
    {
      type: '020206dbf0c9c69646b18c80405e109116c434a57379b8e4fc0c273a6ece70779593',
      value: '6b163ff9010000002b000000'
    },
    {
      type: '02033ba344a7661a33329ae181ecb34171cba5a0e56ffc03af440a134166bffbc351',
      value: '6b163ff90000000000000000'
    }
  ],
  unsigned_transaction: '02000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb0000000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf60000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac89021d00'
}
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
Maybe we can back up the discussion a little bit and you guys could help me understand the different formats we are dealing with.
Using 4.0.9 I can choose to "export", and "copy to clipboard". This gives the transaction encoded in base64? And if I choose to "export to file" that is same base64 converted to ASCII?
No for the second part; if you open the .psbt file using a text editor, it will just assume that the contents are any of the text character encodings and will display non-readable data.

I guess that it's a binary encoding: https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#Encoding
But the encoded data is the same whatever option you've used to export the partial raw transaction.
newbie
Activity: 19
Merit: 4
Thank you for the advice on how to extend the trial time for Windows 10. It is an interesting idea, but I think my hardware is too old to support 10.

coinmaster, unable. Please read first post in thread.


BitMaxz, your idea is very intriguing. However, I tried what you suggested and am getting an unable to parse error in 2.9.0. I am not sure what format it is expecting. I tried with Base64. Is it hex, or json? I have never used this feature before.


Maybe we can back up the discussion a little bit and you guys could help me understand the different formats we are dealing with.
Using 4.0.9 I can choose to "export", and "copy to clipboard". This gives the transaction encoded in base64? And if I choose to "export to file" that is same base64 converted to ASCII?

Is there anyway to take either of these representations of the transaction and convert it to something that is in a human readable form? I thought I could take base64 string from the clipboard and convert it to hex using:  https://cryptii.com/pipes/base64-to-hex  Then, take the hex and use a tool like https://live.blockcypher.com/btc/decodetx/ to decode the hex to a json representation of the transaction. But this does not work. I think the hex is bad, but not sure.

I used to understand how this all worked on 2.9.0, but now I am very confused.

James.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
I'll tell you what to do in your case.

1)Download the ISO file for Windows 10 from Microsoft's official website. 2) Write the image to USB drive (or DVD if ISO size matches it). 3) Install Win 10 on your offline computer (preferably 4 Gigas RAM , if less, it is better to add it, it is cheap).  4) Install the latest version of Electrum. 5) Always switch off offline computer  not via shut down, but via  hibernation. (By default this option is not visible in Win10, search the internet for how to make it visible.)  Microsoft allows you to work with a non-activated operating system for several days. If you turn computer off via  shutdown, you will not be able to boot after these days (even if the computer was not connected to the internet the whole time, the system has an internal counter). If you turn off via hibernation, the status of your computer will always be "spotlessly clean" after turning it on. 6) Just in case, after installing OS and Electrum, create an image of  system's partition and save it on an external hard drive or on the second HDD partition. This is necessary so that if you accidentally exit via shutdown and the system will not be able to boot after turning it on, you can restore everything to its original state.

This is how I made my cold computer about three years ago and everything is working fine. Right, I have Armory for my cold wallet, not Electrum, but that doesn't matter in this case.

Another legal way to extend the Windows 10 trial is run slmgr -rearm in Command Prompt when the 30-day trial is almost finished. This can be ran at most three times before it doesn't work anymore, so you get 120 days out of the trial.

But I honestly wouldn't bother in the case of Windows 10. The only impedance when running unactivated is that you can't change the personalizion settings and there's a not-so-obtrusive watermark on the bottom right. It doesn't shut down the computer at all which is bearable to me.



Thank you for the advice on how to extend the trial time for Windows 10. It is an interesting idea, but I think my hardware is too old to support 10.

slmgr works on all Windows operating systems from Vista to 10.
newbie
Activity: 3
Merit: 0
Why not just write down the seed on paper, install new version of Electrum and do it from there?

Using USB drives is dangerous because this way secrets may leak (in hypothetical scenario when there is a malware on the offline computer capable of writing on USB devices in a hidden way).

legendary
Activity: 3472
Merit: 3217
Playbet.io - Crypto Casino and Sportsbook
I think you don't need to upgrade anything OS or the Electrum installed in your offline PC/Laptop.
If you make the unsigned transaction from an online PC/laptop you must have the option to copy the hex/raw transaction just copy them and put them into notepad transfer it to your offline machine.

Now, open your Electrum 2.9.0 and check this



Now open the transferred notepad and copy hex/raw transaction paste it there and sign the transaction. The result must be your signed raw/hex transaction just copy them and save it again to a new notepad and transfer it back to the online machine. Now check it first before you broadcast if the transaction you made is correct you can use this tool https://coinb.in/#verify after that if all is correct you can now broadcast them here https://coinb.in/#broadcast just paste the hex/raw transaction then submit or you can use your latest Electrum installed in your online machine to broadcast the transaction.
HCP
legendary
Activity: 2086
Merit: 4363
If he use "Copy to clipboard", it will result with a Base64 string; IDK for the "Export to file" but it looks like a 'binary version' like he said.
Ah yes... you are indeed correct. "Copy To Clipboard" option is a Base64 encoded string... the "Export to file" file is simply just the hex values written out to the file.



I was unaware that the signed transaction will be exported in Base64. (I have not been able to get 4.0.9 to start yet for my offline wallet) So, at least I can still visually verify the signed transaction.
Yeah, I got it wrong... I assumed the "copy to clipboard" and "export to file" options were exporting in the same format... they're not! Undecided as per nc50lc's comment, clipboard is in Base64 (which can be decoded directly using the Bitcoin Core RPC tool)... whereas the "export to file" is just the ASCII encoded hex values... ie. just a binary file.


Just have 2 more questions,
1. Is there an easy way to decode the contents of the unsigned binary encoded .psbt file that does not involve using Electrum?
2. Can someone recommend an off-line utility which will decode the contents of the signed Base64 encoded .psbt file?
So, you can simply open the .pbst file with a hex editor to retrieve the raw hex values... or you can use an ASCII to hex converter: https://www.rapidtables.com/convert/number/ascii-to-hex.html and copy paste the contents and it'll give the hex (set the output delimiter string to "None" if you use that converter).

The file format is defined in BIP174: https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki

There are a few tools floating around that will decode the PSBT... the easiest is the Bitcoin Core RPC online: https://bitcoincore.org/en/doc/0.20.0/rpc/rawtransactions/decodepsbt/ (or Bitcoin Core console itself if you have it installed, but that requires it to be in the Base64 encoding!)

Otherwise, there seem to be various Python and NodeJS/npm libraries floating around that seem to handle PSBT data.

Python:
https://github.com/btclib-org/btclib

NodeJS/npm:
https://www.npmjs.com/package/psbt
newbie
Activity: 19
Merit: 4
Thanks guys I appreciate the advice.

xenon, thank you for the instructions on how to circumvent the registration of Win 10. I think my hardware is probably not a good fit for Win 10, but the advice is most helpful.


I guess I am being too paranoid, but for me this is a signification amount of value I am trying to protect. My concern is a scenario where my Electrum gets compromised somehow. I had been manually verifying the transaction in the unsigned.txt file to make sure it matched what was being displayed in the Electrum GUI. I would do this before I signed the transaction and again after the transaction was signed. For the attack to be successful I know they would need to compromise both the on-line Electrum used to create the transaction and the off-line Electrum used to sign the transaction, which is unlikely.


I was unaware that the signed transaction will be exported in Base64. (I have not been able to get 4.0.9 to start yet for my offline wallet) So, at least I can still visually verify the signed transaction.


Just have 2 more questions,
1. Is there an easy way to decode the contents of the unsigned binary encoded .psbt file that does not involve using Electrum?
2. Can someone recommend an off-line utility which will decode the contents of the signed Base64 encoded .psbt file?

Thank you for helping me learn more about this.
James.  
legendary
Activity: 1848
Merit: 2033
Crypto Swap Exchange
I have cold electrum 4.0.9 working fine on an old 2008 netbook (32-bit Intel Atom 1.6GHz N270, 2 GB) with Linux LXLE.
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
Can anyone tell me anything more about how the latest release handles saving unsigned transactions to a file? I like to manually verify all the outputs in the unsigned transaction file before I allow the file to be copied to a blank thumb drive. (And then loaded on the offline wallet to be signed.)  Is there anyway to validate the contents of this file using something external to Electrum before signing the transaction? I tried to open the file but it looks like encrypted contents now. The documentation does not appear to be updated since this was changed.
It's Base64 encoded... and the data is in "Partially Signed Bitcoin Transaction" aka PSBT format... You can read about the PSBT format here: https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
If he use "Copy to clipboard", it will result with a Base64 string; IDK for the "Export to file" but it looks like a 'binary version' like he said.

@77Network Either (1) use the "copy to clipboard" and paste it on a text file then you can use Bitcoin Core (even offline) to decode it using the command: decodepsbt.
Or (2) Sign it first (then the exported file/text back to the online machine will be in HEX) and before you broadcast, you can decode it using your usual tools.

Of course, all of this are after the upgrade.
newbie
Activity: 19
Merit: 4
I am sorry, but I am not understanding. If this is documented someplace, please let me know and I will research it.

I don't think Electrum is producing Base64 encoded psbt files. When I open the .psbt file I see this.

---
psbtÿ U   ä[J§éŽz �×U¶‚ÏÙ\¶iÁα¬�›ÂrÑÑiå     ýÿÿÿ}    v©™\´¢tó÷t4¦!Êd,14ê�ˆ¬
   â   ÿãçæYÉ�qÇm÷Un]»:•4wÙ:.“b:©_TÍ    kH0E! è˜+‰P»AÁk~ ­xÍý¨©¼XÑo×0ù“hx{O 0ª¶É°O   DaYYKI¬’Òt[Ê–œx)(¼3;‰!HÁÞô×û²0„z4#qá)³   e~EöqØkð¤ö•/rþÿÿÿ}    v©Z   ìqï
,òê�§ xn1u_ˆ¬@Ys    v©×d�S8.Þ8WW̵FcÙ؈[Ûˆ¬É "ðÿez5ÅnÍ­,^
p'.4fýãÅÆ B�qiÄ÷¬8ˆL �ŽÐ       "Ê[Þ²Ûñ$À©¬õ¶É\_˜6¼H¶xü̶"æÛ÷ �ŽР      
---

I think this is some kind of binary version of a psbt. I am wondering if there is anyway to reverse engineer this back to an actual transaction. I tried running it through that web based utility you mentioned in your post, but it says "Forbidden character at index 4."


HCP
legendary
Activity: 2086
Merit: 4363
Can anyone tell me anything more about how the latest release handles saving unsigned transactions to a file? I like to manually verify all the outputs in the unsigned transaction file before I allow the file to be copied to a blank thumb drive. (And then loaded on the offline wallet to be signed.)  Is there anyway to validate the contents of this file using something external to Electrum before signing the transaction? I tried to open the file but it looks like encrypted contents now. The documentation does not appear to be updated since this was changed.
It's Base64 encoded... and the data is in "Partially Signed Bitcoin Transaction" aka PSBT format... You can read about the PSBT format here: https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki


NOTE: Something like this tool will decrypt the Base64 to Hex: https://cryptii.com/pipes/base64-to-hex
newbie
Activity: 19
Merit: 4
I think you are right about using Linux. It looks like I might be able to run Win 7 on this hardware, but it is not abandon ware yet. I am not going to try to buy it or mess with hacked versions.

Can anyone tell me anything more about how the latest release handles saving unsigned transactions to a file? I like to manually verify all the outputs in the unsigned transaction file before I allow the file to be copied to a blank thumb drive. (And then loaded on the offline wallet to be signed.)  Is there anyway to validate the contents of this file using something external to Electrum before signing the transaction? I tried to open the file but it looks like encrypted contents now. The documentation does not appear to be updated since this was changed.

At some point in the past, the unsigned transaction was saved as hex which could be decoded to json with many different utilities.

Thanks,
James.
legendary
Activity: 3472
Merit: 10611
I suggest learning a bit about Linux and switching your offline storage to that instead. You can find light distributions such as Lubuntu that can run on older machines and are also much more secure than the ancient Windows XP and also can run newer application such as the new versions of Electrum.
https://lubuntu.net/
Pages:
Jump to: