Is there a way to open a wallet in Bitcoin Core and run a command to find out which version was used to create it? Or do wallet.dat files lack any info showing the version that generated them? Sometimes it's unclear what version was used to make the file, and it would be cool to figure that out.
Check wallet version
5 replies 63 views
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.
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#3Apr 25, 2021, 02:27 PM
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".
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)
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.
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#5Apr 26, 2021, 01:15 AM
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.
CyberAtlasMember
Posts: 2 · Reputation: 81
#6Apr 26, 2021, 06:56 AM
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".
Related topics
- Recovering a Bitcoin wallet and address 8
- CipherSeed: A Comprehensive Guide to Super-Secure Crypto Wallet Backups 5
- What derivation path does mm-gen wallet use? 3
- Looking for wallet software that supports custom P2SH redeem scripts? 19
- Simple Offline Wallet (key-pair) Setup on Linux Without GUI 0
- 2010 Wallet Delivery and Encryption Mystery 19