From the developer doc:
signrawtransaction <hex string> [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [<privatekey1>,...] [sighash="ALL"]
Sign as many inputs as possible for raw transaction (serialized, hex-encoded).
1)
The first argument may be several variations of the same transaction concatenated together;
signatures from all of them will be combined together, along with signatures for keys in the local wallet.
I want to spend only 1 output which needs only 1 signature (P2PK):
My first argument is the result of:
createrawtransaction '[{"txid":"5fbce786b0bd9f46e0511a5e8091d57900e2eb5d4132375aada3e964a75e6ca5","vout":0}]'
'{"2NCo1Y7JJgLabJ5AQjBpgavyX1JLWJxGPYK":0.005, "n2eTmd37KTGhRZNJsf9tfVdCG1YejciETu":0.004}'
--> "0100000001a56c5ea764e9a3ad5a3732415debe20079d591805e1a51e0469fbdb086e7bc5f00000
00000ffffffff0260e316000000000017a91
4d66d4e8e58f8e1457fd3c3dff2def8f7075fa77887801a0600000000001976a914e7c6286efb87
30ef8211964f5046e0a0e3568bf788ac00000000"
2)
The optional second argument is an array of parent transaction outputs,
so you can create a chain of raw transactions that depend on each other before sending them to the network
This argument is optionnal: I only have 1 tx with 1 input, not a chain
(the parent tx is confirmed, I don't have a chain of tx to include in the same block)
the second argument is empty:
--> '[]'
Just to make sure: I tried with the previous tx output with no difference:
'[{"txid":"5fbce786b0bd9f46e0511a5e8091d57900e2eb5d4132375aada3e964a75e6ca5","vout":"0","scriptPubKey":"76a914e7c6286efb8730ef8211964f5046e0a0e3568bf788ac"}]'
3)
Third optional argument is an array of base58-encoded private keys that,
if given, will be the only keys used to sign the transaction.
the previous output is a simple array of one private Key (P2PK) corresponding to n2eTmd37KTGhRZNJsf9tfVdCG1YejciETu
since I don't use the bitcoind wallet, I MUST give this private Key (it's not in the wallet)
this private key should be in base-58
--> '["14xCi3eQ3AJvk...xyEQRooQNv1GGQSb"]'
4)
The fourth optional argument is a string that specifies how the signature hash
is computed, and can be "ALL", "NONE", "SINGLE", "ALL|ANYONECANPAY", "NONE|ANYONECANPAY", or "SINGLE|ANYONECANPAY".
I'm not sure about this one, If i try anything ("ALL", "NONE", "SINGLE"),
I still have the "Invalid private key" error
The default value is sighash="ALL" so this last argument is empty
The final command is the same as in my first post but with the base-58 private key: 14xCi3eQ3AJvk...xyEQRooQNv1GGQSb
with the same error: "Invalid private key (code -5)"
signrawtransaction "0100000001a56c5ea764e9a3ad5a3732415debe20079d591805e1a51e0469fbdb086e7bc5f0000000000ffffffff0260e316000000000017a914d66d4e8e58f8e1457fd3c3dff2def8f7075fa77887801a0600000000001976a914e7c6286efb8730ef8211964f5046e0a0e3568bf788ac00000000"
'[]' '["14xCi3eQ3AJvk...xyEQRooQNv1GGQSb"]'
I don't see what my problem is.