Author

Topic: wkeys (Read 117 times)

full member
Activity: 217
Merit: 109
May 23, 2021, 06:58:04 AM
#8
Thanks @HCP, another thing to cross off. Cheers.
HCP
legendary
Activity: 2086
Merit: 4314
May 23, 2021, 06:38:47 AM
#7
It's probably not an old Qt wallet file then. Maybe it's an old exchange wallet? This is a screenshot of part of the wallet file. Thanks for the info.


Errrrr... that's not a wallet file... that's the actual Bitcoin Core source code. Another red herring I am afraid Undecided


You can see the code in walletdb.cpp here that is matching your screenshot:
...
static bool IsKeyType(string strType)
{
    return (strType== "key" || strType == "wkey" ||
            strType == "mkey" || strType == "ckey");
}

DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
{
    pwallet->vchDefaultKey = CPubKey();
...
full member
Activity: 217
Merit: 109
May 23, 2021, 06:10:38 AM
#6
After doing some code archaeology, I am pretty sure that wkey records were never actually used. I am unable to find any point in time where wkey were even able to be written to disk. So it's really odd that you have a wallet file that contains wkeys.

In any case, wkey is supposed to be a private key with some extra metadata. There should be a 4 byte version number, followed by the private key, followed by an 8 byte creation time, followed by an 8 byte expiration time.
It's probably not an old Qt wallet file then. Maybe it's an old exchange wallet? This is a screenshot of part of the wallet file. Thanks for the info.
https://imgur.com/a/gOm4fh8
staff
Activity: 3360
Merit: 6505
Just writing some code
May 22, 2021, 09:05:36 PM
#5
After doing some code archaeology, I am pretty sure that wkey records were never actually used. I am unable to find any point in time where wkey were even able to be written to disk. So it's really odd that you have a wallet file that contains wkeys.

In any case, wkey is supposed to be a private key with some extra metadata. There should be a 4 byte version number, followed by the private key, followed by an 8 byte creation time, followed by an 8 byte expiration time.
HCP
legendary
Activity: 2086
Merit: 4314
May 22, 2021, 07:23:32 PM
#4
Found a reference to these wkey's here: https://renenyffenegger.ch/notes/development/Crypto-Currencies/Bitcoin/wallet

It seems they are no longer used:
wkey: Public key (class CPubKey) followed by a wallet key (class CWalletKey). Apparently no longer used.


Indeed, the most recent versions seem to have removed support completely:
        } else if (strType == DBKeys::OLD_KEY) {
            strErr = "Found unsupported 'wkey' record, try loading with version 0.18";
            return false;

Support was dropped in this commit: https://github.com/bitcoin/bitcoin/commit/0b1f4b3c6685d0a6307926d43d166add538061b7#diff-49a07da77d79017222ba989b99048c0a629d3230988ce7b6b74df0d14f727626


Anyway... it looks like this "wkey" may indeed contain a Private key:
Code: (https://github.com/bitcoin/bitcoin/blob/914923d125f5d17b39b4dc05f666d130e80a68b2/src/wallet/walletdb.cpp#L267-L279)
...
            CKey key;
            CPrivKey pkey;
            uint256 hash;

            if (strType == DBKeys::KEY) {
                wss.nKeys++;
                ssValue >> pkey;
            } else {
                OldKey wkey;
                ssValue >> wkey;
                pkey = wkey.vchPrivKey;
            }
...

You can see the privkey being read out of the wkey object.


The definition of the "OldKey" struct is here: https://github.com/bitcoin/bitcoin/blob/914923d125f5d17b39b4dc05f666d130e80a68b2/src/wallet/wallet.h#L679

Not quite sure how that relates to the raw hex in the wallet file tho... Seems you might just be better off attempting to load the wallet file with an old version of Bitcoin Core (ie. <= 0.18) which should be able to handle the wkey records properly.
full member
Activity: 217
Merit: 109
May 22, 2021, 04:22:55 PM
#3
During my hex editor hard drive search I have stumbled on a wallet file that has wkeys and other keys that are named differently to more modern wallet files. I don't know if wkeys are private keys or not, or whether I need to look at other things in the file. It may come to nothing but I still need to check it out, but I need to understand what I'm looking at. Thanks.
legendary
Activity: 3206
Merit: 2904
Block halving is coming.
May 22, 2021, 03:39:59 PM
#2
I tried to search about this there is no much information that I can find but it might these posts below about wkeys.

- https://bitcointalksearch.org/topic/halfinneybckey-5253789
- https://bitcointalksearch.org/topic/what-has-it-got-in-its-walletses-2962

The version you might be looking at is the oldest Bitcoin-qt wallet that was created in the year 2009 or 2010.
full member
Activity: 217
Merit: 109
May 22, 2021, 02:29:28 PM
#1
Does anyone know what version of Bitcoin Core was the last to use wkeys and how did the wallet.dat differ from later versions. Thanks.
Jump to: