I can't use the Vpub keys because bitcoin-cli (v0.21.0.0) throws this message:
key 'vpub5UXsYa6RJKsn5DYT52PanEWhidjBRpt11vx7Y3MP4ShSRnEH9TZrGN2Cg4KjK2GVJNg2ynpZzq8YC1Jr1m3cnTfV8wsNT7EwTaYMy4PCDAg' is not valid.
I just did a quick test and it seems to work OK when using
Legacy Electrum MultiSig wallets (see example below)... However, when attempting to use "Vpubs" from an Electrum
SegWit multisig... I also get the "key 'Vpub5g.....FA5' is not valid (code -5)" error
Seems like Bitcoin Core is not recognising the "Vpub" as being a valid key for whatever reason?
A couple of points to note for anyone following along at home:
1. the "child path" you will need to use in your descriptor is: /0/*
2. If you don't want to generate 1000 addresses (the default 'range' setting), then include a "range" in the descriptor
3. You will need a "descriptor checksum" to use
importmulti (use the
getdescriptorinfo call to generate the checksum for your descriptor)
So, I created 3 "standard" wallets in Electrum Testnet... and then created a 2-of-3 MultiSig... this MultiSig uses the three tpubs:
tpubD6NzVbkrYhZ4XgEBrr2NwxfyEehaHfm83BqX79y1QMs5ewSkpyQgSFQ9vSfEqiDeHuNU55gABbDMDtfyfVBq6pBgeJmSUxisnqKG89Mgtu3
tpubD6NzVbkrYhZ4XkeJ7kHEo6Bu8fFRM7b5rsYCBBVFesJRNcxuMXhqDCPKiiWxke7mrRDrQAghGsn3MH3xQYFEPbAsutnyMVo835YeToYVB2R
tpubD6NzVbkrYhZ4WP2J1AQDCCzzAJFtbxwrwNAPdGrj7f8fpEKC1yQC3Dio9EvMGF6AGY6oN46Bbea6pgV1hXuTGegPcy5mMY2eUy8gwnesrsF
This wallet generated the following addresses:
So... our "descriptor" will be:
"sh(sortedmulti(2,tpubD6NzVbkrYhZ4XgEBrr2NwxfyEehaHfm83BqX79y1QMs5ewSkpyQgSFQ9vSfEqiDeHuNU55gABbDMDtfyfVBq6pBgeJmSUxisnqKG89Mgtu3/0/*,tpubD6NzVbkrYhZ4XkeJ7kHEo6Bu8fFRM7b5rsYCBBVFesJRNcxuMXhqDCPKiiWxke7mrRDrQAghGsn3MH3xQYFEPbAsutnyMVo835YeToYVB2R/0/*,tpubD6NzVbkrYhZ4WP2J1AQDCCzzAJFtbxwrwNAPdGrj7f8fpEKC1yQC3Dio9EvMGF6AGY6oN46Bbea6pgV1hXuTGegPcy5mMY2eUy8gwnesrsF/0/*))"
NOTE the /0/* child paths
Ok, so we have our descriptor, now we need the checksum:
getdescriptorinfo DESCRIPTOR_STRING_GOES_HERE
getdescriptorinfo "sh(sortedmulti(2,tpubD6NzVbkrYhZ4XgEBrr2NwxfyEehaHfm83BqX79y1QMs5ewSkpyQgSFQ9vSfEqiDeHuNU55gABbDMDtfyfVBq6pBgeJmSUxisnqKG89Mgtu3/0/*,tpubD6NzVbkrYhZ4XkeJ7kHEo6Bu8fFRM7b5rsYCBBVFesJRNcxuMXhqDCPKiiWxke7mrRDrQAghGsn3MH3xQYFEPbAsutnyMVo835YeToYVB2R/0/*,tpubD6NzVbkrYhZ4WP2J1AQDCCzzAJFtbxwrwNAPdGrj7f8fpEKC1yQC3Dio9EvMGF6AGY6oN46Bbea6pgV1hXuTGegPcy5mMY2eUy8gwnesrsF/0/*))"
This should generate something like:
{
"descriptor": "sh(sortedmulti(2,tpubD6NzVbkrYhZ4XgEBrr2NwxfyEehaHfm83BqX79y1QMs5ewSkpyQgSFQ9vSfEqiDeHuNU55gABbDMDtfyfVBq6pBgeJmSUxisnqKG89Mgtu3/0/*,tpubD6NzVbkrYhZ4XkeJ7kHEo6Bu8fFRM7b5rsYCBBVFesJRNcxuMXhqDCPKiiWxke7mrRDrQAghGsn3MH3xQYFEPbAsutnyMVo835YeToYVB2R/0/*,tpubD6NzVbkrYhZ4WP2J1AQDCCzzAJFtbxwrwNAPdGrj7f8fpEKC1yQC3Dio9EvMGF6AGY6oN46Bbea6pgV1hXuTGegPcy5mMY2eUy8gwnesrsF/0/*))#7mwe6979",
"checksum": "7mwe6979",
"isrange": true,
"issolvable": true,
"hasprivatekeys": false
}
And we can see that it has handily calculated the checksum (7mwe6979)... and also appended it for us!
So... our "descriptor#checksum" string is now:
"sh(sortedmulti(2,tpubD6NzVbkrYhZ4XgEBrr2NwxfyEehaHfm83BqX79y1QMs5ewSkpyQgSFQ9vSfEqiDeHuNU55gABbDMDtfyfVBq6pBgeJmSUxisnqKG89Mgtu3/0/*,tpubD6NzVbkrYhZ4XkeJ7kHEo6Bu8fFRM7b5rsYCBBVFesJRNcxuMXhqDCPKiiWxke7mrRDrQAghGsn3MH3xQYFEPbAsutnyMVo835YeToYVB2R/0/*,tpubD6NzVbkrYhZ4WP2J1AQDCCzzAJFtbxwrwNAPdGrj7f8fpEKC1yQC3Dio9EvMGF6AGY6oN46Bbea6pgV1hXuTGegPcy5mMY2eUy8gwnesrsF/0/*))#7mwe6979"
And now we can just use
importmulti:
importmulti '[{"desc":"sh(sortedmulti(2,tpubD6NzVbkrYhZ4XgEBrr2NwxfyEehaHfm83BqX79y1QMs5ewSkpyQgSFQ9vSfEqiDeHuNU55gABbDMDtfyfVBq6pBgeJmSUxisnqKG89Mgtu3/0/*,tpubD6NzVbkrYhZ4XkeJ7kHEo6Bu8fFRM7b5rsYCBBVFesJRNcxuMXhqDCPKiiWxke7mrRDrQAghGsn3MH3xQYFEPbAsutnyMVo835YeToYVB2R/0/*,tpubD6NzVbkrYhZ4WP2J1AQDCCzzAJFtbxwrwNAPdGrj7f8fpEKC1yQC3Dio9EvMGF6AGY6oN46Bbea6pgV1hXuTGegPcy5mMY2eUy8gwnesrsF/0/*))#7mwe6979","range":10,"timestamp":"now"}]'
Important things to note for this example... we use sortedmulti() as the keys need to be order lexographically... I specified the "range" as 10 for brevity... if you leave the range out, Bitcoin Core will default to generating 1000 addresses!
and you'll understand why we don't want 1000 for our test in a bit
"timestamp":"now" basically says, I've only just created these keys, so don't bother rescanning... again, this was to save time testing purposes... so the result won't actually show the transaction history for these addresses... (for the record, I actually did a
rescanblockchain 1905760 to scan from block 1905760 and it found the appropriate transactions
)
Anyway... this command gives:
[
{
"success": true,
"warnings": [
"Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."
]
}
]
GREAT SUCCESS! and looking in "Receiving Addresses" in Bitcoin Core (Testnet):
We have the same addresses as generated by Electrum... (just displayed in a different order! Now do you understand why we set the range to 10 and not 1000??!?
)