Bitcoin Forum
June 17, 2025, 06:58:31 AM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Show wallet version  (Read 183 times)
takuma sato (OP)
Hero Member
*****
Offline Offline

Activity: 666
Merit: 576


Lowest juice, High odds, No player limitations


View Profile
April 24, 2025, 07:01:39 PM
 #1

Is it possible to load a wallet in Bitcoin Core and run a command or something and then return what version the wallet was created at? Or do wallet.dat files have no information imprinted that would disclose what version was used to generate this wallet.dat file? Sometimes you are not sure what version was used to create the file and would be interesting to know.

█████████████
█████████████
█████████████
██▄▄▀▀███▄▄██
█░░░█░░░▀▄█
█▀▄▄██▄░░░███
█░░████▀▀▀▀██
█░█▀▀█░░░░█░█

███░░█▄▄█░█

██▀▀█████▀▀██

█████████████

█████████████

█████████████
█████████████
█████████████
█████████████
██▄▄██░██▄▄██
██▄▀█░█▀▄██
█▀▀▄░▄░▄░▄▀▀█
▄██▀▄█░█▄▀██▄
██░███░███░██

█████░█████

██▀▀██░██▀▀██

█████████████

█████████████

█████████████
 
   bet105     WHERE THE PROS PLAY            BET NO         
 
A R B I T R A G E   B E T      │      L O W   J U I C E     │     B E S T   O D D S      │      N O   K Y C   R E Q U I R E D
█████████████
█████████████
█████████████
█████░▀████
██████▄░▀███
███▀█▀█▄░▀█
▄▀██▄▀▄▀███▄▀
█▄░▀▄█▄████
███▄░▀██████

████▄░█████

█████████████

█████████████

█████████████
█████████████
█████████████
█████████████
██░█████░██
█▌▐█████▌▐█
██░███████░██
█▌▐███████▌▐█
██░███████░██

██▄▀▀▀▀▀▄██
██▀▀█████▀▀██
█████████████

█████████████

█████████████
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3710
Merit: 7186


Just writing some code


View Profile WWW
April 24, 2025, 07:17:41 PM
Merited by LoyceV (6), ABCbits (2), hosemary (2), nc50lc (1)
 #2

The original version used to create the wallet file is not stored. However, there is a version number stored that generally corresponds to a Bitcoin Core version, and this version only changes if you do upgradewallet. However, this version is also largely unused now; instead we use feature flags. There is otherwise no information stored about the Bitcoin Core version used to create the wallet nor the version that last opened the wallet.

nc50lc
Legendary
*
Offline Offline

Activity: 2814
Merit: 7310


Self-proclaimed Genius


View Profile
April 25, 2025, 04:32:39 AM
Last edit: April 25, 2025, 07:55:03 AM by nc50lc
Merited by ABCbits (1), PowerGlove (1)
 #3

Sometimes you are not sure what version was used to create the file and would be interesting to know.
If you don't know how to find the information above, getwalletinfo is the command that you can use to get it.
Additionally, there's a "birthtime" value there that you may find useful, the time is in "epoch".

The original version used to create the wallet file is not stored.
I'm interested to know how can Bitcoin Core fulfil the entry in "last client version = <version>" when an old wallet is loaded the first time to an updated client.

For example: When I restored my test wallet from v0.16.3 to Bitcoin Core v29.0, the debug.log can identify that it's from v0.16.3 (160300)
Code:
2025-04-25T04:25:38Z init message: Loading wallet…
2025-04-25T04:25:38Z [Delete_this2] Wallet file version = 10500, last client version = 160300

achow101
Moderator
Legendary
*
Offline Offline

Activity: 3710
Merit: 7186


Just writing some code


View Profile WWW
April 26, 2025, 02:20:49 AM
Merited by nc50lc (1)
 #4

I'm interested to know how can Bitcoin Core fulfil the entry in "last client version = <version>" when an old wallet is loaded the first time to an updated client.
I thought we had removed that a while ago...

There is a record which was (and I guess still is) updated every time the wallet is opened with the current client version. This is how that log line can report the last client version.

But this record is also not really being used for anything, so I thought we got rid of it, but I suppose we didn't. Otherwise that version stored there is not reported to the user anywhere else.

nc50lc
Legendary
*
Offline Offline

Activity: 2814
Merit: 7310


Self-proclaimed Genius


View Profile
April 26, 2025, 03:26:11 AM
 #5

I thought we had removed that a while ago...
Okay, thanks for the clarification. I'll search the repository for relevant PRs and commits.

@takuma sato You can use the method that I used in my previous reply for now.
But the copy of the wallet.dat backup should be "fresh", means that isn't loaded to a newer version of Bitcoin Core yet.

nochkin
Jr. Member
*
Offline Offline

Activity: 53
Merit: 12


View Profile
May 08, 2025, 03:27:58 AM
 #6

The wallet.dat has a field called "version" which is uint32.
If you don't want to bother with Bitcoin Core client, you can use db_dump or pywallet to get the value.
For example, it may read something like "160300" which corresponds to Bitcoin Core 0.16.3.
I tried to create a new wallet using 28.01 and I got the "version" field properly propagated as "280100".
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!