Bitcoin Forum
May 10, 2024, 05:39:10 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: wkeys  (Read 119 times)
morbius55 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 109


View Profile
May 22, 2021, 06:29:28 PM
Merited by ABCbits (1)
 #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.
1715362750
Hero Member
*
Offline Offline

Posts: 1715362750

View Profile Personal Message (Offline)

Ignore
1715362750
Reply with quote  #2

1715362750
Report to moderator
1715362750
Hero Member
*
Offline Offline

Posts: 1715362750

View Profile Personal Message (Offline)

Ignore
1715362750
Reply with quote  #2

1715362750
Report to moderator
1715362750
Hero Member
*
Offline Offline

Posts: 1715362750

View Profile Personal Message (Offline)

Ignore
1715362750
Reply with quote  #2

1715362750
Report to moderator
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715362750
Hero Member
*
Offline Offline

Posts: 1715362750

View Profile Personal Message (Offline)

Ignore
1715362750
Reply with quote  #2

1715362750
Report to moderator
BitMaxz
Legendary
*
Offline Offline

Activity: 3248
Merit: 2970


Block halving is coming.


View Profile WWW
May 22, 2021, 07: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://bitcointalk.org/index.php?topic=5253789.0
- https://bitcointalk.org/index.php?topic=2962.0

The version you might be looking at is the oldest Bitcoin-qt wallet that was created in the year 2009 or 2010.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
morbius55 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 109


View Profile
May 22, 2021, 08: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.
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
May 22, 2021, 11:23:32 PM
Merited by ABCbits (1)
 #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.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
May 23, 2021, 01:05:36 AM
Merited by LoyceV (2), ABCbits (2)
 #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.

morbius55 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 109


View Profile
May 23, 2021, 10: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
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
May 23, 2021, 10:38:47 AM
Last edit: November 14, 2023, 11:49:23 PM by HCP
 #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();
...

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
morbius55 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 109


View Profile
May 23, 2021, 10:58:04 AM
 #8

Thanks @HCP, another thing to cross off. Cheers.
Pages: [1]
  Print  
 
Jump to:  

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