Getting Error "Unable to sign input, invalid stack size (possibly missing key)"

0

I have created a key from using coinstring, and then imported it into my wallet. Then I ran:

bitcoin-cli signrawtransactionwithkey "$rawtxhex" "[\"$mykey$\"]"

But it results in:

Unable to sign input, invalid stack size (possibly missing key)

Any ideas? My mykey is not actually a variable, I am hardcoding it in my specific case so I know it is present.

Lance Pollard

Posted 2019-10-28T14:55:48.407

Reputation: 181

What type of address did you make from the private key?Andrew Chow 2019-10-28T15:32:22.377

@AndrewChow what do you mean? I just pasted the private key directly in that command.Lance Pollard 2019-10-28T15:44:46.887

Before you can sign a transaction with a private key, you need to send Bitcoin to an address that is controlled by that private key. What type of address did you send to? P2PKH? Segwit? Something else?Andrew Chow 2019-10-28T15:59:26.537

@AndrewChow can you please direct me to some documentation, I am not sure what you're talking about. How can I send bitcoin to an address if creating a transaction requires signing something with the key in the first place?Lance Pollard 2019-10-28T18:01:40.493

You don't need to sign anything with the key first to send to an address controlled by it. You need to sign the transaction when you are trying to SPEND those coins. Receiving coins on an address does not require the private key at all except to produce the address in the first place.Andrew Chow 2019-10-28T22:07:18.890

Can you post what $rawtxhex is? How did you create it?Andrew Chow 2019-10-28T22:08:17.290

No answers