Bitcoin Forum

Bitcoin => Electrum => Topic started by: 77Network on December 28, 2020, 12:21:07 AM



Title: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 28, 2020, 12:21:07 AM
Dear Friends,

I am hoping someone can offer some assistance. I have a number of coins that are stuck in an old wallet on a PC running Win XP.
I also am looking for some help on the transaction signing process which has not been updated in the official documentation for the current release.  

History:
Back in 2017 I created an Offline Wallet using Electrum 2.9.0. The offline PC is an old Pentium running a fresh install of 32 bit Windows XP. The PC has never been connected to the internet and has nothing installed on it except the OS and Electrum. On my newer Win 10 laptop I have my Watching Only Wallet with the public master key.

My standard process for transactions in 2017 was to;
1. Create the transaction on my Win 10 laptop using my Watching Only Wallet.
2. Save the unsigned transaction to unsigned.txt.
3. Open unsigned.txt and decode the hex to json and visually verify the outputs of the transaction.
4. Copy unsigned.txt to a thumb drive.
5. Open unsigned.txt with my Offline Wallet, sign the transaction, and save it back to the thumb drive.
6. Visually verify raw signed transaction on my laptop.  
7. Open the transaction with the Watching Only Wallet and transmit it to the network.

I kind of forgot about things for 3 years, but now I would like to use Electrum again and I am having problems. I tried to follow the same process I outlined above.

The first issue I had is that when opening the Electrum 2.9.0 Watching Only Wallet with my laptop it is unable to connect to the sever nodes. I upgraded to Electrum 4.0.9. This solved that problem. I am now able to use my Watching Only Wallet using Electrum 4.0.9. Next, I created my unsigned transaction using Electrum 4.0.9 and saved it to disk. I then tried to open the unsigned transaction file to visually verify the outputs. This did not work because the file looks like it is encrypted. Reluctantly, I assumed the transaction was correct and saved it to my thumb drive. Also, I copied Electum 4.0.9 to my thumb drive to upgrade my Offline Wallet PC so that it can read these encrypted unsigned transactions. That is about as far as I got.

On my offline PC with Windows XP os, Electrum 4.0.9 does not work. On starting Electrum I keep getting a windows alert box with "the procedure entry point _wputenv_s could not be located in the dynamic link library mscrt.dll" I did some searching and the best information I could find was that I probably needed to install the "Microsoft Visual C++ redistributable package" from https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=29. This did not work. The package appeared to install, but I still get the same alert box when trying to start Electrum. After more investigating I noticed that Electrum 4.0.9 says it is for Windows 7 and above. I tried to use some other releases of Electrum. It looks like the oldest Elecrum release that will connect to the server nodes is 3.0.1. That version also has the same mscrt.ddl library problem when running on Win XP.

So, That is where I am at now. My questions are;
1. Does anyone know if there are any library(s) that I can install on XP that will allow me to access an old Electrum wallet that is on a Win XP machine?
2. Is there anyway to still visually verify transactions before they get moved to a Offline Wallet PC? I am very uncomfortable with copying unsigned transaction files to the offline pc if I have no idea what is inside these files. I was hoping to be able to still follow a process like I outlined above.  
3. If there is no way to run Electrum on Win XP, how should I correct this situation? Is the best process to copy the Offline Wallet from my Win XP machine and put it on my newer laptop and try to open it there with Electrum 4.0.9? (I am reluctant to loose the security of the Offline Wallet)

Thank you.
James..


 


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: NotATether on December 28, 2020, 12:50:39 AM
Windows XP support is entirely dependent on the version of Python you are using. Python dropped support for Windows XP starting at version 3.5.

The Python bundle available on Electrum's download page needs Python 3.6.1 or higher. But that bundle is just made by installing all the python modules that Electrum uses and bundling them together.

You could try installing Python 3.4 and cloning https://github.com/spesmilo/electrum/tree/4.0.9, installing the dependencies using pip install -r contrib/requirements/requirements.txt. If you also need hardware wallet support, you also need to do  pip install -r contrib/requirements/requirements-hw.txt

Then you should have a working Electrum on Windows XP.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: DireWolfM14 on December 28, 2020, 02:18:12 AM
I think you're overcomplicating things.  If you have the seed phrase, just upgrade the OS to a newer version of Windows if possible, or the current LTS release of Ubuntu.  Then reinstall Electrum and restore the wallet.  Ensure you have the right seed phrase before you nuke the XP OS.

If you created the wallet with imported private keys, you should back those up, of course.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 28, 2020, 02:29:46 AM
Thank you NotATether.

I am having a hard time understanding what you are telling me. Prior to release 3.0.0, Electrum was distributed using a version of python that did run on XP? Since Electrum 3.0.0 the version of python used no longer works on XP?

Are you suggesting that I download the last version of python which supports XP and then attempt to rebuild the Electrum executable using that version of python?

I think I could upgrade the OS. The PC is from 2000. The only reason I was keeping it around was for maintaining my offline wallet.

Regards,
James.



Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: NotATether on December 28, 2020, 03:04:28 AM
Thank you NotATether.

I am having a hard time understanding what you are telling me. Prior to release 3.0.0, Electrum was distributed using a version of python that did run on XP? Since Electrum 3.0.0 the version of python used no longer works on XP?

It had to be because Python 3.5 was released at the end of 2015, while Electrum 3.0.0 was released at the end of 2017. It was too soon back then to drop 3.4.

Are you suggesting that I download the last version of python which supports XP and then attempt to rebuild the Electrum executable using that version of python?

Yes.

I think I could upgrade the OS. The PC is from 2000. The only reason I was keeping it around was for maintaining my offline wallet.

It should be able to run 32-bit Windows 7 provided that it has at least 1GB of memory. I have made it run with just 512MB but it struggles with speed. That'll be much easier for you then, since Python 3.6 is supported on Windows 7 so you can simply use the source distribution.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: pooya87 on December 28, 2020, 05:06:58 AM
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/


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 28, 2020, 06:03:54 AM
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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: HCP on December 28, 2020, 06:38:30 AM
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


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 28, 2020, 08:18:18 AM
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   [Jz U\iαri     }    v\tt4!d,14Ꝉ
      YɍqmUn]:4w:.b:_T    kH0E! +PAk~ xXo0hx{O 0ɰO   DaYYKIt[ʖx)(3;!H0z4#q)   e~Eqk/r}    vZ   q
,ꝧ xn1u_@Ys    vdS8.8WW̵Fc؈[ۈ "ez5nͭ,^
p'.4f Bqi8L        "[޲$\_6Hx̶"        
---

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."




Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: nc50lc on December 28, 2020, 01:55:19 PM
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 (https://bitcoincore.org/en/doc/0.20.0/rpc/rawtransactions/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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: igor72 on December 28, 2020, 06:04:18 PM
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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 28, 2020, 06:04:28 PM
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.  


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: HCP on December 28, 2020, 09:31:04 PM
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! :-\ 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


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: BitMaxz on December 29, 2020, 12:18:35 AM
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

https://i.imgur.com/YbDPIQM.png

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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: coinmaster_47854 on December 29, 2020, 12:25:38 AM
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).



Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: NotATether on December 29, 2020, 12:52:10 AM
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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 29, 2020, 02:44:04 AM
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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: nc50lc on December 29, 2020, 03:15:14 AM
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 (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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: HCP on December 29, 2020, 08:16:05 AM
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 (https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki). 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... ;)

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 (https://cryptii.com/pipes/base64-to-hex) (set "Group By" = None), which gives us this:
Code:
70736274ff0100a002000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb0000000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf60000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac89021d00000100df0200000001bdecc2290de66382eb8c5384f1d9c4482cfbb00c4f6db71db427105b7fa3308d000000006a47304402200a0b02f5bc346324aedac80490af39d2d2d639e01dee391f6629b9fea9c0891e0220754e4ee039e2cd6a483269a572ecf2cabaeec55d6b8d37e487b2e592f661bf72012103b0ef8a6bb035b3d710faa53dc03479ea13f724a358b35208b2c7bd8f835186fafdffffff0222939800000000001976a914aebd0267e135531212e791eb225510be66f03cfe88ac00e1f5050000000017a914a74bd62f91c707ea86bd70a4fab9a650639e8a38876f311b00220602636f8fefa33369d4d2c07c07b00432ede5a155688c7b4fccda7fe845f119e74c0c6b163ff90100000022000000000100e20200000001959746d8e586847e97285ebc2f5ec2fe9e495a04fa396dd31c8e65f0a9cc43c0000000006b483045022100875c175edebd0618155d041ac2723ecd6fc97e4d29ce1f8df5414cad1d29501b02200745ce579fbbe5da28e838ec45330bfe53091f3074d40ae0371870c7b329d2f80121032a614933ee74e2dbfa8196e4c1eadca9d5a13c37760fadb91a2365199eed58eafdffffff0256889800000000001976a9142909ed18fc26e7c67315a57a340266f48c1d454788ac80969800000000001976a9145e32926e03c3c26cb21ce44abca1cdb73ca77c4f88ac09041800220602029734bd50b3af7a9f6d9710009c52f2b740b9ee5bf2251020d6126a1b8d8c380c6b163ff901000000150000000022020206dbf0c9c69646b18c80405e109116c434a57379b8e4fc0c273a6ece707795930c6b163ff9010000002b000000002202033ba344a7661a33329ae181ecb34171cba5a0e56ffc03af440a134166bffbc3510c6b163ff9000000000000000000


Now, looking at the beginning of the file...
Quote
70736274ff0100a002000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb000 0000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf6 0000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e94430 6d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac89 021d00000100df02000000....

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! ;)
a0 == length of data = 0xa0 == 160 bytes == 320 chars
02000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c829cb00000 00000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e064cf600 00000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17e944306d 26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e6766488ac8902 1d00 == actual data value == the unsigned transaction hex! SUCCESS! ;)

If we put that hex into the decodetx utility (https://live.blockcypher.com/btc/decodetx/)... 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 (https://github.com/alexbosworth/psbt) 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'
}


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: NotATether on December 29, 2020, 02:53:14 PM
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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 29, 2020, 07:32:40 PM
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.

70736274ff0100a002000000028e801dd1c31b8f6952d30ab71cb8cc2c0aed06340ad0b07f0895e8b876c82 9cb0000000000fdffffffde91c266e9c9a1a6d073cf5fe48253763855569fc0789e25e7f1f4ec5e 064cf60000000000fdffffff0282839800000000001976a91407f1d4de636e42f16f49988c8dc17 e944306d26588ac80969800000000001976a91450bac67862a3984fe72839af0f14e2ba08e67664 88ac89021d00000100df0200000001bdecc2290de66382eb8c5384f1d9c4482cfbb00c4f6db71db427105b7fa33 08d000000006a47304402200a0b02f5bc346324aedac80490af39d2d2d639e01dee391f6629b9fe a9c0891e0220754e4ee039e2cd6a483269a572ecf2cabaeec55d6b8d37e487b2e592f661bf72012 103b0ef8a6bb035b3d710faa53dc03479ea13f724a358b35208b2c7bd8f835186fafdffffff0222 939800000000001976a914aebd0267e135531212e791eb225510be66f03cfe88ac00e1f50500000 00017a914a74bd62f91c707ea86bd70a4fab9a650639e8a38876f311b00220602636f8fefa33369 d4d2c07c07b00432ede5a155688c7b4fccda7fe845f119e74c0c6b163ff90100000022000000000100e20200000001959746d8e586847e97285ebc2f5ec2fe9e495a04fa396dd31c8e65f0a9cc4 3c0000000006b483045022100875c175edebd0618155d041ac2723ecd6fc97e4d29ce1f8df5414c ad1d29501b02200745ce579fbbe5da28e838ec45330bfe53091f3074d40ae0371870c7b329d2f80 121032a614933ee74e2dbfa8196e4c1eadca9d5a13c37760fadb91a2365199eed58eafdffffff02 56889800000000001976a9142909ed18fc26e7c67315a57a340266f48c1d454788ac80969800000 000001976a9145e32926e03c3c26cb21ce44abca1cdb73ca77c4f88ac09041800220602029734bd 50b3af7a9f6d9710009c52f2b740b9ee5bf2251020d6126a1b8d8c380c6b163ff90100000015000 0000022020206dbf0c9c69646b18c80405e109116c434a57379b8e4fc0c273a6ece707795930c6b163 ff9010000002b000000002202033ba344a7661a33329ae181ecb34171cba5a0e56ffc03af440a134166bffbc3510c6b163 ff9000000000000000000


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.











Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: BitMaxz on December 29, 2020, 11:03:59 PM

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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: HCP on December 30, 2020, 01:29:05 AM
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.



Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 30, 2020, 04:28:54 AM
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.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: HCP on December 30, 2020, 09:12:32 AM
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 ::)


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 30, 2020, 02:52:31 PM
Thank you HCP,

I apologize for letting this go way beyond the scope of my original question. But, I am intrigued by this and I want to learn more.

I completely understand your response. 2 inputs = 2 maps, 2 outputs = 2 maps. But, you created the transaction and know what to expect. How does a person, or algorithm decode this if they have no prior knowledge of the transaction.

My confusion is with the data types that duplicate the values from the other scope.

Scope Type Values    Name    BIP Number
Input     0    PSBT_IN_NON_WITNESS_UTXO    BIP 174
Input     1    PSBT_IN_WITNESS_UTXO    BIP 174
Input     2    PSBT_IN_PARTIAL_SIG    BIP 174
Output    0    PSBT_OUT_REDEEM_SCRIPT    BIP 174
Output    1    PSBT_OUT_WITNESS_SCRIPT    BIP 174
Output    2    PSBT_OUT_BIP32_DERIVATION    BIP 174


Do I need to also look at the format of the data to determine which scope it belongs to? Or, am I guaranteed that each map will contain at least one data type value which is unique across both Input and Output and I can use that to determine which scope the map belongs to?







Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: HCP on December 30, 2020, 06:53:51 PM
I apologize for letting this go way beyond the scope of my original question. But, I am intrigued by this and I want to learn more.
I feel ya... it's why I've been delving into these PSBTs and trying to decode them by hand in a text editor ;)


