Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Wa6Og-00047R-Mt for bitcoin-development@lists.sourceforge.net; Tue, 15 Apr 2014 16:39:46 +0000 X-ACL-Warn: Received: from chello084114181075.1.15.vie.surfer.at ([84.114.181.75] helo=mini.local) by sog-mx-1.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1Wa6Of-0004CU-0f for bitcoin-development@lists.sourceforge.net; Tue, 15 Apr 2014 16:39:46 +0000 Received: from localhost (localhost [127.0.0.1]) by mini.local (Postfix) with ESMTP id 9152365897E; Tue, 15 Apr 2014 18:39:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at mini.local Received: from mini.local ([127.0.0.1]) by localhost (mini.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ua-KMaD7Chtd; Tue, 15 Apr 2014 18:39:35 +0200 (CEST) Received: from [192.168.0.32] (chello084114181075.1.15.vie.surfer.at [84.114.181.75]) by mini.local (Postfix) with ESMTPSA id B8DB865896E; Tue, 15 Apr 2014 18:39:35 +0200 (CEST) Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Content-Type: multipart/signed; boundary="Apple-Mail=_BE47429A-1EC1-4E6F-8EAE-C380B8EA892A"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.1 (525b9ae) From: Chris Beams In-Reply-To: <7270706.tTNIRFK64H@crushinator> Date: Tue, 15 Apr 2014 18:39:35 +0200 Message-Id: <981A0A04-EAE7-45BE-81FC-92A40A6B2DA4@beams.io> References: <1756895.gV83Q4MX2a@crushinator> <1832687.kEVurC5ttk@crushinator> <7270706.tTNIRFK64H@crushinator> To: Matt Whitlock X-Mailer: Apple Mail (2.1874) X-Spam-Score: 1.3 (+) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 1.3 RCVD_IN_RP_RNBL RBL: Relay in RNBL, https://senderscore.org/blacklistlookup/ [84.114.181.75 listed in bl.score.senderscore.com] 0.0 RCVD_IN_SORBS_DUL RBL: SORBS: sent directly from dynamic IP address [84.114.181.75 listed in dnsbl.sorbs.net] X-Headers-End: 1Wa6Of-0004CU-0f Cc: Bitcoin Dev Subject: Re: [Bitcoin-development] Bug in 2-of-3 transaction signing in Bitcoind? X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Apr 2014 16:39:46 -0000 --Apple-Mail=_BE47429A-1EC1-4E6F-8EAE-C380B8EA892A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi Matt, Looks interesting. Is the source available? On Apr 15, 2014, at 6:27 PM, Matt Whitlock = wrote: On Tuesday, 15 April 2014, at 8:47 am, Mike Belshe wrote: For what it is worth, I found btcd (the go implementation of bitcoind) = has much better error/diagnostics messages. It would have given you more = than "-22 TX Rejected". I used it to debug my own multi-sig transactions and = it was very helpful. I'll have to check that out. A follow-up on my initial post... I did just successfully create, sign, = and transmit another 2-of-3 transaction, so once again, I'm sorry I = bothered this list. But since I did (and am now doing so again), I'll = give a little more background on what we've been up to. It's not quite = as simple as what I've shared thus far. We have built a tool from scratch in C++ that is kind of a Swiss Army = knife of Bitcoin. It does all sorts of key and address conversions, hash = functions, encoding and decoding, script disassembly, BIP38 = encryption/decrytion, the Shamir Secret Sharing that I've posted about = here on this list before, and transaction building and signing. It has = its own wallet and it's own UTXO cache that contains only TXOs that are = relevant to the objects in its wallet. It synchronizes its cache by = scanning bitcoind's block data files. (It memory maps them and can do a = full scan of the entire block chain in about a minute!) The wallet can = contain keys, seeds, and multi-signature aggregates (which in turn can = comprise keys and seeds). What we've been testing is deriving sequences = of multi-sig P2SH addresses from a set of public seeds, sending bitcoins = to those addresses, then using our tool to find those outputs in the = block chain and to create transactions that redeem them, and then = signing those trans actions by supplying the private seeds to the tool. Our tool is quite a bit easier to use than Bitcoind. (I was frankly = appalled at the command-line syntax that was necessary to get Bitcoind = to sign a P2SH multi-sig transaction.) $ ./btctool privkey < /dev/random > privseed1 $ ./btctool privkey < /dev/random > privseed2 $ ./btctool privkey < /dev/random > privseed3 $ pubseed1=3D$(./btctool pubkey < privseed1) $ pubseed2=3D$(./btctool pubkey < privseed2) $ pubseed3=3D$(./btctool pubkey < privseed3) $ ./chaintool init $ ./chaintool add demo 2 ":${pubseed1}" ":${pubseed2}" ":${pubseed3}" $ ./chaintool ls demo 2 = :036447c7edc861b9f41fa0f611d81784f19ce692f37e8772b55c37c743cd526b49 = :03c831711ea65decc06b0f3ccb4b9f1ba1a99a6933e520f6e7e4c3dbb4f015b701 = :0347f2a0a346f21538fc451b95a600bc64ce5d2d28b89bf547697f3a77195d8dd1 $ ./btctool addresses 1 2 "${pubseed1}" "${pubseed2}" "${pubseed3}" 3GQd1tosFCE7Vo4TAiDHEKTaBgoyZTeL6R $ bitcoind sendtoaddress 3GQd1tosFCE7Vo4TAiDHEKTaBgoyZTeL6R 0.01 6a9538f496f4c2d7f50c342fa6f6f76904a3b19f55f3a54a0003fc00b327d81b (I waited here for the tx to get into a block) $ ./chaintool sync /var/lib/bitcoin/.bitcoin/blocks 2> /dev/null $ ./chaintool listunspent [ { "txid": = "6a9538f496f4c2d7f50c342fa6f6f76904a3b19f55f3a54a0003fc00b327d81b", "vout": 1, "address": "3GQd1tosFCE7Vo4TAiDHEKTaBgoyZTeL6R", "scriptPubKey": = "a914a1701be36532f05a74511fca89afce180c58189587", "amount": 1000000, "confirmations": 1 } ] $ cat > outputs << EOF 13QAKNuh9uFcEiNAsct6LSF1qWQR6HLarT 50000 1FV4Fm3VCXfWy7BAXzT8t5qqTvEKZSad9v EOF $ tx=3D$(./chaintool createtx 10000 demo < outputs) (I manually edited ${tx} at this point to add an OP_RETURN output. We're = currently working toward using OP_RETURN in a provable solvency scheme.) $ signedtx1=3D$(./chaintool signtx "${tx}" < privseed1) input #0: need 1 of = [:03c831711ea65decc06b0f3ccb4b9f1ba1a99a6933e520f6e7e4c3dbb4f015b701, = :0347f2a0a346f21538fc451b95a600bc64ce5d2d28b89bf547697f3a77195d8dd1] $ signedtx2=3D$(./chaintool signtx "${signedtx1}" < privseed2) $ bitcoind sendrawtransaction "${signedtx2}" b485b185c77d803f75e1ccfee1b5072846c9e0728f4c955ca40dce82263f8f16 $ exit :-) = --------------------------------------------------------------------------= ---- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and = their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Bitcoin-development mailing list Bitcoin-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bitcoin-development --Apple-Mail=_BE47429A-1EC1-4E6F-8EAE-C380B8EA892A Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIcBAEBAgAGBQJTTWDHAAoJED0hT49bxe1zkp8P/RTkrtr9k4OmHPpAqtVgfVyh //YyrMcemeI20V9t1Stqwfv8wa93zwxw4wXSlZUdofNYfHGS+X+mn+rt5lcK9l1Q 81aJScO/Yr+YrVUWN/ap+A1yk7ghbRQG/ESVZTNXnnLF7t5aHD0R6fbKhwe0TEDz mEqFpMutX8JhRXLtmsJUnqoXddHSgeUu9efEbc0y4zX6glsVURsy6dPIY9l4vJ06 S4GSXrHA+EMWFtxNd+wxROBl1LZgIoUnhNwM8jKBrXi8/IuHmNHGL/DvIL7TYd4Y 57FQAXiWrThGUhyrGPGKachrW5PY4xAAvgfKmuxuPw28yXuV7S89uMzm71TTYdfW ONHFB2Rqzdv4CvwEXhb99f+q/o7PcwH5Tufg/K0aQcEgmxN+7qj2P2b79Esi9eNJ mIgvLS6ae+mjuH8fEwuISXp3bT0L5o/foYZy2nnXmtHCgXaMLW/UMfnqg/IKTUoO uOekKRcdM6GL5+rrBZr11mm/ae2GmTLjGe1zI9hcbBnbrWX60kwi3dFVyOpenuqo ffLgNz9xXMn5avzPHZPE+WNxjSlc+7mDBEVfu476SAhYoQImLptX+BR0y9wDeXDt vHGVrrYA5BYqVTvGJn49w6Zjg0lakDrW7AhiRhxq34CkJorHriqQHt0INI8fNlYY PIJBLQqiNAw8Q++vJaPW =Md2q -----END PGP SIGNATURE----- --Apple-Mail=_BE47429A-1EC1-4E6F-8EAE-C380B8EA892A--