Title: Script to sign multisig transactions using an Electrum wallet Post by: fbueller on May 16, 2014, 04:59:28 PM I wrote a command line script which prompts for a redeem script, raw transaction, and electrum seed or mnemonic, and adds creates signatures for any key that it finds. I wrote it largely out of frustration that you can't sign multi-signature transactions in the Electrum client. especially given how useful a master public key is for deriving multiple multisig addresses for users.
So, and I expect plenty of healthy suspicion from users about entering seeds, but there you go. The program works if you're offline anyway, once you can supply the JSON inputs string. Code: git clone https://github.com/Bit-Wasp/bitcoin-lib-php.git If you're running Debian, you'll need to go: sudo apt-get install php5-gmp - or similar for Ubuntu. The following is output from a transaction I just broadcast, I'm using this tool to sign transactions as an administrator on Bitwasp, since it derives keys from electrum for orders. The raw transaction I pasted was partially signed using Bitcoin Core. Code: afk@jalapeno:~/git/bitcoin-lib-php/examples$ php electrum_sign_multisig.php How it works: First prompt for the redeemScript. Decode, check that it's valid. If not, prompt again. Ask for a raw transaction to sign. Paste raw transaction here, it decodes, checks that it's valid. If the JSON inputs are pasted here, it'll prevent the next prompt from popping up. Ask for JSON inputs, or offer to download them from webbtc. If they were already supplied earlier, this is skipped. Ask for electrum seed (hex seed) or 12 word mnemonic. It'll generate the secret exponent, and master public key, then derive the first 30 public keys for the wallet. If any match keys in the redeemScript, the corresponding private key is generated and used in the wallet. It'll then ask if you think this is OK, or should it scan for more keys. Maybe you own all the keys, maybe just one. It'll stop if you reach the number of signatures required. Next is where the magic happens, it creates a wallet with private key/scripthash data, and builds up signatures wherever it can. It'll return complete = TRUE or FALSE. TRUE means it's signed fully, but false means it's not signed fully. Hopefully someone will find this as useful as I do. Title: Re: Script to sign multisig transactions using an Electrum wallet Post by: fauxik on March 19, 2015, 07:25:11 AM Hello!
That sounds you have some experience with Bitwasp. Can I ask you some question? I testing out Bitwasp and I do not know what I supposed to do. If buyer raise a dispute - there Bitwasp asking for "Sign with private key: m/0'/0/6" from admin but I do not know where can be those private key found. So the question is, how to dump private keys from Electrum when I never used Electrum wallet ? (I used a bip32.org to generate main admin public key ... so must I somehow import the main admin bip32 key into Electrum ? or what?) I was looked into examples and find there file bip32.php, but I not sure how to fill those script to work correctly: $master = BIP32::master_key(bin2hex(mcrypt_create_iv(64, \MCRYPT_DEV_URANDOM))); But I do not know how I may rewrite those master for my purpose, how or where I may put there my bip32 private hex, master seed or what? I am not sure, but there I may somehow put my admin bip32 private into $master ? But I unfortunatelly I do not know how. and another value is $def = "0'/0"; -- so this I may rewrite to $def = "0'/0/6"; ? Please it is possible to help me? I would very much help appreciated. |