Quote
I completely understand your response. 2 inputs = 2 maps, 2 outputs = 2 maps. But, you created the transaction and know what to expect. How does a person, or algorithm decode this if they have no prior knowledge of the transaction.
All PSBT's must contain the unsigned transaction as part of the global map, which comes first. So, my "theory" is that you need to decode that transaction to identify the number of inputs/outputs involved. That then allows you to "assume" what the following maps are going to be, knowing that the order is: "Global - Inputs - Outputs"


Quote
My confusion is with the data types that duplicate the values from the other scope.

Scope Type Values    Name    BIP Number
Input     0    PSBT_IN_NON_WITNESS_UTXO    BIP 174
Input     1    PSBT_IN_WITNESS_UTXO    BIP 174
Input     2    PSBT_IN_PARTIAL_SIG    BIP 174
Output    0    PSBT_OUT_REDEEM_SCRIPT    BIP 174
Output    1    PSBT_OUT_WITNESS_SCRIPT    BIP 174
Output    2    PSBT_OUT_BIP32_DERIVATION    BIP 174

Do I need to also look at the format of the data to determine which scope it belongs to? Or, am I guaranteed that each map will contain at least one data type value which is unique across both Input and Output and I can use that to determine which scope the map belongs to?
Yeah, I know what you mean... it's weird seeing the same "Type" value for both Inputs and Outputs and trying to determine which one it is... that confused the hell out of me until I figured out that the unsigned transaction must be included and must be the first item.

So you can derive the number of inputs/outputs from that unsigned tx and then process the rest of the maps.




Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on December 30, 2020, 08:42:09 PM
Ah.. I got it now. I agree. The transaction always comes first and then that tells you the quantity of input and output maps that follow.

I might have considered making the key values unique across all scopes to eliminate the possibility of confusion.

