bitcoin cli – importing data to a wallet as not watch-only


I am trying to use private keys, addresses, and public addresses I generated myself. (for educational purpose).

I am working with bitcoin-cli by inserting the inputs I’ve generated myself. (in CMD)

the following code:

C:\Program Files\Bitcoin\daemon>bitcoin-cli -regtest -named -rpcwallet="legacy" importmulti "[{\"scriptPubKey\":{\"address\":\"<my P2PKH address>\"},\"timestamp\":\"now\",\"pubkeys\":[\"<my compressed public address in hex format>\"],\"keys\":[\"<my private key in WIF format>\"]}]" "{\"rescan\":false}"

returns this output:

[
  {
    "success": true,
    "warnings": [
      "Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag.",
      "Importing as non-solvable: some required keys are missing. If this is intentional, don't provide any keys, pubkeys, witnessscript, or redeemscript."
    ]
  }
]

but I don’t know what keys are missing since I’d generated everything based on the same key
(the order I generated the data:

  1. seed
  2. master key
  3. derived a child key – from now on, I only used the child key
  4. public key based on the child key
  5. P2PKH address based on the public key
  6. copied the values: child key, public key, P2PKH and typed them in the correct place in the template I added above)

Is this because I use only the child key andf not the master key?
How can I prevent importing this data as watch-only?
my main goal is to try to do most of the functions by myself with the least amount of calls necessarily.

  • all the code for generating the data has already been checked and is working as excepted (can provide python code)
  • I intend to use the import so I could use this data in regtest mode for transactions

Thank you all in advance!



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *