Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Blackwave on January 22, 2014, 12:24:44 PM



Title: Multisignature
Post by: Blackwave on January 22, 2014, 12:24:44 PM
Hi guys .
I'm trying to integrate multisignature on my site , but I encountered a problem.

What am I doing ?

I create multisig address:
Code:
bitcoind createmultisig 2 '["pubkey1", "pubkey2", "pubkey3"]'

Then I transfer funds generated address. It begins with the number 3

Next, I create a raw transaction:
Code:
bitcoind createrawtransaction '[{"txid": " transfer transaction id here ", "vout": 0} ]' ' { ' address for withdrawal " : 0.1 } '

Then I try to sign the transaction :
Code:
bitcoind signrawtransaction <createrawtranscation result> '[{"txid": " transfer transaction id here ", "vout": 0 , "scriptPubKey": " I ​​took out decoderawtransaction"}]' '["privkey1", "privkey2"]'
But the answer comes - complete: False

What should I do ?

In this case, a bunch of keys (private / public ) is taken from one wallet.


And one more question . If I use the public keys of different wallets, may I sign a transaction private keys on a wallet? I need to import private keys ? But where?

Sorry for my bad English.


Title: Re: Multisignature
Post by: fbueller on January 22, 2014, 02:13:31 PM
You need to run 'addmultisigaddress' to add the address to the wallet. That way it has knowledge of the public keys, and can construct the redeemScript later on. Also, you should also be supplying the redeemScript in the input in signrawtransaction.

Is this PHP? I have an implementation up that works with bitcoind/bitcoinqt. http://multisig.thomaskerin.tk (http://multisig.thomaskerin.tk)

I can send you the code if you wish.


Title: Re: Multisignature
Post by: Blackwave on January 22, 2014, 02:52:46 PM
Yes, this is php. CI with jsonrpcclient as ci library.
Thx :)


Title: Re: Multisignature
Post by: fbueller on January 22, 2014, 03:06:52 PM
Then boy it's your lucky day! I'm using codeigniter as well. I'll upload the project as it is, you just need to configure application/config/bitcoin.php.  I'll post in a sec with a github link just uploading now, try it here: http://multisig.thomaskerin.tk (http://multisig.thomaskerin.tk)

Source code is here: https://github.com/Bit-Wasp/multisig

You should probably have a separate client to use to have the other keys. The server generates a key and imports it immediately. Users are asked to supply the required amount of keys, send money, paste the txid, and enter an address to send the money back to. Then they need to sign the transaction - the software will automatically sign the transaction it generates, but you could leave this out if people wanted to actually do escrow with it.

It only works with bitcoind/qt. If you get multisig transactions to sign in any other client that only has 1 of n keys please let me know!


Title: Re: Multisignature
Post by: Blackwave on January 22, 2014, 03:13:07 PM
Then boy it's your lucky day! I'm using codeigniter as well. I'll upload the project as it is, you just need to configure application/config/bitcoin.php.  I'll post in a sec with a github link just uploading now

You should probably have a separate client to use to have the other keys. The server generates a key and imports it immediately. Users are asked to supply the required amount of keys, send money, paste the txid, and enter an address to send the money back to. Then they need to sign the transaction - the software will automatically sign the transaction it generates, but you could leave this out if people wanted to actually do escrow with it.

It only works with bitcoind/qt. If you get multisig transactions to sign in any other client that only has 1 of n keys please let me know!
Thx. I have a standalone server with a wallet. Users (buyer, seller) sended public keys and standalone server create multisig address. Next (I hope) they will be able to enter the private keys that I can import it into my server to sign the transaction.


Title: Re: Multisignature
Post by: fbueller on January 22, 2014, 03:20:34 PM
Then boy it's your lucky day! I'm using codeigniter as well. I'll upload the project as it is, you just need to configure application/config/bitcoin.php.  I'll post in a sec with a github link just uploading now

You should probably have a separate client to use to have the other keys. The server generates a key and imports it immediately. Users are asked to supply the required amount of keys, send money, paste the txid, and enter an address to send the money back to. Then they need to sign the transaction - the software will automatically sign the transaction it generates, but you could leave this out if people wanted to actually do escrow with it.

It only works with bitcoind/qt. If you get multisig transactions to sign in any other client that only has 1 of n keys please let me know!
Thx. I have a standalone server with a wallet. Users (buyer, seller) sended public keys and standalone server create multisig address. Next (I hope) they will be able to enter the private keys that I can import it into my server to sign the transaction.

Problem. Your server could be hacked and used to sign transactions that are sent to wherever an attacker wants. Most users will give you keys from their wallet.. Imagine taking the private key from a users android app, and you get hacked. All their phones coins will get spent, just because you wanted to sign the transaction for them. You should not have that ability if you're trying to implement multisig - the user needs to sign for themselves.