1

Can someone create a step by step, how to import a legacy P2PKH WIF key on testnet (let's say cSTHGbKgKLCGDRRn5AgtS7L4KHkqmdBau4nsEw8ckAzXV784bgeR) into Bitcoin Core 25.1 descriptor wallet using the Debug Console?

Vojtěch Strnad
  • 8,292
  • 2
  • 12
  • 40
  • Does any of those answer your question? https://bitcoin.stackexchange.com/a/108392/101498, https://bitcoin.stackexchange.com/a/108392/101498, https://bitcoin.stackexchange.com/a/118130/101498. – Antoine Poinsot Jan 24 '24 at 13:28
  • thanks.. but most solutions are so complicated.. I was hoping that there was a simple 2-3 step process – Michel van Kessel Jan 24 '24 at 13:31
  • Added an answer, you've got a step by step guide in the last link. You simply need to use pkh() instead of pk(). – Antoine Poinsot Jan 24 '24 at 13:35

2 Answers2

3

ah.. so let me make the step by step

  1. getdescriptorinfo "pkh(cSTHGbKgKLCGDRRn5AgtS7L4KHkqmdBau4nsEw8ckAzXV784bgeR)"

result:

{
  "descriptor": "pkh(030264ff3c978d2845efd78ff3092650ff80e49a95bebe2fe2f0e9328f72e31799)#kfn7yc4w",
  "checksum": "h9ya7gkd",
  "isrange": false,
  "issolvable": true,
  "hasprivatekeys": true
}

important info is "checksum": "h9ya7gkd"

  1. importdescriptors '[{"desc":"pkh(cSTHGbKgKLCGDRRn5AgtS7L4KHkqmdBau4nsEw8ckAzXV784bgeR)#h9ya7gkd","timestamp":"now"}]'

At this point I can see my address under receiving addresses

  1. getaddressinfo mv9u2iuhXL86Y4JKHazEYvAzAXvbt5bwwo

result

{
  "address": "mv9u2iuhXL86Y4JKHazEYvAzAXvbt5bwwo",
  "scriptPubKey": "76a914a08e6d3854c35052dd64757f423c1bf91326c5b888ac",
  "ismine": true,
  "solvable": true,
  "desc": "pkh([a08e6d38]030264ff3c978d2845efd78ff3092650ff80e49a95bebe2fe2f0e9328f72e31799)#ywkyykha",
  "parent_desc": "pkh(030264ff3c978d2845efd78ff3092650ff80e49a95bebe2fe2f0e9328f72e31799)#kfn7yc4w",
  "iswatchonly": false,
  "isscript": false,
  "iswitness": false,
  "pubkey": "030264ff3c978d2845efd78ff3092650ff80e49a95bebe2fe2f0e9328f72e31799",
  "iscompressed": true,
  "ischange": false,
  "timestamp": 1706106032,
  "hdkeypath": "m",
  "hdseedid": "0000000000000000000000000000000000000000",
  "hdmasterfingerprint": "a08e6d38",
  "labels": [
    ""
  ]
}
2

This answer contains a step-by-step guide to import a testnet WIF private key under a pk() (for P2PK) descriptor on a Bitcoin Core wallet using the command line. You can use the same commands in a Bitcoin Core GUI Debug Console. For P2PKH, you simply need to substitute pk() for pkh().

Antoine Poinsot
  • 8,334
  • 2
  • 17
  • 34