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?

3

2 Answers 2

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().

2
  • ah.. so let me make the step by step Jan 24 at 14:23
  • 1
    @MichelvanKessel: Self-answers are encouraged, so please post it as an answer here!
    – Murch
    Jan 24 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.