Author

Topic: Bitcoin wallet - MultiSig (Read 740 times)

sr. member
Activity: 412
Merit: 287
June 05, 2015, 08:08:04 AM
#4
I think that second paste is an example from my PHP library, not the python one you linked. Either would do just fine for your server side part of it.

You need a server which is able to create addresses locked to your users (somehow), and will be able to create proposed spends of money which arrives in that address. (an unsigned transaction). You need to build the idea of proposing transactions and signing (ie, ACCEPTING some terms or the next step) into your app. Your users will probably need some software to do all this for them, it's not straightforward. You could use a clientside JS library for this.

Your users will do the signing in their browser, and hence, your server needs to be able to validate the transactions received. For the correct amount? Does it go to the same place? Most importantly, does the signature actually verify by the public key you have for that user? (this makes sure the other user didn't get that users pw and try submit something stupid)

 - So the flow is normally, n users wish to transact. You will need a public key for all of them. Probably you will use BIP32 for this.
 - You will need to create the multisignature address, and have the person paying for services put the money into the address.
 - Next, the money needs to move right? To the seller? Does the buyer get a refund? Where does the money go?
 - The server will probably have a default place to send the funds - the seller.
 - If there are problems, your server will create a different transaction.
 - The users of your website will either sign, or raise a dispute of some kind. They submit signed transactions to you if they sign, and once you have enough signatures you can broadcast the funds.

hero member
Activity: 672
Merit: 508
LOTEO
June 03, 2015, 03:22:30 AM
#3
Hey, I'd like to implement into my online Bitcoin wallet MultiSig technology but do not know where to look for information? I found on Github only general information, and the need for a precise details of how to implement Multisig.
Is there a person who will write me exactly what I have to do?
For help in implementation can offer a small amount of BTC. Thanks.

You could use a library to take care of that such as https://pypi.python.org/pypi/bitcoin/1.1.26

If you want to implement yourself, this seems to be the algorithm for generating multisignature addresses:
Code:
require_once(dirname(__FILE__).'/../application/libraries/BitcoinLib.php');
require_once(
dirname(__FILE__).'/../application/libraries/BIP32.php');
echo 
"Lets start off by generating a wallet for each of the 'users'.\n";
echo 
"This will be stored on their machine.\n";
$wallet[0] = BIP32::master_key('b861e093a58718e145b9791af35fb111');
$wallet[1] = BIP32::master_key('b861e093a58718e145b9791af35fb222');
$wallet[2] = BIP32::master_key('b861e093a58718e145b9791af35fb333');
print_r($wallet);
echo 
"Now we will generate a m/0' extended key. These will yield a private key\n";
$user[0] = BIP32::build_key($wallet[0][0], "3'");
$user[1] = BIP32::build_key($wallet[1][0], "23'");
$user[2] = BIP32::build_key($wallet[2][0], "9'");
print_r($user);
// As the previous is a private key, we should convert to the corresponding
// public key: M/0'
echo "As the previous is a private key, we should convert it to the corresponding\n";
echo 
"public key: M/0' \n";
$pub[0] = BIP32::extended_private_to_public($user[0]);
$pub[1] = BIP32::extended_private_to_public($user[1]);
$pub[2] = BIP32::extended_private_to_public($user[2]);
print_r($pub);
echo 
"This is the key you will ask your users for. For repeated transactions\n";
echo 
"BIP32 allows you to deterministically generate public keys, meaning less\n";
echo 
"effort for everyone involved\n\n";
echo 
"Now we can generate many multisignature addresses from what we have here: \n";
for(
$i 0$i 3$i++) {
$bip32key[0] = BIP32::build_key($pub[0], "0/{$i}");
$bip32key[1] = BIP32::build_key($pub[1], "0/{$i}");
$bip32key[2] = BIP32::build_key($pub[2], "0/{$i}");
print_r($bip32key);
$pubkey[0] = BIP32::extract_public_key($bip32key[0]);
$pubkey[1] = BIP32::extract_public_key($bip32key[1]);
$pubkey[2] = BIP32::extract_public_key($bip32key[2]);
print_r($pubkey);
}
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
June 02, 2015, 10:20:34 AM
#2
I'm guesssing you read this page:

https://github.com/bitcoin/bips/blob/master/bip-0011.mediawiki

From what I can tell, if you've already got a working parser for the bitcoin transactions, implementing multisig just looks like you need to add the new transaction type and be able to validate the signatures.  Wish I could be more helpful but it's not clear from your post how far you need to go.

Here's a bitcointalk thread discussing it: https://bitcointalksearch.org/topic/opeval-proposal-46538

You can check out the _createmultisig_redeemScript function in bitcoin-core: https://github.com/bitcoin/bitcoin/blob/b6ea3bcede1cbbf89486b9d67329e0110c4624ae/src/rpcmisc.cpp

Hope that helps!
newbie
Activity: 21
Merit: 0
June 02, 2015, 05:51:17 AM
#1
Hey, I'd like to implement into my online Bitcoin wallet MultiSig technology but do not know where to look for information? I found on Github only general information, and the need for a precise details of how to implement Multisig.
Is there a person who will write me exactly what I have to do?
For help in implementation can offer a small amount of BTC. Thanks.
Jump to: