I want to spend 0.01 tBTC from vout 0 of txid 5fbce786b0bd9f46e0511a5e8091d57900e2eb5d4132375aada3e964a75e6ca5
on testnet
from: n2eTmd37KTGhRZNJsf9tfVdCG1YejciETu (0.01 tBTC)
to: 0.005 tBTC -> 2NCo1Y7JJgLabJ5AQjBpgavyX1JLWJxGPYK
change: 0.004 tBTC -> n2eTmd37KTGhRZNJsf9tfVdCG1YejciETu
fees: 0.001 tBTC
createrawtransaction '[{"txid":"5fbce786b0bd9f46e0511a5e8091d57900e2eb5d4132375aada3e964a75e6ca5","vout":0}]'
'{"2NCo1Y7JJgLabJ5AQjBpgavyX1JLWJxGPYK":0.005, "n2eTmd37KTGhRZNJsf9tfVdCG1YejciETu":0.004}'
output:
0100000001a56c5ea764e9a3ad5a3732415debe20079d591805e1a51e0469fbdb086e7bc5f0000
000000ffffffff0220a107000000000017a914d66d4e8e58f8e1457fd3c3dff2def8f7075fa778
87801a0600000000001976a914e7c6286efb8730ef8211964f5046e0a0e3568bf788ac00000000
the problem is when I try to sign that tx:
signrawtransaction "0100000001a56c5e...211964f5046e0a0e3568bf788ac00000000"
'[]' '["75e8fd535e581ba...12e23500a96ee675"]'
output: Invalid private key (code -5)
I also tried with WIF format: 14xCi3eQ3AJvk...xyEQRooQNv1GGQSb
with the same output...
what's wrong ?
If I don't use the wallet of bitcoind, should I provide the "scriptPubKey"
and the redeemScript ? If yes, it's easy to find the scriptPubKey in the previous
tx but how do I create the redeemScript ?
to verify that my private Key is valid, I tested it with bitcore (node.js):
bitcore = require('bitcore');
bitcore.Networks.defaultNetwork = 'testnet';
var privateKey = new bitcore.PrivateKey('75e8fd535e581ba...12e23500a96ee675');
console.log('privateKey: ' + privateKey); // 75e8fd535e581ba...12e23500a96ee675
var exported = privateKey.toWIF();
console.log('exported privateKey: ' + exported); // 14xCi3eQ3AJvk...xyEQRooQNv1GGQSb
var publicKey = privateKey.toPublicKey();
console.log('publicKey: ' + publicKey); // 03f0435d4a6284...c14d33566929584990
var addressTest = publicKey.toAddress(bitcore.Networks.testnet);
console.log('address testnet: ' + addressTest); // n2eTmd37KTGhRZNJsf9tfVdCG1YejciETu <-- OK