<oembed><type>rich</type><version>1.0</version><author_name>npub17ty4mumkv43w8wtt0xsz2jypck0gvw0j8xrcg6tpea25z2nh7meqf4qgyd</author_name><author_url>https://nostr.ae/npub17ty4mumkv43w8wtt0xsz2jypck0gvw0j8xrcg6tpea25z2nh7meqf4qgyd</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2014-04-26&#xA;📝 Original message:I&#39;m not sure I understand why you need any special structure for this at&#xA;all. The way I&#39;d do it is just use regular HD wallets for everyone, of the&#xA;regular form, and then swap the watching keys. Why do people need to be&#xA;given a cosigner index at all, given that they all have unique root keys&#xA;anyway?&#xA;&#xA;&#xA;On Sat, Apr 26, 2014 at 12:27 AM, Manuel Araoz &lt;manu at bitpay.com&gt; wrote:&#xA;&#xA;&gt; Hi, I&#39;m part of the team building copay &lt;https://github.com/bitpay/copay&gt;,&#xA;&gt; a multisignature P2SH HD wallet. We&#39;ve been following the discussion&#xA;&gt; regarding standardizing the structure for branches both on this list and on&#xA;&gt; github (1 &lt;https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki&gt;,&#xA;&gt; 2 &lt;https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki&gt;, 3&lt;https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki&gt;,&#xA;&gt; 4 &lt;https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki&gt;, 5&lt;https://github.com/bitcoin/bips/pull/52&gt;).&#xA;&gt; Soon, we realized the assumptions in the discussions were not true for a&#xA;&gt; multisig hd wallet, so we wanted to share our current approach to that, to&#xA;&gt; get feedback and see if we can arrive to a new standard (and possibly a new&#xA;&gt; BIP)&#xA;&gt;&#xA;&gt; These are our assumptions:&#xA;&gt;  - N parties want to share an m-of-n wallet.&#xA;&gt;  - Each party must generate their master private keys independently.&#xA;&gt;  - Use multisig P2SH for all addresses.&#xA;&gt;  - Use BIP32 to derive public keys, then create a multisig script, and use&#xA;&gt; the P2SH address for that.&#xA;&gt;  - The address generation process should not require communicating with&#xA;&gt; other parties. (Thus, all parties must be able to generate all public keys)&#xA;&gt;  - Transaction creation + signing requires communication between parties,&#xA;&gt; of course.&#xA;&gt;&#xA;&gt; -------------------------------------------------&#xA;&gt;&#xA;&gt; Following BIP43, we&#39;re be using:&#xA;&gt;&#xA;&gt;&#xA;&gt; m / purpose&#39; / *&#xA;&gt;&#xA;&gt; where *purpose* is the hardened derivation scheme based on the new BIP&#xA;&gt; number.&#xA;&gt; We then define the following levels:&#xA;&gt;&#xA;&gt;&#xA;&gt; m / purpose&#39; / cosigner_index / change / address_index&#xA;&gt;&#xA;&gt; Each level has a special meaning detailed below:&#xA;&gt;&#xA;&gt; *cosigner_index* &lt;http://en.wikipedia.org/wiki/Co-signing&gt;: the index of&#xA;&gt; the party creating this address. The indices can be determined&#xA;&gt; independently by lexicographically sorting the master public keys of each&#xA;&gt; cosigner.&#xA;&gt;&#xA;&gt; *change*: 0 for change, 1 for receive address.&#xA;&gt;&#xA;&gt; *address_index*: Addresses are numbered from index 0 in sequentially&#xA;&gt; increasing manner. We&#39;re currently syncing the max used index for each&#xA;&gt; branch between all parties when they connect, but we&#39;re open to considering&#xA;&gt; removing the index sync and doing the more elegant used-address discovery&#xA;&gt; via a gap limit, as discussed in BIP44&lt;https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#address-gap-limit&gt;.&#xA;&gt; We feel 20 might be too low though.&#xA;&gt;&#xA;&gt; *Wallet high-level description:*&#xA;&gt; Each party generates their own extended master keypair and shares the&#xA;&gt; extended purpose&#39; public key with the others, which is stored encrypted.&#xA;&gt; Each party can generate any of the other&#39;s derived public keys, but only&#xA;&gt; his own private keys.&#xA;&gt;&#xA;&gt; *General address generation procedure:*&#xA;&gt; When generating an address, each party can independently generate the N&#xA;&gt; needed public keys. They do this by deriving the public key in each of the&#xA;&gt; different trees, but using the same path. They can then generate the&#xA;&gt; multisig script and the corresponding p2sh address. In this way, each path&#xA;&gt; corresponds to an address, but the public keys for that address come from&#xA;&gt; different trees.&#xA;&gt;&#xA;&gt; *Receive address case:*&#xA;&gt; Each cosigner generates addresses only on his own branch. One of the n&#xA;&gt; cosigners wants to receive a payment, and the others are offline. He knows&#xA;&gt; the last used index in his own branch, because only he generates addresses&#xA;&gt; there. Thus, he can generate the public keys for all of the others using&#xA;&gt; the next index, and calculate the needed script for the address.&#xA;&gt;&#xA;&gt; *Example: *Cosigner #2 wants to receive a payment to the shared wallet.&#xA;&gt; His last used index on his own branch is 4. Then, the path for the next&#xA;&gt; receive address is m/$purpose/2/1/5. He uses this same path in all of the&#xA;&gt; cosigners trees to generate a public key for each one, and from that he&#xA;&gt; gets the new p2sh address.&#xA;&gt;&#xA;&gt; *Change address case:*&#xA;&gt; Again, each cosigner generates addresses only on his own branch. One of&#xA;&gt; the n cosigners wants to create an outgoing payment, for which he&#39;ll need a&#xA;&gt; change address. He generates a new address using the same procedure as&#xA;&gt; above, but using a separate index to track the used change addresses.&#xA;&gt;&#xA;&gt; *Example: *Cosigner #5 wants to send a payment from the shared wallet,&#xA;&gt; for which he&#39;ll need a change address. His last used change index on his&#xA;&gt; own branch is 11. Then, the path for the next change address is&#xA;&gt; m/$purpose/5/0/12. He uses this same path in all of the cosigners trees to&#xA;&gt; generate a public key for each one, and from that he gets the new p2sh&#xA;&gt; address.&#xA;&gt;&#xA;&gt;&#xA;&gt; *Transaction creation and signing:*&#xA;&gt; When creating a transaction, first one of the parties creates a&#xA;&gt; Transaction Proposal. This is a transaction that spends some output stored&#xA;&gt; in any of the p2sh multisig addresses (corresponding to any of the&#xA;&gt; copayers&#39; branches). This proposal is sent to the other parties, who decide&#xA;&gt; if they want to sign. If they approve the proposal, they can generate their&#xA;&gt; needed private key for that specific address (using the same path that&#xA;&gt; generated the public key in that address, but deriving the private key&#xA;&gt; instead), and sign it. Once the proposal reaches m signatures, any cosigner&#xA;&gt; can broadcast it to the network, becoming final. The specifics of how this&#xA;&gt; proposal is structured, and the protocol to accept or reject it, belong to&#xA;&gt; another BIP, in my opinion.&#xA;&gt;&#xA;&gt; *Final comments:*&#xA;&gt; - We&#39;re currently lexicographically sorting the public keys for each&#xA;&gt; address separately. We&#39;ve read Mike Belshe&#39;s comments about sorting the&#xA;&gt; master public keys and then using the same order for all derived addresses,&#xA;&gt; but we couldn&#39;t think of any benefits of doing that (I mean, the benefits&#xA;&gt; of knowing whose public key is which).&#xA;&gt; - We originally thought we would need a non-hardened version of purpose&#xA;&gt; for the path, because we needed every party to be able to generate all the&#xA;&gt; public keys of the others. With the proposed path, is it true that the&#xA;&gt; cosigners will be able to generate them, by knowing the extended purpose&#xA;&gt; public key for each copayer? (m/purpose&#39;)&#xA;&gt; - The reason for using separate branches for each cosigner is we don&#39;t&#xA;&gt; want two of them generating the same address and receiving simultaneous&#xA;&gt; payments to it. The ideal case is that each address receives at most one&#xA;&gt; payment, requested by the corresponding cosigner.&#xA;&gt;&#xA;&gt;&#xA;&gt; Thoughts?&#xA;&gt; Manuel&#xA;&gt;&#xA;&gt;&#xA;&gt; ------------------------------------------------------------------------------&#xA;&gt; Start Your Social Network Today - Download eXo Platform&#xA;&gt; Build your Enterprise Intranet with eXo Platform Software&#xA;&gt; Java Based Open Source Intranet - Social, Extensible, Cloud Ready&#xA;&gt; Get Started Now And Turn Your Intranet Into A Collaboration Platform&#xA;&gt; http://p.sf.net/sfu/ExoPlatform&#xA;&gt; _______________________________________________&#xA;&gt; Bitcoin-development mailing list&#xA;&gt; Bitcoin-development at lists.sourceforge.net&#xA;&gt; https://lists.sourceforge.net/lists/listinfo/bitcoin-development&#xA;&gt;&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20140426/fbf87fbc/attachment.html&gt;</html></oembed>