Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: init1 on June 28, 2015, 06:02:49 PM



Title: bitcoind RCP multi-signature issue
Post by: init1 on June 28, 2015, 06:02:49 PM
Hello!

I want to create 2 of 3 address and spend from it

1) According to API_calls_list, created 2 of 3 address end send to the address a few coins by http://faucet.haskoin.com

Code:
createMultiSig(2, publicKeys);

Now can check positive balance
https://www.blocktrail.com/tBTC/address/2MuEh1XHKQNKQfzoGTNK2hpr8rLy42WsAbm

2) How can I spend coins from this multi-signature address ?
I have red for spending coins need to create output/input, and create raw transaction

Code:
txOutputIds = [b]txID[/b]
input  = "mmVDgckWdBY4JRabxXBRsWC7yeGZPk8uVk", BigDecimal.valueOf(0.0001));

createRawTransaction(txOutputIds, input);

how cah I get TXid by address 2MuEh1XHKQNKQfzoGTNK2hpr8rLy42WsAbm ?
Can I get TXid by bitciond RCP ?


BR!


Title: Re: bitcoind RCP multi-signature issue
Post by: coinableS on June 29, 2015, 04:07:56 AM
Yes you can using
Code:
listreceivedbyaddress <bitcoinaddress>

This will give you a JSON format output listing transaction IDs:

Code:
{
"address" : "1DmSyCK1jm5twEe61aqyTPb6wmBNctaTxL",
"account" : "",
"amount" : 0.03368750,
"confirmations" : 21348,
"txids" : [
"10a02647a678ca4a9eaf5259ef277ad7741c72188c936bdc22e6ab3cbe17c12f",
"3a3efe97e6df33aefc1ffb55169c8e8c70ab4cc5d6c9665a46a36865c003d42e",
"b29948f6e452ecd9f027d38de9388950f47f53ee1f20eb292f5d29cc573ebda0",
"b2b63e054e5417a40099b5ead2b9ecdce43c71e71c66a1a4a3436ae4192bd9c2",
"ef13aaad12e675ef7e2bc901fcedd981e3160a5e11e75fe28597f4fc80614e4e",
"fbc4cb561bfaa861fe3ff208a31e009c40edeeaa4fde8f7d9284f93a071f3ed4"
]
}

Plug in the TX ID into the getrawtransaction, remember to add the 1 after the txid to get it in JSON format :

Code:
getrawtransaction <txid> 1 //Gets scriptPubKey and vout

Then you can create the raw transaction with the outputs you choose, then sign them and lastly send.

Here's a little cheat sheet I use for raw multi-sig:

Code:
getnewaddress   //Generates new bitcoin address
validateaddress <address>  //Gets publicKey address
dumpprivkey <address>   //Gets the privatekey
getrawtransaction <txid> 1 //Gets scriptPubKey and vout

createmultisig 2 '["","",""]'    //Creates the multisig address

createrawtransaction '[{"txid":"","vout":}]' '{"receive_address":0.0008}'
signrawtransaction 'hash_from_createraw' '[{"txid":"","vout":,"scriptPubKey":"","redeemScript":""}]' '["priv_key"]'
signrawtransaction 'hash_from_signraw' '[{"txid":"","vout":,"scriptPubKey":"","redeemScript":""}]' '["priv_key2"]'
sendrawtransaction <hash_from_2nd_signraw>



Title: Re: bitcoind RCP multi-signature issue
Post by: init1 on June 30, 2015, 12:52:42 PM
Hello!
Thanks you for your answer

Not so clear about this step, could you please explain and link more details

Code:
getrawtransaction <txid> 1 //Gets scriptPubKey and vout

How can I get txid ? in the previous steps ?

I debuged it
Code:
getnewaddress   //Generates new bitcoin address
validateaddress <address>  //Gets publicKey address
dumpprivkey <address>   //Gets the privatekey

Could not find txid.

RB!


Title: Re: bitcoind RCP multi-signature issue
Post by: fbueller on June 30, 2015, 01:36:25 PM
Might be out of date since the watch only address support, but AFAIK bitcoind won't notify you about transactions that it doesn't have all keys for. I'm not sure if watch only supports p2sh. If it does, I'd use that, otherwise, maybe use an API or bitcoind patched with an address index. https://github.com/btcdrak/bitcoin/tree/addrindex