<oembed><type>rich</type><version>1.0</version><author_name>npub1sm6zhjmk5scuz294jmpkw99wwwjzetjgwp4fu4gn6utqgdz87hkqamnq7h</author_name><author_url>https://nostr.ae/npub1sm6zhjmk5scuz294jmpkw99wwwjzetjgwp4fu4gn6utqgdz87hkqamnq7h</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 will just chime in that I&#39;ve been working on a similar spec for Armory&#xA;to implement P2SH multisig and I came up with basically an identical&#xA;scheme.  I think you covered most of what is needed.   The one thing I&#xA;did differently was try to match the BIP 32 structure, by keeping the&#xA;original 3 levels (wallet, chain, addresses), and use 2*N chains to&#xA;handle the N different parties generating receiving and change&#xA;addresses.  It&#39;s not necessary, but it follows more closely the&#xA;three-level scheme that BIP 32 originally envisioned.  I also concluded&#xA;that the chain indices are ordered by lexicographical sorting of root&#xA;public keys, but resorting each individual address.  There are use cases&#xA;where it will be necessary for parties to know how to combine public&#xA;keys into a multi-sig address without knowing the root keys.&#xA;&#xA;Also, for the purposes of one-off types of escrow multi-sig, we have&#xA;included a &#34;wallet locator&#34; field in the transaction that must be passed&#xA;around.  This &#34;wallet locator&#34; is stored with each key (perhaps at the&#xA;time public keys are collected and merged), and passed around with&#xA;transactions to be signed.  This allows lightweight devices like&#xA;hardware wallets, to recognize their own keys.  It would encoded in a&#xA;VAR_STR, and doesn&#39;t have to be meaningful to the other participants --&#xA;each device would look at all signing slots in a transaction (either&#xA;singlesig or each key in a multisig) and would generate a public key&#xA;along each path, and see if the result matches.  If so, it can sign it. &#xA;If not, it must be someone else&#39;s.&#xA;&#xA;I bring this up, because this multisig wallet structure you&#39;re talking&#xA;about has a very simple &#34;wallet locator&#34; scheme -- all parties will use&#xA;the same locator for a given receiving address.  But that field should&#xA;remain part of the data structure for each key, to accommodate all types&#xA;of multisig, not just linked/parallel tree schemes. &#xA;&#xA;-Alan&#xA;&#xA;&#xA;&#xA;&#xA;On 04/25/2014 06:27 PM, Manuel Araoz wrote:&#xA;&gt; Hi, I&#39;m part of the team building copay&#xA;&gt; &lt;https://github.com/bitpay/copay&gt;, a multisignature P2SH HD&#xA;&gt; wallet. We&#39;ve been following the discussion regarding standardizing&#xA;&gt; the structure for branches both on this list and on github (1&#xA;&gt; &lt;https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki&gt;, 2&#xA;&gt; &lt;https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki&gt;, 3&#xA;&gt; &lt;https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki&gt;, 4&#xA;&gt; &lt;https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki&gt;, 5&#xA;&gt; &lt;https://github.com/bitcoin/bips/pull/52&gt;). Soon, we realized the&#xA;&gt; assumptions in the discussions were not true for a multisig hd wallet,&#xA;&gt; so we wanted to share our current approach to that, to get feedback&#xA;&gt; and see if we can arrive to a new standard (and possibly a new 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&#xA;&gt; use the P2SH address for that.&#xA;&gt;  - The address generation process should not require communicating&#xA;&gt; with other parties. (Thus, all parties must be able to generate all&#xA;&gt; public keys)&#xA;&gt;  - Transaction creation + signing requires communication between&#xA;&gt; parties, of course.&#xA;&gt;&#xA;&gt; -------------------------------------------------&#xA;&gt;&#xA;&gt; Following BIP43, we&#39;re be using:&#xA;&gt; m / purpose&#39; / *&#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; m / purpose&#39; / cosigner_index / change / address_index&#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&#xA;&gt; of the party creating this address. The indices can be determined&#xA;&gt; independently by lexicographically sorting the master public keys of&#xA;&gt; each 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&#xA;&gt; considering removing the index sync and doing the more elegant&#xA;&gt; used-address discovery via a gap limit, as discussed in BIP44&#xA;&gt; &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&#xA;&gt; encrypted. Each party can generate any of the other&#39;s derived public&#xA;&gt; keys, but only his own private keys. &#xA;&gt;&#xA;&gt; *General address generation procedure:*&#xA;&gt; When generating an address, each party can independently generate the&#xA;&gt; N needed public keys. They do this by deriving the public key in each&#xA;&gt; of the different trees, but using the same path. They can then&#xA;&gt; generate the multisig script and the corresponding p2sh address. In&#xA;&gt; this way, each path corresponds to an address, but the public keys for&#xA;&gt; that address come from 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&#xA;&gt; knows the last used index in his own branch, because only he generates&#xA;&gt; addresses there. Thus, he can generate the public keys for all of the&#xA;&gt; others using the next index, and calculate the needed script for the&#xA;&gt; address. &#xA;&gt;&#xA;&gt; /Example: /Cosigner #2 wants to receive a payment to the shared&#xA;&gt; wallet. His last used index on his own branch is 4. Then, the path for&#xA;&gt; the next receive address is m/$purpose/2/1/5. He uses this same path&#xA;&gt; in all of the cosigners trees to generate a public key for each one,&#xA;&gt; and from that he 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&#xA;&gt; of the n cosigners wants to create an outgoing payment, for which&#xA;&gt; he&#39;ll need a change address. He generates a new address using the same&#xA;&gt; procedure as above, but using a separate index to track the used&#xA;&gt; 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&#xA;&gt; his 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&#xA;&gt; trees to generate a public key for each one, and from that he gets the&#xA;&gt; new p2sh 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&#xA;&gt; stored in any of the p2sh multisig addresses (corresponding to any of&#xA;&gt; the copayers&#39; branches). This proposal is sent to the other parties,&#xA;&gt; who decide if they want to sign. If they approve the proposal, they&#xA;&gt; can generate their needed private key for that specific address (using&#xA;&gt; the same path that generated the public key in that address, but&#xA;&gt; deriving the private key instead), and sign it. Once the proposal&#xA;&gt; reaches m signatures, any cosigner can broadcast it to the network,&#xA;&gt; becoming final. The specifics of how this proposal is structured, and&#xA;&gt; the protocol to accept or reject it, belong to another BIP, in my&#xA;&gt; 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&#xA;&gt; the master public keys and then using the same order for all derived&#xA;&gt; addresses, but we couldn&#39;t think of any benefits of doing that (I&#xA;&gt; mean, the benefits of knowing whose public key is which).&#xA;&gt; - We originally thought we would need a non-hardened version of&#xA;&gt; purpose for the path, because we needed every party to be able to&#xA;&gt; generate all the public keys of the others. With the proposed path, is&#xA;&gt; it true that the cosigners will be able to generate them, by knowing&#xA;&gt; the extended purpose 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&#xA;&gt; simultaneous payments to it. The ideal case is that each address&#xA;&gt; receives at most one 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;&#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;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20140425/c7d5c529/attachment.html&gt;</html></oembed>