I have a testnet wallet I've used for some time in Coldcard testing, specifically to generate PSBT files for signing exercises. However, this wallet isn't generating PSBT files I want anymore. Specifically, it is making (unsigned, funded) PSBT files referencing a BIP32 fingerprint that I don't expect.
At first I thought it was an issue with encoding the values in the PSBT, and so I dumped the wallet backup to understand the problem.
After some investigation, I find that the wallet backup doesn't contain enough information about the true contents of the wallet. There appears to be two private masterkeys in effect, and I have no way to get the details of the unknown one, aside from its fingerprint.
Using the tprv at the top of the file, I can reconstruct the private key of only 2049 of the 5506 addresses listed in the file.
Specifically, here are two lines that are in conflict (IMHO), because both have the same derivation path, m/0'/0'/100', and yet different private keys!
cU7tcXeY4FtTAx5nH8uGaVSjTLVKfw8KxPmQeRs6nzucuSK33YQJ 2019-04-12T13:39:26Z reserve=1 # addr=2N9UWoUEdn8s2TcBid2wV2KMCp1Fk38r1h8 hdkeypath=m/0'/0'/100'
cRtqv76chtn8KNrgeanMiUFaKHu9hK1E724Rj7fkZ6Rb5cGHR6q2 2018-05-17T14:25:41Z change=1 # addr=2N9aAP4Saa8njbBUkT54fnGpd5q8sGHv5xs hdkeypath=m/0'/0'/100'
The first one makes sense based on the tprv at the top of the file. The other does not, and must be based on a different seed.
(There is only one hdseed=1 line in the wallet backup.)
Doing getaddressinfo on the two addresses, indicates a different hdmasterfingerprint which corresponds to the unhelpful fingerprint I was seeing in the PSBT files:
getaddressinfo 2N9UWoUEdn8s2TcBid2wV2KMCp1Fk38r1h8
{
"address": "2N9UWoUEdn8s2TcBid2wV2KMCp1Fk38r1h8",
"scriptPubKey": "a914b205748e497252c0b8c9aef4ad0c58e240d6980c87",
"ismine": true,
"solvable": true,
"desc": "sh(wpkh([645716a2/0'/0'/100']0350b7abfc54438575aa9cb3ef9e9e3684df49887acbfbbc7f2c1f76b81f96c619))#gypp23kt",
"iswatchonly": false,
"isscript": true,
"iswitness": false,
"script": "witness_v0_keyhash",
"hex": "0014baebc7c67a0313b882d4635cf069736138cc4bba",
"pubkey": "0350b7abfc54438575aa9cb3ef9e9e3684df49887acbfbbc7f2c1f76b81f96c619",
"embedded": {
"isscript": false,
"iswitness": true,
"witness_version": 0,
"witness_program": "baebc7c67a0313b882d4635cf069736138cc4bba",
"pubkey": "0350b7abfc54438575aa9cb3ef9e9e3684df49887acbfbbc7f2c1f76b81f96c619",
"address": "tb1qht4u03n6qvfm3qk5vdw0q6tnvyuvcja6q4027j",
"scriptPubKey": "0014baebc7c67a0313b882d4635cf069736138cc4bba"
},
"ischange": true,
"timestamp": 1555076366,
"hdkeypath": "m/0'/0'/100'",
"hdseedid": "3551b50538470b990d080f23226c37d98312e81e",
"hdmasterfingerprint": "645716a2",
"labels": [
]
}
getaddressinfo 2N9aAP4Saa8njbBUkT54fnGpd5q8sGHv5xs
{
"address": "2N9aAP4Saa8njbBUkT54fnGpd5q8sGHv5xs",
"scriptPubKey": "a914b316e792f59c35560228a5d1d5dc2eca09f98e9c87",
"ismine": true,
"solvable": true,
"desc": "sh(wpkh([d79ed905/0'/0'/100']0222fe08b7bf79fb0e0f82f50e22c1da4d2db33776983c5a883d70d97524694df1))#a8p3w0dm",
"iswatchonly": false,
"isscript": true,
"iswitness": false,
"script": "witness_v0_keyhash",
"hex": "001434471490de4b879e516af87cc9c5569f67335f8b",
"pubkey": "0222fe08b7bf79fb0e0f82f50e22c1da4d2db33776983c5a883d70d97524694df1",
"embedded": {
"isscript": false,
"iswitness": true,
"witness_version": 0,
"witness_program": "34471490de4b879e516af87cc9c5569f67335f8b",
"pubkey": "0222fe08b7bf79fb0e0f82f50e22c1da4d2db33776983c5a883d70d97524694df1",
"address": "tb1qx3r3fyx7fwreu5t2lp7vn32knannxhuteu8h8f",
"scriptPubKey": "001434471490de4b879e516af87cc9c5569f67335f8b"
},
"ischange": true,
"timestamp": 1526567141,
"hdkeypath": "m/0'/0'/100'",
"hdseedid": "e0301044cb99ba73398c9187c32bad4a9cdf9247",
"hdmasterfingerprint": "d79ed905",
"labels": [
]
}
645716a2 is the fingerprint expected, and I have no idea where d79ed905 comes from!
My questions/comments:
- What RPC call do I make to dump the private key with hdseed "d79ed905" ??
- This wallet has been around a while, since 16.0, and might have accumulated some cruft. This analysis was done with 18.0
Generally, WTF is going on here, and is it safe that the wallet backup hasn't captured all the HD seeds?! If it has captured that value, where can I find the secrets for d79ed905 in the wallet backup?