Thursday, September 19, 2024
HomeBitcoinbitcoin core - The way to import handle with personal key utilizing...

bitcoin core – The way to import handle with personal key utilizing importmulti


Downside. importmulti operate has lots of parameters and they’re harder to understanding then the parameters of one other Bitcoin RPC-API features. Those that are usually not profi in trendy cryptographic achievements have troublesome with understanding how one can use importmulti operate.

Right here is the duty that demonstrates the issue.
There may be 2 wallets with the Bitcoin Core v.0.19.1:
wallet1 – the pockets with personal key for export.
wallet2 – empty pockets into which we have to import the PK+handle from wallet1.

So within the wallet1 now we have the bitcoin handle created by getnewaddress.

[root@wallet1 ~]# bitcoin-cli getaddressinfo 3M5e4QMBUYtpEewwuuoWCArpiM2fT4KEDy
{
  "handle": "3M5e4QMBUYtpEewwuuoWCArpiM2fT4KEDy",
  "scriptPubKey": "a914d4b1b498c8be8813273937b834be6d9d1f488b9087",
  "ismine": true,
  "solvable": true,
  "desc": "sh(wpkh([675dc179/0'/0'/0']02607cb6c05a575fd040498ec8c44eabfa2a4f0fc320aeacf494a77b3a408d84af))#r6dvu4wk",
  "iswatchonly": false,
  "isscript": true,
  "iswitness": false,
  "script": "witness_v0_keyhash",
  "hex": "00144c88353345f2e03abc8e96b818fd030c3c9f59ab",
  "pubkey": "02607cb6c05a575fd040498ec8c44eabfa2a4f0fc320aeacf494a77b3a408d84af",
  "embedded": {
    "isscript": false,
    "iswitness": true,
    "witness_version": 0,
    "witness_program": "4c88353345f2e03abc8e96b818fd030c3c9f59ab",
    "pubkey": "02607cb6c05a575fd040498ec8c44eabfa2a4f0fc320aeacf494a77b3a408d84af",
    "handle": "bc1qfjyr2v697tsr40ywj6up3lgrps7f7kdtvw6mnu",
    "scriptPubKey": "00144c88353345f2e03abc8e96b818fd030c3c9f59ab"
  },
  "label": "",
  "ischange": false,
  "timestamp": 1589545405,
  "hdkeypath": "m/0'/0'/0'",
  "hdseedid": "7cf768d4050dc142a69a149666798cc434045c6c",
  "hdmasterfingerprint": "675dc179",
  "labels": [
    {
      "name": "",
      "purpose": "receive"
    }
  ]
}

[root@wallet1 ~]# bitcoin-cli dumpprivkey 3M5e4QMBUYtpEewwuuoWCArpiM2fT4KEDy
Kwngf5FSYmHM5oPHjSoKxtHWUxXiQ5YN5ZR6shmzkYpMMftBh92c

I’ve tried to import that handle to wallet2 however have failed.

[root@wallet2 ~]# bitcoin-cli importmulti '[{ "scriptPubKey": { "address": "3M5e4QMBUYtpEewwuuoWCArpiM2fT4KEDy" }, "timestamp":"now", "keys": { "Kwngf5FSYmHM5oPHjSoKxtHWUxXiQ5YN5ZR6shmzkYpMMftBh92c":0 }  }]' '{"rescan": false}'

outcome
[
  {
    "success": false,
    "error": {
      "code": -1,
      "message": "Missing required fields"
    }
  }
]

What the right method to import that handle utilizing importmulti? Present the instance please.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments