Hello,
I am truing to spend coins from P2SH address.
step by step
1) Generated keys
# https://brainwallet.org/#generator
#SEED 1 => nativeapi seed generatoin one
#privateKey => 5K9T8VGcAztUQs5rSRGnf6oEwymY4k8YJV7MBfU5T3LD4H3wK2E
#publicKey => 045e8385118c8b77a044390364dd5fb8c4864d138491fc788948be81f6842f45bc6b6c9401a90f8479b2af8191b7a6a7735053f2724668cf8af8a2c30d853b8011
#
#SEED 2 => nativeapi seed generatoin two
#privateKey => 5JFoZ6gW7dkwbtZVSyvxneRead1AzaiGvxyVpEa3n6k34321AXA
#publicKey => 042cb46c5cfa2a5af18effd8296e7aeda287d407ccc2e42cc15bb7d27c6f84e4a78ade99d1aa7e8efa2fd63f8573548ec1a33f53e0135ccbe15bc5c9eb0d6e0cfd
#
#SEED 3 => nativeapi seed generatoin three
#privateKey => 5JRrkriuY9s64h4eUBzqSrtZL1UFKgAvrhJPAUaVadrHSBxS75y
#publicKey => 04d109b4e95fd48162e5424fe71d769c9cb4bc8cb40224ab6b8d1e9fac6f6925c34c902d38caebebf2703a7685bf788adfee83bffa637f95d3c782c3d4bb0120f5
2) combine the three keys into a multisig address:
./bitcoind createmultisig 2 '["045e8385118c8b77a044390364dd5fb8c4864d138491fc788948be81f6842f45bc6b6c9401a90f8479b2af8191b7a6a7735053f2724668cf8af8a2c30d853b8011","042cb46c5cfa2a5af18effd8296e7aeda287d407ccc2e42cc15bb7d27c6f84e4a78ade99d1aa7e8efa2fd63f8573548ec1a33f53e0135ccbe15bc5c9eb0d6e0cfd","04d109b4e95fd48162e5424fe71d769c9cb4bc8cb40224ab6b8d1e9fac6f6925c34c902d38caebebf2703a7685bf788adfee83bffa637f95d3c782c3d4bb0120f5"]'
3) Checked address and txid
https://www.blocktrail.com/tBTC/address/2MvDgSTXGEbi9nm4UhP1B6Wvi7LMJ9MAdmu/transactions
30a9e645c8e6c4bedfa10cfb23d6d6448557796181082218504ad252b595bacd
4) Created rawTX
createrawtransaction '''
[
{
"txid": "'30a9e645c8e6c4bedfa10cfb23d6d6448557796181082218504ad252b595bacd'",
"vout": '0'
}
]
''' '''
{
"motbFuaf7Q7xWqBbo7zFu83sdNBspvYkFY": 1.9999
}'''
0100000001cdba95b552d24a50182208816179578544d6d623fb0ca1dfbec4e6c845e6a9300000000000ffffffff01f09aeb0b000000001976a9145bd898bbe4a000cda4418c1fd28178ec99cd653e88ac00000000
5) Decoded raw tx and get - scriptPubKey hex
decoderawtransaction 0100000001cdba95b552d24a50182208816179578544d6d623fb0ca1dfbec4e6c845e6a9300000000000ffffffff01f09aeb0b000000001976a9145bd898bbe4a000cda4418c1fd28178ec99cd653e88ac00000000
{
"txid" : "530aa989a79a2738d2b6b956b6fdc788818fcd334963036aa6d6686598b6d492",
"version" : 1,
"locktime" : 0,
"vin" : [
{
"txid" : "30a9e645c8e6c4bedfa10cfb23d6d6448557796181082218504ad252b595bacd",
"vout" : 0,
"scriptSig" : {
"asm" : "",
"hex" : ""
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 1.99990000,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 5bd898bbe4a000cda4418c1fd28178ec99cd653e OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a9145bd898bbe4a000cda4418c1fd28178ec99cd653e88ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"motbFuaf7Q7xWqBbo7zFu83sdNBspvYkFY"
]
}
}
]
}
6) Tried to sign it by the first key
signrawtransaction '0100000001cdba95b552d24a50182208816179578544d6d623fb0ca1dfbec4e6c845e6a9300000000000ffffffff01f09aeb0b000000001976a9145bd898bbe4a000cda4418c1fd28178ec99cd653e88ac00000000'
'[{"txid":"30a9e645c8e6c4bedfa10cfb23d6d6448557796181082218504ad252b595bacd","vout":0,
"scriptPubKey":"76a9145bd898bbe4a000cda4418c1fd28178ec99cd653e88ac","redeemScript":"5241045e8385118c8b77a044390364dd5fb8c4864d138491fc788948be81f6842f45bc6b6c9401a90f8479b2af8191b7a6a7735053f2724668cf8af8a2c30d853b801141042cb46c5cfa2a5af18effd8296e7aeda287d407ccc2e42cc15bb7d27c6f84e4a78ade99d1aa7e8efa2fd63f8573548ec1a33f53e0135ccbe15bc5c9eb0d6e0cfd4104d109b4e95fd48162e5424fe71d769c9cb4bc8cb40224ab6b8d1e9fac6f6925c34c902d38caebebf2703a7685bf788adfee83bffa637f95d3c782c3d4bb0120f553ae"}]'
'["5K9T8VGcAztUQs5rSRGnf6oEwymY4k8YJV7MBfU5T3LD4H3wK2E"]'
Have got -> Invalid private key (code -5)
What have I done wrong? some incorrect parameters or steps ?
Regards.