I'm working on a short multisig demo, for this demonstration I WONT USE valid transaction data.
Details:
User1
address: 18Vp4TR9ge77G6G5qc4duAt6CcTckJzeev
pubkey: 02ca9e597cbcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9
privkey: L5ZQpAvvMVuMkbzu8FotsHAns6pXhsjXpQN76g3vGGTyPJ55yB7F
User2
address: 1LbhrdNvvw14nW725Zy5TepVm2vzinubQ9
pubkey: 026401fa4620e2bba87d60be6417e54088cdfefa6b82f34e23853ec12169bc64b4
privkey: Kx4pxXiUiTJJGUWHekkwSEidmRy76feqn2AJzhsUqhUtG6Ye4Bfo
---
random TXID (64 char long HEX string): df360be739095ab77c7f1624e44c88b4d35920c3a74bb54afe0da03c90a719b0
vout: 0 (faked too)
receiver address: 1Lb4davQ5spNdtPD2Up2BkKk7M2cySqmJE
---
Using bitcoin-cli / bitcoind for this:
1.) generate multisig address:
./bitcoin-cli createmultisig 2 "[\"02ca9e597cbcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9\",\"026401fa4620e2bba87d60be6417e54088cdfefa6b82f34e23853ec12169bc64b4\"]"
returns
{
"address": "3N754Mmx9yy3EkywNZfaayxae1hWLjY8px",
"redeemScript": "522102ca9e597cbcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c921026401f a4620e2bba87d60be6417e54088cdfefa6b82f34e23853ec12169bc64b452ae"
}
2.) create a transaction (we can't use the reedemScript here at the moment)
./bitcoin-cli createrawtransaction "[{\"txid\":\"df360be739095ab77c7f1624e44c88b4d35920c3a74bb54afe0da03c90a719b0\",\"vout\":0}]" "{\"1Lb4davQ5spNdtPD2Up2BkKk7M2cySqmJE\": \"2.00000000\"}"
returns
0200000001b019a7903ca00dfe4ab54ba7c32059d3b4884ce424167f7cb75a0939e70b36df00000
00000ffffffff0100c2eb0b000000001976a914d6db903b985b5c08d802ed5a928435eeb35cb643
88ac00000000
3.) now signing this transaction (using
https://coinb.in/#sign) with User1 key
returns
0200000001b019a7903ca00dfe4ab54ba7c32059d3b4884ce424167f7cb75a0939e70b36df00000
0006b483045022100c0667a1659de526e7f5bf877e4d14bb0f2b62da61540df1605cb35701b05e0
0f02207a181731dac3898d24f714808a6671f11f2a17ff092728760c4c8932569aec8d012102ca9
e597cbcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9ffffffff0100c2eb0b
000000001976a914d6db903b985b5c08d802ed5a928435eeb35cb64388ac00000000
4.) decode the transaction using bitcoind
./bitcoin-cli decoderawtransaction "0200000001b019a7903ca00dfe4ab54ba7c32059d3b4884ce424167f7cb75a0939e70b36df00000 0006b483045022100c0667a1659de526e7f5bf877e4d14bb0f2b62da61540df1605cb35701b05e0 0f02207a181731dac3898d24f714808a6671f11f2a17ff092728760c4c8932569aec8d012102ca9 e597cbcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9ffffffff0100c2eb0b 000000001976a914d6db903b985b5c08d802ed5a928435eeb35cb64388ac00000000"
returns
{
"result": {
"txid": "fd21a05b0727388a76b24efb1fc50f01c4b57278719fd872a55c8938f4869637",
"hash": "fd21a05b0727388a76b24efb1fc50f01c4b57278719fd872a55c8938f4869637",
"version": 2,
"size": 192,
"vsize": 192,
"locktime": 0,
"vin": [
{
"txid": "df360be739095ab77c7f1624e44c88b4d35920c3a74bb54afe0da03c90a719b0",
"vout": 0,
"scriptSig": {
"asm": "3045022100c0667a1659de526e7f5bf877e4d14bb0f2b62da61540df1605cb35701b05e00f02207 a181731dac3898d24f714808a6671f11f2a17ff092728760c4c8932569aec8d[ALL] 02ca9e597cbcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9",
"hex": "483045022100c0667a1659de526e7f5bf877e4d14bb0f2b62da61540df1605cb35701b05e00f022 07a181731dac3898d24f714808a6671f11f2a17ff092728760c4c8932569aec8d012102ca9e597c bcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 2.00000000,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 d6db903b985b5c08d802ed5a928435eeb35cb643 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914d6db903b985b5c08d802ed5a928435eeb35cb64388ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"1Lb4davQ5spNdtPD2Up2BkKk7M2cySqmJE"
]
}
}
]
},
"error": null,
"id": null
}
as you can see our reedemScript from the generated multisig address is NOT included
5.) try to sign this transaction now from bitcoin-cli (to make it "final") using the scriptPubKey 483045022100c0667a1659de526e7f5bf877e4d14bb0f2b62da61540df1605cb35701b05e00f022
07a181731dac3898d24f714808a6671f11f2a17ff092728760c4c8932569aec8d012102ca9e597c
bcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9 from the decoded TX and the reedemScript from our generated multisig address (see above) and privkey of user2
./bitcoin-cli signrawtransaction '0200000001b019a7903ca00dfe4ab54ba7c32059d3b4884ce424167f7cb75a0939e70b36df00000 0006b483045022100c0667a1659de526e7f5bf877e4d14bb0f2b62da61540df1605cb35701b05e0 0f02207a181731dac3898d24f714808a6671f11f2a17ff092728760c4c8932569aec8d012102ca9 e597cbcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9ffffffff0100c2eb0b 000000001976a914d6db903b985b5c08d802ed5a928435eeb35cb64388ac00000000' '[{"txid":"df360be739095ab77c7f1624e44c88b4d35920c3a74bb54afe0da03c90a719b0","vout":0,"scriptPubKey":"483045022100c0667a1659de526e7f5bf877e4d14bb0f2b62da61540df1605cb35701b05e00f022 07a181731dac3898d24f714808a6671f11f2a17ff092728760c4c8932569aec8d012102ca9e597c bcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9","redeemScript":"522102ca9e597cbcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c921026401f a4620e2bba87d60be6417e54088cdfefa6b82f34e23853ec12169bc64b452ae"}]' '["Kx4pxXiUiTJJGUWHekkwSEidmRy76feqn2AJzhsUqhUtG6Ye4Bfo"]'
returns
{
"hex": "0200000001b019a7903ca00dfe4ab54ba7c32059d3b4884ce424167f7cb75a0939e70b36df00000 0006b483045022100c0667a1659de526e7f5bf877e4d14bb0f2b62da61540df1605cb35701b05e0 0f02207a181731dac3898d24f714808a6671f11f2a17ff092728760c4c8932569aec8d012102ca9 e597cbcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9ffffffff0100c2eb0b 000000001976a914d6db903b985b5c08d802ed5a928435eeb35cb64388ac00000000",
"complete": false,
"errors": [
{
"txid": "df360be739095ab77c7f1624e44c88b4d35920c3a74bb54afe0da03c90a719b0",
"vout": 0,
"witness": [
],
"scriptSig": "483045022100c0667a1659de526e7f5bf877e4d14bb0f2b62da61540df1605cb35701b05e00f022 07a181731dac3898d24f714808a6671f11f2a17ff092728760c4c8932569aec8d012102ca9e597c bcbffca277b6adb4275b801cd3b915a8606df0efe4034230356494c9",
"sequence": 4294967295,
"error": "Extra items left on stack after execution"
}
]
Any idea where things go wrong?