Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 1DD532359 for ; Fri, 19 Apr 2019 12:12:57 +0000 (UTC) X-Greylist: delayed 00:18:54 by SQLgrey-1.7.6 Received: from 3.mo173.mail-out.ovh.net (3.mo173.mail-out.ovh.net [46.105.34.1]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 34B75823 for ; Fri, 19 Apr 2019 12:12:56 +0000 (UTC) Received: from player698.ha.ovh.net (unknown [10.108.42.5]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 85F1DFEA5D for ; Fri, 19 Apr 2019 13:54:00 +0200 (CEST) Received: from federici.tech (unknown [91.109.28.130]) (Authenticated sender: michele@federici.tech) by player698.ha.ovh.net (Postfix) with ESMTPSA id 962DA4EDDD69 for ; Fri, 19 Apr 2019 11:53:59 +0000 (UTC) Message-ID: <298ab7b97f0f34b6ef0e4b8345a942b3d77296d5.camel@federici.tech> From: Michele Federici Reply-To: michele@federici.tech To: bitcoin-dev@lists.linuxfoundation.org Date: Fri, 19 Apr 2019 13:53:51 +0200 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-8Pm9ys6tD2ASbMthVz2o" User-Agent: Evolution 3.30.5-1 MIME-Version: 1.0 X-Ovh-Tracer-Id: 13175280710778315854 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrfeejgdegfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecu X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Mailman-Approved-At: Fri, 19 Apr 2019 13:57:48 +0000 Subject: [bitcoin-dev] Using the same public keys, the p2sh returned by `addmultisigaddress` differs from the one returned by `createmultisigaddress` X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Apr 2019 12:12:57 -0000 --=-8Pm9ys6tD2ASbMthVz2o Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi everyone, I'm writing here because I didn't find any resources in the docs or somewhere else online explaining this, I don't get if this is a bug or I'm missing something. I was working on a function to derive the pay-to-script-hash from a multisig script and I was checking the results against the bitcoin core's `addmultisigaddress` output, although I was quite sure that my implementation was correct, my output address was different. By chance, I then tried the `createmultisigaddress` method, using the same public keys, and this time the output was matching with mine. I thought the outputs of `addmultisigaddress` and `createmultisigaddress` were supposed to be the same, but instead are inconsistent from each other: ``` bitcoin-cli addmultisigaddress 1 '["045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c0c e382458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d","02ac46 c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831","0224a4dc 5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e07"]' { "address": "36ULucjWUTrDvaJzCyhFoVbDoNS6Zum2Du", "redeemScript": "5141045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c 0ce382458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d2102ac4 6c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831210224a4dc 5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e0753ae" } ``` ``` bitcoin-cli createmultisig 1 '["045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c0c e382458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d","02ac46 c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831","0224a4dc 5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e07"]' { "address": "3GiimyxF1R5VixfBFAbQZbuy9EesD2r6n1", "redeemScript": "5141045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c 0ce382458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d2102ac4 6c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831210224a4dc 5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e0753ae" } ``` I was also pretty confused by the fact that the `redeemScript` is the same, only the addresses are different, and calling `decodescript` with it I get the same address as `createmultisig`: ``` bitcoin-cli decodescript "5141045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c 0ce382458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d2102ac4 6c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831210224a4dc 5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e0753ae" { "asm": "1 045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c0ce38 2458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d 02ac46c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831 0224a4dc5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e07 3 OP_CHECKMULTISIG", "reqSigs": 1, "type": "multisig", "addresses": [ "12PfkcWheYsfFddWfHhaXpFDVx78gnKQ9k", "1AYLXzXd6N2avqW4j8Gyhb8jb2jXvNPyuV", "1PWsxtcBMRHTSX2L7wrXgwnFigHD3KhbFT" ], "p2sh": "3GiimyxF1R5VixfBFAbQZbuy9EesD2r6n1" } ``` I don't understand, how can this be possible? Thank you, Michele --=-8Pm9ys6tD2ASbMthVz2o Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE8LpnnP1O6lVY/D5FTcim1Buz1vgFAly5ts8ACgkQTcim1Buz 1vg/yAf8CtrM6NKtUyEZEnQEg2QLONJO8zx+sJDhzBranxgIlpqxxLS6sWIqAwjP gNyiQKwNa9e0hWBinUWyVXQIl/s9xmX7P2cOVtCQ8T4tyfyy285ALBCJ1rSKuAWG 4eDtqAwzjd9xyJ0Q8wAdxHf53SvjF01Qdj0HFfMWCF7Xm74kDqZ/oWWClxivGPfC va+hnnuFhhxkoCxejkBRQUUJH7QnT0cE+BGT2D2Dj+Odj2pXcXdFK39qHrkZc62Y zpXbXIGlXB0QWIVVsHfw/3iw69iAxY9pOEgbDlLMmpjgFMlu5a+p0O2phbLOEoas ZbRlYIjYbjDuP8VdREWWvHao2ckjFA== =AZ1Z -----END PGP SIGNATURE----- --=-8Pm9ys6tD2ASbMthVz2o--