Sunday, December 22, 2024

personal key import – How do I take advantage of descriptors to place an historical priv-key right into a newly created pockets.dat file?

Working bitcoin core 26.0 on debian 12. I need to put an historical priv-key right into a newly created pockets.dat file. First, I am going to do a check run:

$ bitcoin-cli createwallet check
$ bitcoin-cli loadwallet /dwelling/person/.bitcoin/wallets/check/

This pockets.dat exists just for testing functions and might be deleted shortly. Earlier than it is deleted although, and strictly for testing solely, I need to put the priv-key revealed on https://en.bitcoin.it/wiki/Private_key:

priv-key= 5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF
corresponding handle= 1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj

… into this test-only pockets.dat file. This specific priv-key is after all right here solely as a place-holder; no one of their proper thoughts would need this priv-key anyplace close to a dwell pockets.dat file.

$ bitcoin-cli getdescriptorinfo 'combo(5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF)'
{
  "descriptor": "combo(04588d202afcc1ee4ab5254c7847ec25b9a135bbda0f2bc69ee1a714749fd77dc9f88ff2a00d7e752d44cbe16e1ebcf0890b76ec7c78886109dee76ccfc8445424)#nf3atn7u",
  "checksum": "qlt7uqzu",
  "isrange": false,
  "issolvable": true,
  "hasprivatekeys": true
}

$ bitcoin-cli importdescriptors '[{"desc":"combo(5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF)#qlt7uqzu","timestamp":"now"}]'
[
  {
    "success": true
  }
]

… in order that priv-key ought to be within the pockets.dat now, so I do a fast check:

$ bitcoin-cli getaddressinfo 1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj
{
  "handle": "1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj",
  "scriptPubKey": "76a9147ac00f979ff0df2fdcb65761dc8f9ef8b37142db88ac",
  "ismine": true,
  "solvable": true,
  "desc": "pkh([7ac00f97]04588d202afcc1ee4ab5254c7847ec25b9a135bbda0f2bc69ee1a714749fd77dc9f88ff2a00d7e752d44cbe16e1ebcf0890b76ec7c78886109dee76ccfc8445424)#yyv2g3h5",
  "parent_desc": "combo(04588d202afcc1ee4ab5254c7847ec25b9a135bbda0f2bc69ee1a714749fd77dc9f88ff2a00d7e752d44cbe16e1ebcf0890b76ec7c78886109dee76ccfc8445424)#nf3atn7u",
  "iswatchonly": false,
  "isscript": false,
  "iswitness": false,
  "pubkey": "04588d202afcc1ee4ab5254c7847ec25b9a135bbda0f2bc69ee1a714749fd77dc9f88ff2a00d7e752d44cbe16e1ebcf0890b76ec7c78886109dee76ccfc8445424",
  "iscompressed": false,
  "ischange": false,
  "timestamp": 1231006505,
  "hdkeypath": "m",
  "hdseedid": "0000000000000000000000000000000000000000",
  "hdmasterfingerprint": "7ac00f97",
  "labels": [
    ""
  ]
}

… so that appears good. Subsequent factor is to rescan the blockchain, wait a number of hours, and the btc managed by that priv-key (doubtless an quantity equal to zero on this case, clearly!) ought to be out there to be spent by the bitcoin core consumer after the rescan is finished.

Did I miss something out? If I take advantage of this methodology to place a priv-key that controls a non-zero btc worth right into a dwell pockets.dat file, will I have the ability to use that pockets.dat file in bitcoin core 26.0 to spend the btc?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles