Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Z1FC1-0002cq-IN for bitcoin-development@lists.sourceforge.net; Sat, 06 Jun 2015 14:35:25 +0000 X-ACL-Warn: Received: from mail-qg0-f48.google.com ([209.85.192.48]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1Z1FBz-0005nl-6T for bitcoin-development@lists.sourceforge.net; Sat, 06 Jun 2015 14:35:25 +0000 Received: by qgfa66 with SMTP id a66so3428637qgf.0 for ; Sat, 06 Jun 2015 07:35:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=O41czzB0kg4cIVIG6V6HgHfcV+k46Q4tEv2fyNEfHt0=; b=FYDAT3JXae9xi2ebUfP2mebNqN4DY2SaqM41X/oaCWK34ATLsovz2oSVZPCkW/jAxB jAJJtYv38AjcdFBa/Yq/ol7sQdoPUUtU2ffHj8uoFPfiW14lIuciM9opULSluOC6dIEn WsaPsF04bp41SItszPIHCmlyIzXnVnr8iqcl+mDnByBjC5h68NhVF0PrXJp3YnvX9K+B 1Xum1yQUn8nYFqKybcy301zCdq6u846ROYGyJs+vjO7yM5FBSkcyK/ecsldVnp+ycutG IChZHr8/jEEDmFTKSwzF50aThlQ1iyGJyruHBlKJW+Ws/49CSrYSwn81pJnIzizqHb90 MkUQ== X-Gm-Message-State: ALoCoQn9kJZQeutMuhtrMvifyzLdTOj4c+dKPpvBaE98Jc6QFeEAtLtwp7giJEkj3N5zvnA29RE1 MIME-Version: 1.0 X-Received: by 10.140.96.43 with SMTP id j40mr9720133qge.22.1433601317415; Sat, 06 Jun 2015 07:35:17 -0700 (PDT) Received: by 10.96.145.9 with HTTP; Sat, 6 Jun 2015 07:35:17 -0700 (PDT) Date: Sat, 6 Jun 2015 16:35:17 +0200 Message-ID: From: Kalle Rosenbaum To: Greg Maxwell Content-Type: multipart/alternative; boundary=001a113a974846442a0517da51a9 X-Spam-Score: 1.0 (+) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 1.0 HTML_MESSAGE BODY: HTML included in message 0.0 T_FILL_THIS_FORM_SHORT Fill in a short form with personal information 0.0 FORM_FRAUD Fill a form and a fraud phrase X-Headers-End: 1Z1FBz-0005nl-6T Cc: Bitcoin Dev Subject: [Bitcoin-development] BIP for Proof of Payment X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jun 2015 14:35:25 -0000 --001a113a974846442a0517da51a9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Following earlier posts on Proof of Payment I'm now proposing the following BIP (To read it formatted instead, go to https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP). Regards, Kalle Rosenbaum
  BIP: 
  Title: Proof of Payment
  Author: Kalle Rosenbaum 
  Status: Draft
  Type: Standards Track
  Created: 
=3D=3D Abstract =3D=3D This BIP describes how a wallet can prove to a server that it has the ability to sign a certain transaction. =3D=3D Motivation =3D=3D There are several scenarios in which it would be useful to prove that you have paid for something. For example: * A pre-paid hotel room where your PoP functions as a key to the door. * An online video rental service where you pay for a video and watch it on any device. * An ad-sign where you pay in advance for e.g. 2 weeks exclusivity. During this period you can upload new content to the sign whenever you like using PoP. * Log in to a pay site using a PoP. * A parking lot you pay for monthly and the car authenticates itself using PoP. * A lottery where all participants pay to the same address, and the winner is selected among the transactions to that address. You exchange the prize for a PoP for the winning transaction. With Proof of Payment, these use cases can be achieved without any personal information (user name, password, e-mail address, etc) being involved. =3D=3D Rationale =3D=3D Desirable properties: # A PoP should be generated on demand. # It should only be usable once to avoid issues due to theft. # It should be able to create a PoP for any payment, regardless of script type (P2SH, P2PKH, etc.). # It should prove that you have enough credentials to unlock all the inputs of the proven transaction. # It should be easy to implement by wallets and servers to ease adoption. Current methods of proving a payment: * In BIP0070, the PaymentRequest together with the transactions fulfilling the request makes some sort of proof. However, it does not meet 1, 2 or 4 and it obviously only meets 3 if the payment is made through BIP0070. Also, there's no standard way to request/provide the proof. If standardized it would probably meet 5. * Signing messages, chosen by the server, with the private keys used to sign the transaction. This could meet 1 and 2 but probably not 3. This is not standardized either. 4 Could be met if designed so. If the script type is P2SH, any satisfying script should do, just like for a payment. For M-of-N multisig scripts, that would mean that any set of M keys should be sufficient, not neccesarily the same set of M keys that signed the transaction. This is important because strictly demanding the same set of M keys would undermine the purpose of a multisig address. =3D=3D Specification =3D=3D =3D=3D=3D Data structure =3D=3D=3D A proof of payment for a transaction T, here called PoP(T), is used to prove that one has ownership of the credentials needed to unlock all the inputs of T. It has the exact same structure as a bitcoin transaction with the same inputs and outputs as T and in the same order as in T. There is also one OP_RETURN output inserted at index 0, here called the pop output. This output must have the following format: OP_RETURN {| ! Field !! Size [B] !! Description |- | <version> || 2 || Version, little endian, currently 0x01 0x00 |- | <txid> || 32 || The transaction to prove |- | <nonce> || 6 || Random data |} The value of the pop output is set to the same value as the transaction fee of T. Also, if the outputs of T contains an OP_RETURN output, that output must not be included in the PoP because there can only be one OP_RETURN output in a transaction. The value of that OP_RETURN output is instead added to the value of the pop output. An illustration of the PoP data structure and its original payment is shown below.
  T
 +----------------------------------------------+
 |inputs       | outputs                        |
 |       Value | Value   Script                 |
 +----------------------------------------------+
 |input0 1     |     0   pay to A               |
 |input1 3     |     2   OP_RETURN   |
 |input2 4     |     1   pay to B               |
 |             |     4   pay to C               |
 +----------------------------------------------+

  PoP(T)
 +----------------------------------------------------------+
 |inputs       | outputs                                    |
 |       Value | Value   Script                             |
 +----------------------------------------------------------+
 |input0 1     |     3   OP_RETURN    |
 |input1 3     |     0   pay to A                           |
 |input2 4     |     1   pay to B                           |
 |             |     4   pay to C                           |
 +----------------------------------------------------------+
The PoP is signed using the same signing process that is used for bitcoin transactions. The purpose of the nonce is to make it harder to use a stolen PoP; Once the PoP has reached the server, that PoP is useless since the server will generate a new nonce for every PoP request. Since a PoP is indistinguishable from a bitcoin transaction, there is a risk that it, accidently or maliciously, enters the bitcoin p2p network. If T is still unconfirmed, or if a reorg takes place, chances are that PoP(T) ends up in a block, invalidating T. Therefore it is important that the outputs of the PoP are the same as in T. The zero transaction fee in PoP(T) is to minimize the incentives for miners to select PoP(T) for inclusion. =3D=3D=3D Process =3D=3D=3D # A proof of payment request is sent from the server to the wallet. The PoP request contains: ## a random nonce ## a destination where to send the PoP, for example a https URL ## data hinting the wallet which transaction to create a proof for. For example: ##* txid, if known by the server ##* PaymentRequest.PaymentDetails.merchant_data (in case of a BIP0070 payment) ##* amount, label, message or other information from a BIP0021 URL # The wallet identifies a transaction T, if possible. Otherwise it asks the user to select among the ones that match the hints in 1.iii. # The wallet creates an unsigned PoP (UPoP) for T, and asks the user to sign it. # The user confirms # The UPoP(T) is signed by the wallet, creating PoP(T). # The PoP is sent to the destination in 1.ii. # The server receiving the PoP validates it and responds with =E2=80=9Cvali= d=E2=80=9D or =E2=80=9Cinvalid=E2=80=9D. # The wallet displays the response in some way to the user. '''Remarks:''' * The method of transferring the PoP request at step 1 is not specified here. Instead that is specified in separate specifications. See [btcpop scheme BIP](btcpop scheme BIP). * The nonce must be randomly generated by the server for every new PoP request. =3D=3D=3D Validating a PoP =3D=3D=3D The server needs to validate the PoP and reply with "valid" or "invalid". That process is outlined below. If any step fails, the validation is aborted and "invalid" is returned: # Check the format of the PoP. It must pass normal transaction checks, except that the inputs may already be spent. # Check the PoP output at index 0. It must conform to the OP_RETURN output format outlined above. # Check that the rest of the outputs exactly corresponds to the outputs of T and that they appear in the same order as in T. An exception to this is that any OP_RETURN outputs of T must not be included in the PoP. All output value from the OP_RETURN must instead be included in the PoP output. # Check that the nonce is the same as the one you requested. # Check that the inputs of the PoP are exactly the same as in transaction T, and in the same order. # Check the scripts of all the inputs, as would be done on a normal transaction. # Check that the txid in the PoP output is the transaction you actually want proof for. If you don=E2=80=99t know exactly what transaction you want= proof for, check that the transaction actually pays for the product/service you deliver. # Return "valid". =3D=3D Security considerations =3D=3D * Someone can intercept the PoP-request and change the PoP destination so that the user sends the PoP to the bad actor. * Someone can intercept the PoP-request and change for example the txid to trick the user to sign a PoP for another transaction than the intended. This can of course be avoided if the user is actually looking at the UPoP before signing it. The bad actor could also set hints for a transaction, existing or not, that the user didn=E2=80=99t make, resulting in a broken s= ervice. * Someone can steal a PoP and try to use the service hoping to get a matching nonce. Probability per try: 1/(2^48). The server should have a mechanism for detecting a brute force attack of this kind, or at least slow down the process by delaying the PoP request by some 100 ms or so. * Even if a wallet has no funds it might still be valuable as a generator for PoPs. This makes it important to keep the security of the wallet after it has been emptied. * Transaction malleability may cause the server to have another transaction id than the wallet for the payment. In that case the wallet will not be able to prove the transaction for the server. Wallets should not rely on the transaction id of the outgoing transaction. Instead it should listen for the transaction on the network and put that in its list of transactions= . The first two issues are the same attack vector as for traditional, ie BIP0021, bitcoin payments. They could be mitigated by using secure connections. =3D=3D Reference implementation =3D=3D [https://github.com/kallerosenbaum/poppoc poppoc on GitHub] [https://github.com/kallerosenbaum/wallet Mycelium fork on GitHub] =3D=3D References =3D=3D [https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki BIP0021]: URI Scheme [https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki BIP0070]: Payment Protocol [[btcpop scheme BIP]] --001a113a974846442a0517da51a9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi

Following earlier posts on Proof of Payment I= 9;m now proposing the following BIP (To read it formatted instead, go to https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP).<= br>
Regards,
Kalle Rosenbaum

<pre>
=C2=A0 BIP: <BI= P number>
=C2=A0 Title: Proof of Payment
=C2=A0 Author: Kalle Rose= nbaum <kalle@rosenbaum.se><= br>=C2=A0 Status: Draft
=C2=A0 Type: Standards Track
=C2=A0 Created: = <date created on, in ISO 8601 (yyyy-mm-dd) format>
</pre>
=3D=3D Abstract =3D=3D

This BIP describes how a wallet can prov= e to a server that it has the ability to sign a certain transaction.
=3D=3D Motivation =3D=3D

There are several scenarios in which it wo= uld be useful to prove that you have paid for something. For example:
* A pre-paid hotel room where your PoP functions as a key to the door.* An online video rental service where you pay for a video and watch it on= any device.
* An ad-sign where you pay in advance for e.g. 2 weeks excl= usivity. During this period you can upload new content to the sign whenever= you like using PoP.
* Log in to a pay site using a PoP.
* A parking = lot you pay for monthly and the car authenticates itself using PoP.
* A = lottery where all participants pay to the same address, and the winner is s= elected among the transactions to that address. You exchange the prize for = a PoP for the winning transaction.

With Proof of Payment, these use = cases can be achieved without any personal information (user name, password= , e-mail address, etc) being involved.

=3D=3D Rationale =3D=3D
Desirable properties:

# A PoP should be generated on demand.
# = It should only be usable once to avoid issues due to theft.
# It should = be able to create a PoP for any payment, regardless of script type (P2SH, P= 2PKH, etc.).
# It should prove that you have enough credentials to unloc= k all the inputs of the proven transaction.
# It should be easy to imple= ment by wallets and servers to ease adoption.

Current methods of pro= ving a payment:

* In BIP0070, the PaymentRequest together with the t= ransactions fulfilling the request makes some sort of proof. However, it do= es not meet 1, 2 or 4 and it obviously only meets 3 if the payment is made = through BIP0070. Also, there's no standard way to request/provide the p= roof. If standardized it would probably meet 5.
* Signing messages, chos= en by the server, with the private keys used to sign the transaction. This = could meet 1 and 2 but probably not 3. This is not standardized either. 4 C= ould be met if designed so.

If the script type is P2SH, any satisfyi= ng script should do, just like for a payment. For M-of-N multisig scripts, = that would mean that any set of M keys should be sufficient, not neccesaril= y the same set of M keys that signed the transaction. This is important bec= ause strictly demanding the same set of M keys would undermine the purpose = of a multisig address.

=3D=3D Specification =3D=3D

=3D=3D=3D = Data structure =3D=3D=3D

A proof of payment for a transaction T, her= e called PoP(T), is used to prove that one has ownership of the credentials= needed to unlock all the inputs of T. It has the exact same structure as a= bitcoin transaction with the same inputs and outputs as T and in the same = order as in T. There is also one OP_RETURN output inserted at index 0, here= called the pop output. This output must have the following format:

= =C2=A0OP_RETURN <version> <txid> <nonce>

{|=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
! Field=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 !! Size [B] !! Description
|-
| &lt;version> |= | 2=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 || Version, little endian, cu= rrently 0x01 0x00
|-
| &lt;txid>=C2=A0=C2=A0=C2=A0 || 32=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 || The transaction to prove
|-
| &= lt;nonce>=C2=A0=C2=A0 || 6=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 || = Random data
|}

The value of the pop output is set to the same val= ue as the transaction fee of T. Also, if the outputs of T contains an OP_RE= TURN output, that output must not be included in the PoP because there can = only be one OP_RETURN output in a transaction. The value of that OP_RETURN = output is instead added to the value of the pop output.

An illustrat= ion of the PoP data structure and its original payment is shown below.
<= br><pre>
=C2=A0 T
=C2=A0+--------------------------------------= --------+
=C2=A0|inputs=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | outputs=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |
=C2=A0|= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Value | Value=C2=A0=C2=A0 Script=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 |
=C2=A0+----------------------------------------------+=
=C2=A0|input0 1=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0 0=C2= =A0=C2=A0 pay to A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 |
=C2=A0|input1 3=C2=A0=C2=A0=C2=A0=C2=A0 |= =C2=A0=C2=A0=C2=A0=C2=A0 2=C2=A0=C2=A0 OP_RETURN <some data>=C2=A0 |<= br>=C2=A0|input2 4=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0 1=C2= =A0=C2=A0 pay to B=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 |
=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0 4=C2=A0= =C2=A0 pay to C=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 |
=C2=A0+--------------------------------------= --------+
=C2=A0
=C2=A0 PoP(T)
=C2=A0+----------------------------= ------------------------------+
=C2=A0|inputs=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 | outputs=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 |
=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Value | Value=C2=A0= =C2=A0 Script=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |
=C2=A0+-----------------------------= -----------------------------+
=C2=A0|input0 1=C2=A0=C2=A0=C2=A0=C2=A0 |= =C2=A0=C2=A0=C2=A0=C2=A0 3=C2=A0=C2=A0 OP_RETURN <version> <txid&g= t; <nonce> |
=C2=A0|input1 3=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0= =C2=A0=C2=A0 0=C2=A0=C2=A0 pay to A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |
=C2=A0|input2 4=C2=A0=C2=A0= =C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0 pay to B=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |
= =C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0 4=C2=A0=C2=A0 pay to C=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |
=C2=A0= +----------------------------------------------------------+
</pre>= ;

The PoP is signed using the same signing process that is used for = bitcoin transactions.

The purpose of the nonce is to make it harder = to use a stolen PoP; Once the PoP has reached the server, that PoP is usele= ss since the server will generate a new nonce for every PoP request.
Since a PoP is indistinguishable from a bitcoin transaction, there is a ri= sk that it, accidently or maliciously, enters the bitcoin p2p network. If T= is still unconfirmed, or if a reorg takes place, chances are that PoP(T) e= nds up in a block, invalidating T. Therefore it is important that the outpu= ts of the PoP are the same as in T. The zero transaction fee in PoP(T) is t= o minimize the incentives for miners to select PoP(T) for inclusion.
=3D=3D=3D Process =3D=3D=3D

# A proof of payment request is sent fr= om the server to the wallet. The PoP request contains:
## a random nonce=
## a destination where to send the PoP, for example a https URL
## d= ata hinting the wallet which transaction to create a proof for. For example= :
##* txid, if known by the server
##* PaymentRequest.PaymentDetails.= merchant_data (in case of a BIP0070 payment)
##* amount, label, message = or other information from a BIP0021 URL
# The wallet identifies a transa= ction T, if possible. Otherwise it asks the user to select among the ones t= hat match the hints in 1.iii.
# The wallet creates an unsigned PoP (UPoP= ) for T, and asks the user to sign it.
# The user confirms
# The UPoP= (T) is signed by the wallet, creating PoP(T).
# The PoP is sent to the d= estination in 1.ii.
# The server receiving the PoP validates it and resp= onds with =E2=80=9Cvalid=E2=80=9D or =E2=80=9Cinvalid=E2=80=9D.
# The wa= llet displays the response in some way to the user.

'''R= emarks:'''

* The method of transferring the PoP request = at step 1 is not specified here. Instead that is specified in separate spec= ifications. See [btcpop scheme BIP](btcpop scheme BIP).
* The nonce must= be randomly generated by the server for every new PoP request.

=3D= =3D=3D Validating a PoP =3D=3D=3D

The server needs to validate the P= oP and reply with "valid" or "invalid". That process is= outlined below. If any step fails, the validation is aborted and "inv= alid" is returned:

# Check the format of the PoP. It must pass = normal transaction checks, except that the inputs may already be spent.
= # Check the PoP output at index 0. It must conform to the OP_RETURN output = format outlined above.
# Check that the rest of the outputs exactly corr= esponds to the outputs of T and that they appear in the same order as in T.= An exception to this is that any OP_RETURN outputs of T must not be includ= ed in the PoP. All output value from the OP_RETURN must instead be included= in the PoP output.
# Check that the nonce is the same as the one you re= quested.
# Check that the inputs of the PoP are exactly the same as in t= ransaction T, and in the same order.
# Check the scripts of all the inpu= ts, as would be done on a normal transaction.
# Check that the txid in t= he PoP output is the transaction you actually want proof for. If you don=E2= =80=99t know exactly what transaction you want proof for, check that the tr= ansaction actually pays for the product/service you deliver.
# Return &q= uot;valid".

=3D=3D Security considerations =3D=3D

* Some= one can intercept the PoP-request and change the PoP destination so that th= e user sends the PoP to the bad actor.
* Someone can intercept the PoP-r= equest and change for example the txid to trick the user to sign a PoP for = another transaction than the intended. This can of course be avoided if the= user is actually looking at the UPoP before signing it. The bad actor coul= d also set hints for a transaction, existing or not, that the user didn=E2= =80=99t make, resulting in a broken service.
* Someone can steal a PoP a= nd try to use the service hoping to get a matching nonce. Probability per t= ry: 1/(2^48). The server should have a mechanism for detecting a brute forc= e attack of this kind, or at least slow down the process by delaying the Po= P request by some 100 ms or so.
* Even if a wallet has no funds it might= still be valuable as a generator for PoPs. This makes it important to keep= the security of the wallet after it has been emptied.
* Transaction mal= leability may cause the server to have another transaction id than the wall= et for the payment. In that case the wallet will not be able to prove the t= ransaction for the server. Wallets should not rely on the transaction id of= the outgoing transaction. Instead it should listen for the transaction on = the network and put that in its list of transactions.

The first two = issues are the same attack vector as for traditional, ie BIP0021, bitcoin p= ayments. They could be mitigated by using secure connections.

=3D=3D= Reference implementation =3D=3D

[https://github.com/kallerosenbaum/poppoc poppoc on G= itHub]

[https:/= /github.com/kallerosenbaum/wallet Mycelium fork on GitHub]

=3D= =3D References =3D=3D

[https://github.com/bitcoin/bips/blob/master/b= ip-0021.mediawiki BIP0021]: URI Scheme

[https://github.com/bitco= in/bips/blob/master/bip-0070.mediawiki BIP0070]: Payment Protocol
[[btcpop scheme BIP]]

--001a113a974846442a0517da51a9--