The chaincode of the master private key is derived from a 256 bit seed following BIP 32:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#user-content-Master_key_generationThe seed itself is discarded once the master private key is computed as it is extraneous information that is never used once the master private key is produced.
It is unclear to me what problem you are actually trying to solve. None of what you described makes any sense, and it seems like this is an
XY Problem. Please describe what it is you are trying to achieve, not what it is you think the way to the solution is.
hehe thanks, yes you are right - my explanation was not so good. Let me take it from the beginning, by explaining what it is that i am trying to do.
I have a Legacy wallet and i dump it with bitcoin cli. (dumpwallet "c:/path/to")
result;
# extended private masterkey: xprv9s21ZrQH143K39Uh6WDcTpGFfvhHrFvuELiMGfgcTmyDWyFwUEyM5bPDr1izEkdvPz8YoU4inik
zq5FgqGqheZ9N1g8JY9ZYB5rQfDTvQy3
#
#...1000+ privkeys
# KzMmTGLuLCtGpgHNVPZiPmkY5r1dmrRh4JVMhsPAH7s9dXgvCNf8 2024-10-01T15:19:13Z hdseed=1 # addr=bc1qt25vctmf...................
hdkeypath=mThe goal is to verify that i can recreate the extended private masterkey;
1. decode the WIF back to raw privkey: 5da81cba4308754d78458f31fcf8d656cfe545f88d3e20b61be65c30976881be
2. use the raw privkey as entrophy with hmac512, and generate an xpriv:
result;
# xpriv: xprv9s21ZrQH143K39Uh6WDcTpGFfvhHrFvuELiMGfgcTmyDWyFwUEyM5bPDr1izEkdvPz8YoU4inik
zq5FgqGqheZ9N1g8JY9ZYB5rQfDTvQy3
//////////////////////////////////
Sorry for the mess, but as you can see, i was able to derive the xpriv from the legacy wallet - because the seed was stored as a priv key and then used as entropy. In descriptorwallets, i cant find the seed in the same way.
i run "listdescriptors true" and the xpriv is shown:
xprv9s21ZrQH143K2XZn9uKACsWBgS8XQEp4biHSmAHkJhzfxrRMrC8AetMqJ3fSb7kt6VUy7xq1nCW
npxipqZ4osUVypWkf8hZPCrvS27xnZyQ
when i decode this xpriv, it is clear it was made with:
chain code: 2f1e6d9c24fce6e898a26f5c13256c605fdd02d807fb4090e92b59d830afc56c
priv::::::::: b7e80b043fb168604c965dcb680509423513b9daa6dd44d1ec132e9169e1d99e
So either i need to find both the chain code and the priv, or i need the seed that created the chaincode and priv.
I dump all key/values in the SQLite database, and i find this:
key:
1377616c6c657464657363726970746f726b657974fd7bafbfd88fda0f6f16e61d4cedd5671e0c1
ff97ee5dd8a5053bef4e58eb6210349a3cabb153821e449073100b11a595c4b684fc59adf6fa626
4138239350eab6
value:
d63081d30201010420
b7e80b043fb168604c965dcb680509423513b9daa6dd44d1ec132e9169e1d99ea08185308182020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffff
ffffffffffffffffffffffefffffc2f300604010004010704210279be667ef9dcbbac55a06295ce
870b07029bfcdb2dce28d959f2815b16f81798022100fffffffffffffffffffffffffffffffebaa
edce6af48a03bbfd25e8cd0364141020101a1240322000349a3cabb153821e449073100b11a595c
4b684fc59adf6fa6264138239350eab66b7a19cc76de134e8bda6240f1305744143299881755702
ef104130f0a5badab
at byteoffset 10 to 42 in the value you see the privkey from the decoded xpriv, but where is the chain code? or better, where is the seed that created the priv and xpriv? I assume its there somewhere as bitcoin core was able to generate the xpriv??
hope its not too cluttery of a question..