I think all my questions are answered. Thank you. It is a very good discussion.

I am on the lookout for a web based utility that will accept an uploaded psbt file and return a json representation of the transaction. Please let me know if you are aware of one.

I am still waiting for my DVD burner to arrive. Once that gets here I will try to update my legacy hardware with ubuntu and let you know if I get my offline wallet working again.

Kind Regards,
James.







Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: bob123 on December 31, 2020, 05:48:30 PM
I am still waiting for my DVD burner to arrive. Once that gets here I will try to update my legacy hardware with ubuntu and let you know if I get my offline wallet working again.

Windows XP, DVD burner, ... which century are you from?

You don't need to burn disks to run a live linux distro.
Nowadays, we use USB flash drives. They are reusable, smaller and more handy. And they even can store more than 4GB already!  :D


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: HCP on January 01, 2021, 01:59:52 AM
You don't need to burn disks to run a live linux distro.
Nowadays, we use USB flash drives. They are reusable, smaller and more handy. And they even can store more than 4GB already!  :D
Which would be a great idea, except his hardware doesn't support booting from USB... :P

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.


It still doesn't cease to amaze me the lengths people will go to, to keep old hardware ticking along... There is a point where it's just easier (and often cheaper) to simply purchase something a bit more modern ;)


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on January 03, 2021, 11:55:11 PM
Thank you Bob, maybe you missed the first part of the thread. I have a 20yo Pentium with XP that I was using as an offline cold wallet to sign transactions created with my online laptop. It is the only thing I was using that PC for. The most recent version of Electrum does not work on XP. There are legacy versions of Electrum which work on XP, but all of them are too old to connect to any server nodes.

The suggestion was to install Linux on the box. The bios only supports boot up from DVD, floppys or HD. I needed a DVD burner to create an installation disk. I wanted a DVD burner anyway. I have a bunch tvs and dvd players. I also have a couple hundred movie iso files. I wanted to be able to burn movies again too.

So my burner arrived and I gave it a shot, but no success. I tried about 5 varieties of Linux which claimed to be able to run on my hardware. All seem to start ok and show some kind of splash screen, but eventually all would hang and display a plain black screen.

I guess I will need to spend money on something else.

Thanks for all the help.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on January 04, 2021, 04:49:17 PM
I tried Ubuntu 16.4, Lubuntu 18.4 & 16.4, a few versions of puppy.

I don't feel it matters though. I think the idea was doomed to fail from the start. I see that the Linux build of Electrum is for 64bit. My hardware is 32bit.

I am thinking about creating a Linux VM to run inside of Windows 10. Then keep my signing wallet inside that VM and only mount that VM when the laptop is not connect to WIFI. It is not exactly a cold wallet, but I think it gives me a little more security.




Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on January 04, 2021, 05:48:30 PM
Hey guys,

I just noticed that the documentation suggests that I could use an android phone to sign the transactions. I am sure I have an old phone around here that I could factory reset and leave in airplane mode. That might be a good solution. Does anyone know if the Android version will work in this fashion? (Completely off line.)

Thanks,
James.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: DaveF on January 04, 2021, 05:55:47 PM
Hey guys,

I just noticed that the documentation suggests that I could use an android phone to sign the transactions. I am sure I have an old phone around here that I could factory reset and leave in airplane mode. That might be a good solution. Does anyone know if the Android version will work in this fashion? (Completely off line.)

Thanks,
James.


It should...with a few issues:
1) You will have to get an OTG cable so you can plug a USB drive into the phone.
2) Not all phones allow this.
3) On the ones that do not all of them like all USB drives some do not put out enough power to actually run them.
4) Now does your phone see the files on the stick and allow you to read / write to it?

I don't know where you are in the world or what your budget is, but you can get a cheap ($50 or less) Win 7 laptop that you can update to Win 10 in most places.

-Dave


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: igor72 on January 04, 2021, 09:18:17 PM
I tried Ubuntu 16.4, Lubuntu 18.4 & 16.4, a few versions of puppy.

I don't feel it matters though. I think the idea was doomed to fail from the start. I see that the Linux build of Electrum is for 64bit. My hardware is 32bit.
Maybe you didn't see my post above? I use LXLE 32-bit, it's a very light system and the latest Electrum installs on it without problems and works fine.

https://lxle.net/


It should...with a few issues
There is no need for all this. It's more convenient and reliable to work with QR codes.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on January 05, 2021, 01:11:36 AM
I saw it, but I did not try that OS. I will give it a try.

But, How were you able to get the 64 bit electrum to run on a 32 bit OS?





Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on January 05, 2021, 02:25:49 AM
OK. Tried it. Kernal panic.

It does not matter, but I am pretty sure I will have problems with a 64 bit on a 32 bit os anyway.



Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: pooya87 on January 05, 2021, 04:48:12 AM
I tried Ubuntu 16.4, Lubuntu 18.4 & 16.4, a few versions of puppy.

I don't feel it matters though. I think the idea was doomed to fail from the start. I see that the Linux build of Electrum is for 64bit. My hardware is 32bit.
Electrum is actually 32 bit and can run on both 32 and 64 bit operating systems. You should make sure that the Linux distribution that you are installing is a 32 bit version because you can't install it otherwise.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on January 05, 2021, 04:06:24 PM

Electrum is actually 32 bit and can run on both 32 and 64 bit operating systems. You should make sure that the Linux distribution that you are installing is a 32 bit version because you can't install it otherwise.

Which download are you speaking about? The Linux version located at: https://download.electrum.org/4.0.9/electrum-4.0.9-x86_64.AppImage is a 64 bit executable.



Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: bob123 on January 05, 2021, 04:17:35 PM
Electrum is actually 32 bit and can run on both 32 and 64 bit operating systems. You should make sure that the Linux distribution that you are installing is a 32 bit version because you can't install it otherwise.
Which download are you speaking about? The Linux version located at: https://download.electrum.org/4.0.9/electrum-4.0.9-x86_64.AppImage is a 64 bit executable.

The Windows binary can be run on a 32 bit system.
And on linux, you could simply use python to run it on a 32 bit system. You don't need to use the .AppImage file, given that python3.6+ is installed.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on January 05, 2021, 05:21:44 PM
I think people are steering me in the wrong direction. My question was about how to get an Electrum offline wallet running again on a very old desktop. Most of the advice is ignoring my hardware and assuming this is a newer PC. I think I am forced to upgrade now.

Thanks.



Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: HCP on January 05, 2021, 08:10:32 PM
Unfortunately, getting it running on that old hardware is not going to be a simple "point and click" type task... Granted there are still Linux distros out there catering to "old hardware", but they usually involve an amount of customisation to run on CPUs missing certain "modern" features and instruction sets (PAE, SSE3 etc).

Without knowing the exact specs of what you're running... ie. the exact CPU/mobo model and the amount of RAM we're working with, it's difficult to make a specific recommendation on which linux distro you should try (and how to configure it).


Alternatively, the "easy but more expensive" option is to simply buy updated hardware :P


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on January 05, 2021, 10:06:56 PM
It is a PIII 850 with 384M Ram.

What I found is that any OS that will run on it, will not have a version of python which works with the current release of Electrum.

I might go with using a non-activated android phone. I don't really like this though because it seem like they are always trying to connect to some kind of network.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: BitMaxz on January 05, 2021, 11:18:03 PM
I might go with using a non-activated android phone. I don't really like this though because it seem like they are always trying to connect to some kind of network.

Well, I have an Android phone Samsung note 2 which is old I recently removed the wifi/Bluetooth IC module directly from the board to make sure it won't connect to any wifi network and only use it for airgap wallet.

If you want to do the same I think you can do the same but you need a phone tech and tell them to remove those ICs. Now I'm using it as my airgap wallet with a clear camera for scanning QR codes and singing transactions.


Title: Re: Upgrade problems from legacy version of Electrum. Coins stuck on WinXP PC wallet
Post by: 77Network on January 06, 2021, 04:00:03 AM
I like that idea. I did replace the screen on a phone once. Maybe there is something on youtube that will show me how to remove those parts.

Thanks.