<oembed><type>rich</type><version>1.0</version><author_name>npub1m230cem2yh3mtdzkg32qhj73uytgkyg5ylxsu083n3tpjnajxx4qqa2np2</author_name><author_url>https://nostr.ae/npub1m230cem2yh3mtdzkg32qhj73uytgkyg5ylxsu083n3tpjnajxx4qqa2np2</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2014-01-06&#xA;📝 Original message:* Abstract&#xA;&#xA;A Stealth Address is a new type of Bitcoin address and related&#xA;scriptPubKey/transaction generation scheme that allowers payees to&#xA;publish a single, fixed, address that payors can send funds efficiently,&#xA;privately, reliably and non-interactively. Payors do not learn what&#xA;other payments have been made to the stealth address, and third-parties&#xA;learn nothing at all. (both subject to an adjustable anonymity set)&#xA;&#xA;&#xA;* Acknowledgments&#xA;&#xA;Credit goes to ByteCoin for the original idea.(1) Gregory Maxwell, Adam&#xA;Back, and others on #bitcoin-wizards contributed valuable input on the&#xA;implementation. Finally thanks goes to Amir Taaki for input on the&#xA;general idea of stealth addresses and use-cases.&#xA;&#xA;&#xA;* Background&#xA;&#xA;Viewed generally a Bitcoin address is a mechanism by which a payee&#xA;instructs a payor to create a transaction such that the payee can spend&#xA;one or more of the transaction outputs. Of course, typically the address&#xA;is simply the hash of a pubkey, and the mechanism by which the funds are&#xA;made available to the payee is to simply create a scriptPubKey of the&#xA;following form:&#xA;&#xA;    DUP HASH160 &lt;pubKeyHash&gt; EQUALVERIFY CHECKSIG&#xA;&#xA;The problem however is address reuse: it is convenient for payees to&#xA;give one or more payor a single address and use it multiple times for&#xA;various purposes. This results in all those payments becoming trivially&#xA;linkable to each other by an attacker - a threat not only to the privacy&#xA;of the user, but also to all users of Bitcoin.(2)&#xA;&#xA;BIP32 hierarchical deterministic wallets are frequently proposed as a&#xA;solution. Now an address is a chain code and the mechanism by which a&#xA;scriptPubKey is generated is to derive a one-time-use pubkey from that&#xA;chain code and some index i. However, this quickly runs into two main&#xA;problems:&#xA;&#xA;1) Lack of privacy: While someone not in possession of the address can&#39;t&#xA;   link payments together, someone who is can.&#xA;&#xA;2) State: If the index is not to be re-used wallets must either maintain&#xA;   per-address state, or somehow query for already used indexes, or&#xA;   somehow generate them in a sufficiently small range that the payee&#xA;   can recover the indexes. All these solutions are problematic.&#xA;&#xA;A good example of where the BIP32-derivation solutions fails come up at&#xA;the Dark Wallet Hackathon where it was suggested by the author that for&#xA;the purpose of securing person-to-person payments OpenPGP public keys&#xA;and X.509 certificates be extended with a new user-id field containing a&#xA;Bitcoin address. Wallet software could then use either certificate&#xA;system to ensure funds were being sent to the intended recipients -&#xA;essentially a non-interactive way of solving what the BIP70 payment&#xA;protocol solves interactively. Of course, without stealth addresses the&#xA;scheme would likely have little or no privacy.&#xA;&#xA;&#xA;* Requirements&#xA;&#xA;1) Generated scriptPubKey must be globally unique&#xA;&#xA;2) Must be only spendable by payee&#xA;&#xA;3) scriptPubKey and associated transaction must be indistinguishable to&#xA;   third-parties from other transactions in some anonymity set.&#xA;&#xA;4) Method must be fully deterministic and funds recoverable from a&#xA;   wallet seed and blockchain data for both payee and payor.&#xA;&#xA;5) Funds must be efficiently recoverable by payee with reasonable, and&#xA;   configurable, computation and bandwidth costs.&#xA;&#xA;6) Must be compatible with CoinJoin/Must not leak information to payee&#xA;   about what txins were used to pay them.&#xA;&#xA;7) Must be compatible with multisig-protected wallets.&#xA;&#xA;8) Must not make assumptions about txin scriptSig form.&#xA;&#xA;9) Must be possible to prove to third parties that payment was made in&#xA;   accordance to instructions without revealing any other information.&#xA;&#xA;&#xA;** Payment Reliability&#xA;&#xA;Schemes for making payments by transmitting nonces to the recipient&#xA;through some other medium, such as Bitmessage, were discussed at the&#xA;Dark Wallet Hackathon. However using any medium but the blockchain&#xA;itself for the communication means that the reliability of the payment&#xA;getting to the recipient is less than that of a standard transaction.&#xA;For instance Bitmessage nodes only keep messages for two weeks. We&#xA;decided that anything less than reliable atomic transactions was&#xA;unacceptable.&#xA;&#xA;&#xA;* Applying encryption to payments, simple explanation&#xA;&#xA;Using Elliptic curve Diffie-Hellman (ECDH) we can generate a shared&#xA;secret that the payee can use to recover their funds. Let the payee have&#xA;keypair Q=dG. The payor generates nonce keypair P=eG and uses ECDH to&#xA;arrive at shared secret c=H(eQ)=H(dP). This secret could be used to&#xA;derive a ECC secret key, and from that a scriptPubKey, however that&#xA;would allow both payor and payee the ability to spend the funds. So&#xA;instead we use BIP32-style derivation to create Q&#39;=(Q+c)G and associated&#xA;scriptPubKey.&#xA;&#xA;As for the nonce keypair, that is included in the transaction in an&#xA;additional zero-valued output:&#xA;&#xA;    RETURN &lt;P&gt;&#xA;&#xA;The payee recovers the funds by scanning the blockchain for candiate P&#39;s&#xA;in transactions, regenerating the scriptPubKey, and finally checking if&#xA;any txouts in the transactions match. Note the close similarity of this&#xA;technique to how the Bitmessage network functions - an initial&#xA;implementation of the idea will find the Bitmessage code a suitable&#xA;starting point.&#xA;&#xA;&#xA;* Trading off anonymity set size for decreased bandwidth/CPU&#xA;&#xA;By taking advantage of prefix filters(3) we can choose a tradeoff&#xA;between anonymity set size and bandwidth/CPU usage if the payee&#xA;specifies that payments to them are to match some short prefix k. There&#xA;are a few possibilities for how the prefix is to the applied - the most&#xA;simple is if per-block indexes of scriptPubKeys are available:&#xA;&#xA;    RETURN &lt;k&gt; &lt;P&gt;&#xA;&#xA;Alternatively if per-block indexes of H(scriptPubKeys) are only&#xA;available the wallet software can grind the scriptPubKey with nonce i&#xA;until it matches the specified prefix:&#xA;&#xA;    RETURN &lt;i&gt; &lt;P&gt;&#xA;&#xA;Furthermore as symmetric ciphers are quite cheap we might as well hide&#xA;the purpose of the OP_RETURN txout and encrypt the pubkey P using H(Q)&#xA;as a symmetric key. This gives us a slightly larger anonymity set.&#xA;&#xA;&#xA;* Advantages of using a separate output&#xA;&#xA;An alternative would be to either re-use a pubkey or signature nonce&#xA;value from a transaction input, saving about 45 bytes per txout. An&#xA;absolute minimum sized Bitcoin transaction is 166 bytes(4) so at best we&#xA;have a 27% savings in tx fees, and more typically around ~15%. (modulo&#xA;mass-payments from a single txin)&#xA;&#xA;However using an explicit prunable OP_RETURN output to store the pubkey&#xA;rather than re-using one from a txin or txin signature has a number of&#xA;advantages:&#xA;&#xA;1) The txin&#39;s owned by the payor are not revealed to the payee. In fact,&#xA;   they could be held by a third-party who simply makes a transaction&#xA;   with the appropriate txouts on behalf of the payee.&#xA;&#xA;2) Less information about the txouts is leaked. The statistical&#xA;   distribution of txouts remains unchanged - not possible in re-use&#xA;   schemes because they need to grind the payee scriptPubKey&#39;s for the&#xA;   sake of the prefix filters.&#xA;&#xA;3) If required the nonce secret can be revealed to prove that a payment&#xA;   was made to a third-party, e.g. for dispute resolution.&#xA;&#xA;&#xA;* Bare CHECK(MULTI)SIG output alternative&#xA;&#xA;An alternative with better efficiency could be to use bare&#xA;OP_CHECK(MULTI)SIG outputs to hold the nonce pubkey - generally a second&#xA;output is needed anyway for change. The most simple would be to use Jeff&#xA;Garzik&#39;s OP_DROP proposal(5) for the prefix:&#xA;&#xA;  &lt;prefix&gt; DROP n &lt;pubkey&gt;...&lt;pubkey&gt; m CHECKMULTISIG&#xA;&#xA;  or&#xA;&#xA;  &lt;prefix&gt; DROP &lt;pubkey&gt; CHECKSIG&#xA;&#xA;The payor pubkey is in the *change* txout, and the payee&#39;s ECDH-derived&#xA;pubkey in the other txout. By setting the prefix to be the same on both&#xA;txouts and using the same basic scriptPubKey form the relationship of&#xA;change and payment is still hidden; CoinJoin-using implementations can&#xA;adopt even more sophisticated approaches.&#xA;&#xA;If IsStandard() rules remain the same and using OP_DROP is impractical,&#xA;we can also grind the change pubkey to match the prefix in a&#xA;deterministic manner so the wallet can still be recovered from a seed.&#xA;More costly, but maybe still acceptable for reasonably short prefixes.&#xA;Either way the result is transactions that are actually smaller and&#xA;cheaper than standard transactions, although without the advantage of&#xA;pushing scriptPubKey size payment to the receiver. (a pity we didn&#39;t&#xA;spend the extra time to adopt OP_EVAL)&#xA;&#xA;A disadvantage is that revealing the nonce secret to prove a payment was&#xA;made is more problematic - either the txout needs to be spent first, or&#xA;we need a CHECKMULTISIG.&#xA;&#xA;&#xA;* Address format&#xA;&#xA;To be decided. To support mulisig we probably want the ability to&#xA;specify n-of-m master pubkeys, using the nonce to generate derived ones.&#xA;For the single pubkey case the addresses will be a little longer than&#xA;standard Bitcoin addresses:&#xA;&#xA;  s9KND3vfXjs3YqfZp86Acce3bM7Mhuptwh6mjeDnThsDei9Z2ZZcU&#xA;&#xA;  vs.&#xA;&#xA;  1LZn91ynrA6BCmoUKwnV3Ygk4FQMfPxLbg&#xA;&#xA;&#xA;1) ByteCoin, Untraceable transactions which can contain a secure message&#xA;   are inevitable, https://bitcointalk.org/index.php?topic=5965.0&#xA;&#xA;2) Gregory Maxwell, Dark Wallet Certification discussions, also&#xA;   http://snowdenandthefuture.info/PartIII.html&#xA;&#xA;3) Peter Todd, [Bitcoin-development] Privacy and blockchain data,&#xA;   http://www.mail-archive.com/bitcoin-development@lists.sourceforge.net/msg03612.html&#xA;&#xA;4) Bitcoin Wiki, Maximum transaction rate,&#xA;   https://en.bitcoin.it/w/index.php?title=Maximum_transaction_rate&amp;oldid=36983&#xA;&#xA;5) Jeff Garzik, Add small-data OP_DROP transactions as standard&#xA;   transactions, https://github.com/bitcoin/bitcoin/pull/1809&#xA;&#xA;-- &#xA;&#39;peter&#39;[:-1]@petertodd.org&#xA;0000000000000002861ee0919fc86990573ac360820766dc1b9ba580e5ccf7b6&#xA;-------------- next part --------------&#xA;A non-text attachment was scrubbed...&#xA;Name: signature.asc&#xA;Type: application/pgp-signature&#xA;Size: 685 bytes&#xA;Desc: Digital signature&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20140106/53d085cc/attachment.sig&gt;</html></oembed>