<oembed><type>rich</type><version>1.0</version><author_name>npub10etkvm8l0jr0jsgdx02dxnhnu5g989dnca90guj5rklwkaplnh3sgjc727</author_name><author_url>https://nostr.ae/npub10etkvm8l0jr0jsgdx02dxnhnu5g989dnca90guj5rklwkaplnh3sgjc727</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2014-01-12&#xA;📝 Original message:&gt; Oh, sorry, I forgot to mention it in my first write-up but you can&#xA;&gt; easily make stealth addresses include a second pubkey for the purpose of&#xA;&gt; the communication that either isn&#39;t used in the scriptPubKey at all, or&#xA;&gt; is part of a n-of-m multisig. (n&gt;=2) Interestingly that also means you&#xA;&gt; can give a third-party that key and out-source the effort of scanning&#xA;&gt; the blockchain for you.&#xA;&#xA;Great point. Even if it&#39;s not a 3rd party, I think it&#39;s really important  &#xA;to be able to scan for transactions with a key which can&#39;t actually spend  &#xA;the funds.&#xA;&#xA;The first approach is just one-pass ECDH. I think you&#39;re saying the second  &#xA;approach is two rounds of ECDH but re-using the same e/P (usually referred  &#xA;to as r/R in ECIES). I think this is safe, unlike reusing an ephemeral key  &#xA;for signing operations.&#xA;&#xA;   Payee: Publish Q, Q2                     [d, d2 are privkeys, Q, Q2 are  &#xA;pubkeys]&#xA;   Payer: 1) Generate ephemeral key: e / P  [e is privkey, P is pubkey]&#xA;          2) S = e * Q                      [first shared secret]&#xA;          3) S2 = e * Q2                    [second shared secret, reusing  &#xA;&#39;e&#39;]&#xA;          4) Q&#39; = Q + H(S)                  [pay-to stealth address]&#xA;          5) Q2&#39; = Q2 + H(S2)               [stealth &#39;marker&#39;]&#xA;&#xA;   Watch: 1) Look for TxOut with OP_RETURN &lt;P&gt;&#xA;          2) Q2&#39; = Q2 + H(d2 * P)&#xA;          3) Check for Q2&#39; elsewhere in the Tx&#xA;&#xA;S/MIME for example, allows reuse of the ephemeral keypair. When reusing an  &#xA;ephemeral keypair where A reuses (x, X) to encrypt different messages to  &#xA;more than one user, A should verify the static public keys to prevent  &#xA;small-subgroup attacks.[1][2]&#xA;&#xA;Let&#39;s say you pay-to Q&#39; and then Q2&#39; value has to be somewhere else in the  &#xA;transaction. You could put it next to the shared P in OP_RETURN. OP_RETURN  &#xA;&lt;P&gt; &lt;Q2&#39;&gt; would be 66 bytes.&#xA;&#xA;But then Mallory could generate transactions with the right Q2&#39; but with  &#xA;his own pubkey in Step 2 instead of Q. So your scanner would detect a  &#xA;payment, but you wouldn&#39;t be able to spend it, and Mallory could.&#xA;&#xA;That&#39;s a good argument for putting Q2&#39; in a 2-of-2 multisig so that  &#xA;pulling this trick would at least make the transaction unspendable for  &#xA;both parties, which may be good enough deterrent, but you&#39;re still going  &#xA;to want to check it against your &#39;d&#39; before fulfilling a large order. Your  &#xA;online watch process could queue the matching transactions, which you  &#xA;could move to your offline machine, decrypt your key, and verify the  &#xA;transactions are spendable.&#xA;&#xA;Now, you would need to get two pubkeys to the payer, throw in a prefix to  &#xA;help standardize it, and end up with addresses that could look like (for  &#xA;example):&#xA;&#xA;xSTLxsn59oaupR6ZKt2yddQ4dp5hcFinnTWkvsDiXtHgAEDg5ajNVzTY8MMQsmqnEn3ZMKxQzrfC3pDimfTWMkiUb7x3jX3J26JSX&#xA;tSTLcpwzupCFL3maVZkSiB9ib3BXsCAfkhMLgckQEyoj8Tk83ANzofeuDdbX6bSPqNRfACLLFYK8EwVo1jdjxNDFNDWxhnQiAy4ba&#xA;&#xA;Those addresses are 74 bytes:  &#xA;&lt;Prefix&gt;&lt;CompressedPubKey1&gt;&lt;CompressedPubKey2&gt;&lt;Checksum&gt;&#xA;&#xA;   xSTL Prefix = 0xC0CB9270&#xA;   tSTL Prefix = 0xB2E27D50&#xA;   NOTE: I do NOT have the corresponding privkeys for these four pubkeys!&#xA;&#xA;Those just happened to be the first matching prefixes I found for 74 byte  &#xA;addresses. I could try to find ones which start with a specific byte if  &#xA;that&#39;s somehow better, like 0x04 to match BIP32.&#xA;&#xA;Unfortunately, I don&#39;t think you can just derive a second public key from  &#xA;the first to keep the address shorter, and still keep the first private  &#xA;key secure, even if the second private key is stolen. You only get  &#xA;equivalent security as BIP32 public derivation, where you can&#39;t lose a  &#xA;child private key.&#xA;&#xA;Do we also want xSTL (or whatever user friendly string) prefixes for  &#xA;single pubkey (41 byte) stealth addresses?&#xA;&#xA;I&#39;ll wait a couple days for feedback, then I&#39;ll try to implement the  &#xA;following prototypes:&#xA;&#xA;1) Pay to STL addresses&#xA;2) Watcher process to detect and queue STL payments for a given d2/Q2&#xA;3) Offline verifier to take output from Watcher and verify spendable given  &#xA;encrypted d/d2&#xA;&#xA;Obviously extending QT directly for #1 would be ideal, I may even be able  &#xA;to do that since supporting a new address type should be fairly contained.  &#xA;But if not I&#39;ll punt to writing a node.js or python script which connects  &#xA;to bitcoind via RPC.&#xA;&#xA;Thanks,&#xA;Jeremy&#xA;&#xA;[1] - On Reusing Ephemeral Keys in Diffie-Hellman Key Agreement Protocols&#xA;       http://www.math.uwaterloo.ca/~ajmeneze/publications/ephemeral.pdf&#xA;&#xA;[2] - Validation of Elliptic Curve Public Keys&#xA;       http://www.iacr.org/archive/pkc2003/25670211/25670211.pdf</html></oembed>