public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
* [Bitcoin-development] BIP for Proof of Payment
@ 2015-06-06 14:35 Kalle Rosenbaum
  2015-06-06 14:47 ` Pieter Wuille
  2015-06-06 15:18 ` Luke Dashjr
  0 siblings, 2 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-06 14:35 UTC (permalink / raw)
  To: Greg Maxwell; +Cc: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 10238 bytes --]

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

<pre>
  BIP: <BIP number>
  Title: Proof of Payment
  Author: Kalle Rosenbaum <kalle@rosenbaum.se>
  Status: Draft
  Type: Standards Track
  Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
</pre>

== Abstract ==

This BIP describes how a wallet can prove to a server that it has the
ability to sign a certain transaction.

== Motivation ==

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.

== Rationale ==

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.

== Specification ==

=== Data structure ===

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 <version> <txid> <nonce>

{|
! Field        !! Size [B] !! Description
|-
| &lt;version> || 2        || Version, little endian, currently 0x01 0x00
|-
| &lt;txid>    || 32       || The transaction to prove
|-
| &lt;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.

<pre>
  T
 +----------------------------------------------+
 |inputs       | outputs                        |
 |       Value | Value   Script                 |
 +----------------------------------------------+
 |input0 1     |     0   pay to A               |
 |input1 3     |     2   OP_RETURN <some data>  |
 |input2 4     |     1   pay to B               |
 |             |     4   pay to C               |
 +----------------------------------------------+

  PoP(T)
 +----------------------------------------------------------+
 |inputs       | outputs                                    |
 |       Value | Value   Script                             |
 +----------------------------------------------------------+
 |input0 1     |     3   OP_RETURN <version> <txid> <nonce> |
 |input1 3     |     0   pay to A                           |
 |input2 4     |     1   pay to B                           |
 |             |     4   pay to C                           |
 +----------------------------------------------------------+
</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 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.

=== Process ===

# 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 “valid” or
“invalid”.
# 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.

=== Validating a PoP ===

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’t know exactly what transaction you want proof
for, check that the transaction actually pays for the product/service you
deliver.
# Return "valid".

== Security considerations ==

* 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’t make, resulting in a broken service.
* 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.

== Reference implementation ==

[https://github.com/kallerosenbaum/poppoc poppoc on GitHub]

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

== References ==

[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]]

[-- Attachment #2: Type: text/html, Size: 11490 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 14:35 [Bitcoin-development] BIP for Proof of Payment Kalle Rosenbaum
@ 2015-06-06 14:47 ` Pieter Wuille
  2015-06-06 15:05   ` Kalle Rosenbaum
  2015-06-06 15:18 ` Luke Dashjr
  1 sibling, 1 reply; 32+ messages in thread
From: Pieter Wuille @ 2015-06-06 14:47 UTC (permalink / raw)
  To: Kalle Rosenbaum; +Cc: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 11680 bytes --]

What do you gain by making PoPs actually valid transactions? You could for
example change the signature hashing algorithm (prepend a constant string,
or add a second hashing step) for signing, rendering the signatures in a
PoP unusable for actual transaction, while still committing to the same
actual transaction. That would also remove the need for the OP_RETURN to
catch fees.

Also, I would call it "proof of transaction intent", as it's a commitment
to a transaction and proof of its validity, but not a proof that an actual
transaction took place, nor a means to prevent it from being double spent.



On Sat, Jun 6, 2015 at 4:35 PM, Kalle Rosenbaum <kalle@rosenbaum.se> wrote:

> 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
>
> <pre>
>   BIP: <BIP number>
>   Title: Proof of Payment
>   Author: Kalle Rosenbaum <kalle@rosenbaum.se>
>   Status: Draft
>   Type: Standards Track
>   Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
> </pre>
>
> == Abstract ==
>
> This BIP describes how a wallet can prove to a server that it has the
> ability to sign a certain transaction.
>
> == Motivation ==
>
> 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.
>
> == Rationale ==
>
> 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.
>
> == Specification ==
>
> === Data structure ===
>
> 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 <version> <txid> <nonce>
>
> {|
> ! Field        !! Size [B] !! Description
> |-
> | &lt;version> || 2        || Version, little endian, currently 0x01 0x00
> |-
> | &lt;txid>    || 32       || The transaction to prove
> |-
> | &lt;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.
>
> <pre>
>   T
>  +----------------------------------------------+
>  |inputs       | outputs                        |
>  |       Value | Value   Script                 |
>  +----------------------------------------------+
>  |input0 1     |     0   pay to A               |
>  |input1 3     |     2   OP_RETURN <some data>  |
>  |input2 4     |     1   pay to B               |
>  |             |     4   pay to C               |
>  +----------------------------------------------+
>
>   PoP(T)
>  +----------------------------------------------------------+
>  |inputs       | outputs                                    |
>  |       Value | Value   Script                             |
>  +----------------------------------------------------------+
>  |input0 1     |     3   OP_RETURN <version> <txid> <nonce> |
>  |input1 3     |     0   pay to A                           |
>  |input2 4     |     1   pay to B                           |
>  |             |     4   pay to C                           |
>  +----------------------------------------------------------+
> </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 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.
>
> === Process ===
>
> # 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 “valid” or
> “invalid”.
> # 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.
>
> === Validating a PoP ===
>
> 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’t know exactly what transaction you want proof
> for, check that the transaction actually pays for the product/service you
> deliver.
> # Return "valid".
>
> == Security considerations ==
>
> * 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’t make, resulting in a broken service.
> * 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.
>
> == Reference implementation ==
>
> [https://github.com/kallerosenbaum/poppoc poppoc on GitHub]
>
> [https://github.com/kallerosenbaum/wallet Mycelium fork on GitHub]
>
> == References ==
>
> [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]]
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>

[-- Attachment #2: Type: text/html, Size: 13089 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 14:47 ` Pieter Wuille
@ 2015-06-06 15:05   ` Kalle Rosenbaum
  2015-06-06 15:13     ` Pieter Wuille
  2015-06-06 16:10     ` Tom Harding
  0 siblings, 2 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-06 15:05 UTC (permalink / raw)
  To: Pieter Wuille; +Cc: Bitcoin Dev

> What do you gain by making PoPs actually valid transactions? You could for
> example change the signature hashing algorithm (prepend a constant string,
> or add a second hashing step) for signing, rendering the signatures in a PoP
> unusable for actual transaction, while still committing to the same actual
> transaction. That would also remove the need for the OP_RETURN to catch
> fees.

The idea is to simplify implementation. Existing software can be used
as is to sign and validate PoPs. But I do agree that it would be a
cleaner specification if we would make the PoP invalid as a
transaction. I'm open to changes here. I do like the idea to prepend a
constant string. But that would require changes in transaction signing
and validation code, wouldn't it?

>
> Also, I would call it "proof of transaction intent", as it's a commitment to
> a transaction and proof of its validity, but not a proof that an actual
> transaction took place, nor a means to prevent it from being double spent.
>

Naming is hard. I think a simpler name that explains what its main
purpose is (prove that you paid for something) is better than a name
that exactly tries to explain what it is. "Proof of transaction
intent" does not help me understand what this is about. But I would
like to see more name suggestions. The name does not prevent people
from using it for other purposes, ie internet over telephone network.

Thank you
/Kalle

>
>
> On Sat, Jun 6, 2015 at 4:35 PM, Kalle Rosenbaum <kalle@rosenbaum.se> wrote:
>>
>> 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
>>
>> <pre>
>>   BIP: <BIP number>
>>   Title: Proof of Payment
>>   Author: Kalle Rosenbaum <kalle@rosenbaum.se>
>>   Status: Draft
>>   Type: Standards Track
>>   Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
>> </pre>
>>
>> == Abstract ==
>>
>> This BIP describes how a wallet can prove to a server that it has the
>> ability to sign a certain transaction.
>>
>> == Motivation ==
>>
>> 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.
>>
>> == Rationale ==
>>
>> 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.
>>
>> == Specification ==
>>
>> === Data structure ===
>>
>> 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 <version> <txid> <nonce>
>>
>> {|
>> ! Field        !! Size [B] !! Description
>> |-
>> | &lt;version> || 2        || Version, little endian, currently 0x01 0x00
>> |-
>> | &lt;txid>    || 32       || The transaction to prove
>> |-
>> | &lt;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.
>>
>> <pre>
>>   T
>>  +----------------------------------------------+
>>  |inputs       | outputs                        |
>>  |       Value | Value   Script                 |
>>  +----------------------------------------------+
>>  |input0 1     |     0   pay to A               |
>>  |input1 3     |     2   OP_RETURN <some data>  |
>>  |input2 4     |     1   pay to B               |
>>  |             |     4   pay to C               |
>>  +----------------------------------------------+
>>
>>   PoP(T)
>>  +----------------------------------------------------------+
>>  |inputs       | outputs                                    |
>>  |       Value | Value   Script                             |
>>  +----------------------------------------------------------+
>>  |input0 1     |     3   OP_RETURN <version> <txid> <nonce> |
>>  |input1 3     |     0   pay to A                           |
>>  |input2 4     |     1   pay to B                           |
>>  |             |     4   pay to C                           |
>>  +----------------------------------------------------------+
>> </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 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.
>>
>> === Process ===
>>
>> # 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 “valid” or
>> “invalid”.
>> # 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.
>>
>> === Validating a PoP ===
>>
>> 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’t know exactly what transaction you want proof
>> for, check that the transaction actually pays for the product/service you
>> deliver.
>> # Return "valid".
>>
>> == Security considerations ==
>>
>> * 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’t make, resulting in a broken service.
>> * 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.
>>
>> == Reference implementation ==
>>
>> [https://github.com/kallerosenbaum/poppoc poppoc on GitHub]
>>
>> [https://github.com/kallerosenbaum/wallet Mycelium fork on GitHub]
>>
>> == References ==
>>
>> [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]]
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Bitcoin-development mailing list
>> Bitcoin-development@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>>
>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 15:05   ` Kalle Rosenbaum
@ 2015-06-06 15:13     ` Pieter Wuille
  2015-06-06 16:20       ` Kalle Rosenbaum
  2015-06-06 16:10     ` Tom Harding
  1 sibling, 1 reply; 32+ messages in thread
From: Pieter Wuille @ 2015-06-06 15:13 UTC (permalink / raw)
  To: Kalle Rosenbaum; +Cc: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 2389 bytes --]

On Sat, Jun 6, 2015 at 5:05 PM, Kalle Rosenbaum <kalle@rosenbaum.se> wrote:

> > What do you gain by making PoPs actually valid transactions? You could
> for
> > example change the signature hashing algorithm (prepend a constant
> string,
> > or add a second hashing step) for signing, rendering the signatures in a
> PoP
> > unusable for actual transaction, while still committing to the same
> actual
> > transaction. That would also remove the need for the OP_RETURN to catch
> > fees.
>
> The idea is to simplify implementation. Existing software can be used
> as is to sign and validate PoPs. But I do agree that it would be a
> cleaner specification if we would make the PoP invalid as a
> transaction. I'm open to changes here. I do like the idea to prepend a
> constant string. But that would require changes in transaction signing
> and validation code, wouldn't it?
>

Yes, of course. An alternative is adding a 21M BTC output at the end, or
bitflipping the txin prevout hashes, or another reversible transformation
on the transaction data that is guaranteed to invalidate it.

I think that the risk of asking people to sign something that is not an
actual transaction, but could be used as one, is very scary.


> > Also, I would call it "proof of transaction intent", as it's a
> commitment to
> > a transaction and proof of its validity, but not a proof that an actual
> > transaction took place, nor a means to prevent it from being double
> spent.
>
>
> Naming is hard. I think a simpler name that explains what its main
> purpose is (prove that you paid for something) is better than a name
> that exactly tries to explain what it is.


"Proof of Payment" indeed does make me think it's something that proves you
paid. But as described, that is not what a PoP does. It proves the ability
to create a particular transaction, and committing to it. There is no
actual payment involved (plus, payment makes me think you're talking about
BIP70 payments, not simple Bitcoin transactions).


> "Proof of transaction
> intent" does not help me understand what this is about. But I would
> like to see more name suggestions. The name does not prevent people
> from using it for other purposes, ie internet over telephone network.
>

I don't understand why something like "Proof of Transaction Intent" would
be incompatible with internet over telephone network either...

-- 
Pieter

[-- Attachment #2: Type: text/html, Size: 3237 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 14:35 [Bitcoin-development] BIP for Proof of Payment Kalle Rosenbaum
  2015-06-06 14:47 ` Pieter Wuille
@ 2015-06-06 15:18 ` Luke Dashjr
  2015-06-06 15:23   ` Pieter Wuille
  1 sibling, 1 reply; 32+ messages in thread
From: Luke Dashjr @ 2015-06-06 15:18 UTC (permalink / raw)
  To: bitcoin-development

On Saturday, June 06, 2015 2:35:17 PM Kalle Rosenbaum wrote:
> Current methods of proving a payment:
> 
> * 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.

It's also not secure, since the signed messages only prove ownership of the 
address associated with the private key, and does not prove ownership of 
UTXOs currently redeemable with the private key, nor prove past UTXOs spent 
were approved by the owner of the address.

> 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.

This appears to be incompatible with CoinJoin at least. Maybe there's some 
clean way to avoid that by using 
https://github.com/Blockstream/contracthashtool ?

> 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.

I also agree with Pieter, that this should *not* be so cleanly compatible 
with Bitcoin transactions. If you wish to share code, perhaps using an 
invalid opcode rather than OP_RETURN would be appropriate.

Luke



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 15:18 ` Luke Dashjr
@ 2015-06-06 15:23   ` Pieter Wuille
  2015-06-06 15:32     ` Peter Todd
  0 siblings, 1 reply; 32+ messages in thread
From: Pieter Wuille @ 2015-06-06 15:23 UTC (permalink / raw)
  To: Luke Dashjr; +Cc: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

On Sat, Jun 6, 2015 at 5:18 PM, Luke Dashjr <luke@dashjr.org> wrote:

> I also agree with Pieter, that this should *not* be so cleanly compatible
> with Bitcoin transactions. If you wish to share code, perhaps using an
> invalid opcode rather than OP_RETURN would be appropriate.


Using an invalid opcode would merely send funds into the void. It wouldn't
invalidate the transaction.

-- 
Pieter

[-- Attachment #2: Type: text/html, Size: 741 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 15:23   ` Pieter Wuille
@ 2015-06-06 15:32     ` Peter Todd
  2015-06-06 16:35       ` Kalle Rosenbaum
  0 siblings, 1 reply; 32+ messages in thread
From: Peter Todd @ 2015-06-06 15:32 UTC (permalink / raw)
  To: Pieter Wuille; +Cc: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

On Sat, Jun 06, 2015 at 05:23:48PM +0200, Pieter Wuille wrote:
> On Sat, Jun 6, 2015 at 5:18 PM, Luke Dashjr <luke@dashjr.org> wrote:
> 
> > I also agree with Pieter, that this should *not* be so cleanly compatible
> > with Bitcoin transactions. If you wish to share code, perhaps using an
> > invalid opcode rather than OP_RETURN would be appropriate.
> 
> 
> Using an invalid opcode would merely send funds into the void. It wouldn't
> invalidate the transaction.

Just set nLockTime to 500000000-1 and nSequence appropriately to make
the transaction impossible to mine for the next 9500 years.

Though I agree that this whole idea seems a bit dubious to me.

-- 
'peter'[:-1]@petertodd.org
00000000000000000000dd919214b66444dcebb4aa0214c1ab7c8b3b633be71f

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 650 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 15:05   ` Kalle Rosenbaum
  2015-06-06 15:13     ` Pieter Wuille
@ 2015-06-06 16:10     ` Tom Harding
  2015-06-06 17:00       ` Kalle Rosenbaum
  1 sibling, 1 reply; 32+ messages in thread
From: Tom Harding @ 2015-06-06 16:10 UTC (permalink / raw)
  To: Kalle Rosenbaum; +Cc: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

On Jun 6, 2015 8:05 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:

> I'm open to changes here.

I suggest:

- Don't include any real outputs.   They are redundant because the txid is
already referenced.

- Start the proof script, which should be invalid, with a magic constant
and include space for future expansion.  This makes PoP's easy to identify
and extend.

- "Proof of Potential"

[-- Attachment #2: Type: text/html, Size: 589 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 15:13     ` Pieter Wuille
@ 2015-06-06 16:20       ` Kalle Rosenbaum
  0 siblings, 0 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-06 16:20 UTC (permalink / raw)
  To: Pieter Wuille; +Cc: Bitcoin Dev

>> The idea is to simplify implementation. Existing software can be used
>> as is to sign and validate PoPs. But I do agree that it would be a
>> cleaner specification if we would make the PoP invalid as a
>> transaction. I'm open to changes here. I do like the idea to prepend a
>> constant string. But that would require changes in transaction signing
>> and validation code, wouldn't it?
>
>
> Yes, of course. An alternative is adding a 21M BTC output at the end, or
> bitflipping the txin prevout hashes, or another reversible transformation on
> the transaction data that is guaranteed to invalidate it.

If we do decide to make Pops invalid as transactions, there are a lot
of ways to do that. I guess the main question is if we should make
Pops invalid as transactions or not. So far I prefer to keep them
valid for the above reason.

>
> I think that the risk of asking people to sign something that is not an
> actual transaction, but could be used as one, is very scary.
>

I would feel comfortable doing it. It's just a matter of trusting your
wallet, which you already do with your ordinary transactions.

>>
>> > Also, I would call it "proof of transaction intent", as it's a
>> > commitment to
>> > a transaction and proof of its validity, but not a proof that an actual
>> > transaction took place, nor a means to prevent it from being double
>> > spent.
>>
>>
>> Naming is hard. I think a simpler name that explains what its main
>> purpose is (prove that you paid for something) is better than a name
>> that exactly tries to explain what it is.
>
>
> "Proof of Payment" indeed does make me think it's something that proves you
> paid. But as described, that is not what a PoP does. It proves the ability
> to create a particular transaction, and committing to it. There is no actual
> payment involved (plus, payment makes me think you're talking about BIP70
> payments, not simple Bitcoin transactions).
>
>>
>> "Proof of transaction
>> intent" does not help me understand what this is about. But I would
>> like to see more name suggestions. The name does not prevent people
>> from using it for other purposes, ie internet over telephone network.
>
>
> I don't understand why something like "Proof of Transaction Intent" would be
> incompatible with internet over telephone network either...
>

No, I meant that it's ok to call it Proof of Payment even though
people may use it for other stuff.

> --
> Pieter
>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 15:32     ` Peter Todd
@ 2015-06-06 16:35       ` Kalle Rosenbaum
  0 siblings, 0 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-06 16:35 UTC (permalink / raw)
  To: Peter Todd; +Cc: Bitcoin Dev

2015-06-06 17:32 GMT+02:00 Peter Todd <pete@petertodd.org>:
> On Sat, Jun 06, 2015 at 05:23:48PM +0200, Pieter Wuille wrote:
>> On Sat, Jun 6, 2015 at 5:18 PM, Luke Dashjr <luke@dashjr.org> wrote:
>>
>> > I also agree with Pieter, that this should *not* be so cleanly compatible
>> > with Bitcoin transactions. If you wish to share code, perhaps using an
>> > invalid opcode rather than OP_RETURN would be appropriate.
>>
>>
>> Using an invalid opcode would merely send funds into the void. It wouldn't
>> invalidate the transaction.
>
> Just set nLockTime to 500000000-1 and nSequence appropriately to make
> the transaction impossible to mine for the next 9500 years.

Actually, I suggested that on this list on april 27, but shortly after
rejected my own idea:

#######################
"Or a really high lock_time, but it would not make it invalid, just delayed."

Ok, this was a bad idea, since nodes would have to keep it in memory.
Please disregard that idea...
########################

Now I think I rejected it on based on a misunderstanding. Nodes will
not put them in their mempool unless it's value is near in time,
right? From the 0.9.0 release notes: "Accept nLockTime transactions
that finalize in the next block".

In that case this is a really nice option.

>
> Though I agree that this whole idea seems a bit dubious to me.
>
> --
> 'peter'[:-1]@petertodd.org
> 00000000000000000000dd919214b66444dcebb4aa0214c1ab7c8b3b633be71f
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 16:10     ` Tom Harding
@ 2015-06-06 17:00       ` Kalle Rosenbaum
  2015-06-06 21:25         ` Kalle Rosenbaum
  0 siblings, 1 reply; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-06 17:00 UTC (permalink / raw)
  To: Tom Harding; +Cc: Bitcoin Dev

2015-06-06 18:10 GMT+02:00 Tom Harding <tomh@thinlink.com>:
> On Jun 6, 2015 8:05 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>
>> I'm open to changes here.
>
> I suggest:
>
> - Don't include any real outputs.   They are redundant because the txid is
> already referenced.

with the nLocktime solution, the copied outputs are not needed.

>
> - Start the proof script, which should be invalid, with a magic constant and
> include space for future expansion.  This makes PoP's easy to identify and
> extend.

I did remore the constant (a "PoP" literal ascii encoded string)
because it didn't add much. The recipient will expect a pop, so it
will simply treat it as one. I did add a 2 byte version field to make
it extendable.

>
> - "Proof of Potential"

Noted :-)

Thank you
/Kalle



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 17:00       ` Kalle Rosenbaum
@ 2015-06-06 21:25         ` Kalle Rosenbaum
  2015-06-06 22:01           ` Luke Dashjr
  2015-06-15  9:21           ` Kalle Rosenbaum
  0 siblings, 2 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-06 21:25 UTC (permalink / raw)
  To: Bitcoin Dev

Thank you all for the feedback.

I will change the data structure as follows:

* There will be only one output, the "pop output", and no outputs from
T will be copied to the PoP.
* The pop output will have value 0.
* The sequence number of all inputs of the PoP will be set to 0. I
chose to set it to 0 for all inputs for simplicity.
* The lock_time of the PoP is always set to 499999999.

Any comments on this?

/Kalle

2015-06-06 19:00 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
> 2015-06-06 18:10 GMT+02:00 Tom Harding <tomh@thinlink.com>:
>> On Jun 6, 2015 8:05 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>>
>>> I'm open to changes here.
>>
>> I suggest:
>>
>> - Don't include any real outputs.   They are redundant because the txid is
>> already referenced.
>
> with the nLocktime solution, the copied outputs are not needed.
>
>>
>> - Start the proof script, which should be invalid, with a magic constant and
>> include space for future expansion.  This makes PoP's easy to identify and
>> extend.
>
> I did remore the constant (a "PoP" literal ascii encoded string)
> because it didn't add much. The recipient will expect a pop, so it
> will simply treat it as one. I did add a 2 byte version field to make
> it extendable.
>
>>
>> - "Proof of Potential"
>
> Noted :-)
>
> Thank you
> /Kalle



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 21:25         ` Kalle Rosenbaum
@ 2015-06-06 22:01           ` Luke Dashjr
  2015-06-15  9:21           ` Kalle Rosenbaum
  1 sibling, 0 replies; 32+ messages in thread
From: Luke Dashjr @ 2015-06-06 22:01 UTC (permalink / raw)
  To: bitcoin-development

On Saturday, June 06, 2015 9:25:02 PM Kalle Rosenbaum wrote:
> * The pop output will have value 0.

Why not have it be -1 to make it completely invalid as a transaction?

Luke



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-06 21:25         ` Kalle Rosenbaum
  2015-06-06 22:01           ` Luke Dashjr
@ 2015-06-15  9:21           ` Kalle Rosenbaum
       [not found]             ` <CAPg+sBiWykR6RaHhbyYQbL=A5t1TmHgEmS_sC7jj9d3SUTMO9g@mail.gmail.com>
  1 sibling, 1 reply; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-15  9:21 UTC (permalink / raw)
  To: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 12416 bytes --]

Hi all!

I have made the discussed changes and updated my implementation (
https://github.com/kallerosenbaum/poppoc) accordingly. These are the
changes:

* There is now only one output, the "pop output", of value 0.
* The sequence number of all inputs of the PoP must be set to 0. I
chose to set it to 0 for all inputs for simplicity.
* The lock_time of the PoP must be set to 499999999 (max block height lock
time).

The comments so far has been mainly positive or neutral. Are there any
major objections against any of the two proposals? If not, I will ask
Gregory Maxwell to assign them BIP numbers.

The two BIP proposals can be found at
https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP and
https://github.com/kallerosenbaum/poppoc/wiki/btcpop-scheme-BIP. The source
for the Proof of Payment BIP proposal is also in-lined below.

A number of alternative names have been proposed:

* Proof of Potential
* Proof of Control
* Proof of Signature
* Signatory Proof
* Popo: Proof of payment origin
* Pots: Proof of transaction signer
* proof of transaction intent
* Declaration of intent
* Asset-access-and-action-affirmation, AAaAA, or A5
* VeriBit
* CertiBTC
* VBit
* PayID

Given this list, I still think "Proof of Payment" is the most descriptive
to non-technical people.

Regards,
Kalle


#################################################
<pre>
  BIP: <BIP number>
  Title: Proof of Payment
  Author: Kalle Rosenbaum <kalle@rosenbaum.se>
  Status: Draft
  Type: Standards Track
  Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
</pre>

== Abstract ==

This BIP describes how a wallet can prove to a server that it has the
ability to sign a certain transaction.

== Motivation ==

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.

== Rationale ==

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 an input script type is P2SH, any satisfying script should do, just as
if it was 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 defeat the purpose of a multisig address.

== Specification ==

=== Data structure ===

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 as T and in the same order as in T, but with each sequence
number set to 0. There is exactly one output, here called the pop output,
with value 0. The pop output must have the following format:

 OP_RETURN <version> <txid> <nonce>

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

The lock_time of the PoP must be set to 499999999 to prevent the PoP from
being included in a block, should it appear on the bitcoin p2p network.
This is also the reason for setting the sequence numbers to 0, since
sequence number of ffffffff would make lock_time ineffective. This
specification demands that all input sequence numbers are 0, not just one
of them, which would be sufficient to make lock_time effective. This is for
simplicity reasons.

An illustration of the PoP data structure and its original payment is shown
below.

<pre>
  T
 +------------------------------------------------+
 |inputs                | outputs                 |
 |       Value,Sequence | Value,Script            |
 +------------------------------------------------+
 |input0 1,ffffffff     | 0,pay to A              |
 |input1 3,ffffffff     | 2,OP_RETURN <some data> |
 |input2 4,ffffffff     | 1,pay to B              |
 |                      | 4,pay to C              |
 +------------------------------------------------+

  PoP(T)
 +-------------------------------------------------------------+
 | inputs               | outputs                              |
 |       Value,Sequence | Value,Script                         |
 +-------------------------------------------------------------+
 |input0 1,00000000     | 0,OP_RETURN <version> <txid> <nonce> |
 |input1 3,00000000     |                                      |
 |input2 4,00000000     |                                      |
 +-------------------------------------------------------------+
 | lock_time=499999999                                         |
 +-------------------------------------------------------------+
</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 useless since the server will
generate a new nonce for every PoP request.

=== Process ===

# 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 URI
# 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 “valid” or
“invalid”.
# 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.

=== Validating a PoP ===

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 that lock_time is 499999999.
# Check that there is exactly one output. This output must have value 0 and
conform to the OP_RETURN output format outlined above.
# Check that the nonce is the same as the one requested.
# Check that the inputs of the PoP are exactly the same as in transaction
T, except that the sequence numbers must all be 0. The ordering of the
inputs must also be the same as in T.
# Run the scripts of all the inputs. All scipts must return true.
# Check that the txid in the PoP output is the transaction you actually
want proof for. If you don’t know exactly what transaction you want proof
for, check that the transaction actually pays for the product/service you
deliver.
# Return "valid".

== Security considerations ==

* Someone can intercept the PoP-request and change any parameter in it.
These can be mitigated by using secure connections. For example:
** Pop destination - Stealing your PoP.
** label - Trick you to sign an unintended pop or set a label that your
wallet doesn't have any record for, resulting in a broken service. Always
check the PoP before signing.
** nonce - Your pop will not validate on server.
* Someone can steal a PoP, for example by tampering with the PoP request,
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 for a payment than the client's wallet. In that case the wallet will not
be able to prove the transaction to 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.

== Reference implementation ==

[https://github.com/kallerosenbaum/poppoc poppoc on GitHub]

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

== References ==

[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]]

#########################################################

2015-06-06 23:25 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
> Thank you all for the feedback.
>
> I will change the data structure as follows:
>
> * There will be only one output, the "pop output", and no outputs from
> T will be copied to the PoP.
> * The pop output will have value 0.
> * The sequence number of all inputs of the PoP will be set to 0. I
> chose to set it to 0 for all inputs for simplicity.
> * The lock_time of the PoP is always set to 499999999.
>
> Any comments on this?
>
> /Kalle
>
> 2015-06-06 19:00 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
>> 2015-06-06 18:10 GMT+02:00 Tom Harding <tomh@thinlink.com>:
>>> On Jun 6, 2015 8:05 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>>>
>>>> I'm open to changes here.
>>>
>>> I suggest:
>>>
>>> - Don't include any real outputs.   They are redundant because the txid
is
>>> already referenced.
>>
>> with the nLocktime solution, the copied outputs are not needed.
>>
>>>
>>> - Start the proof script, which should be invalid, with a magic
constant and
>>> include space for future expansion.  This makes PoP's easy to identify
and
>>> extend.
>>
>> I did remore the constant (a "PoP" literal ascii encoded string)
>> because it didn't add much. The recipient will expect a pop, so it
>> will simply treat it as one. I did add a 2 byte version field to make
>> it extendable.
>>
>>>
>>> - "Proof of Potential"
>>
>> Noted :-)
>>
>> Thank you
>> /Kalle

[-- Attachment #2: Type: text/html, Size: 14719 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
       [not found]               ` <CAPswA9zycU0pwZKaHU9J3Tvg=ovLJ8TZ9OH6ebTPONaRaiOE8g@mail.gmail.com>
@ 2015-06-15 10:00                 ` Pieter Wuille
  2015-06-15 11:59                   ` Kalle Rosenbaum
  2015-06-16  5:26                   ` Tom Harding
  0 siblings, 2 replies; 32+ messages in thread
From: Pieter Wuille @ 2015-06-15 10:00 UTC (permalink / raw)
  To: Kalle Rosenbaum, Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 15842 bytes --]

I did misunderstand that. That changes things significantly.

However, having paid is not the same as having had access to the input
coins. What about shared wallets or coinjoin?

Also, if I understand correctly, there is no commitment to anything you're
trying to say about the sender? So once I obtain a proof-of-payment from
you about something you paid, I can go claim that it's mine?

Why does anyone care who paid? This is like walking into a coffeshop,
noticing I don't have money with me, let me friend pay for me, and then
have the shop insist that I can't drink it because I'm not the buyer.

Track payments, don't try to assign identities to payers.
On Jun 15, 2015 11:35 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:

> Hi Pieter!
>
> It is intended to be a proof that you *have paid* for something. Not
> that you have the intent to pay for something. You cannot use PoP
> without a transaction to prove.
>
> So, yes, it's just a proof of access to certain coins that you no longer
> have.
>
> Maybe I don't understand you correctly?
>
> /Kalle
>
> 2015-06-15 11:27 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> > Now that you have removed the outputs, I don't think it's even a intent
> of
> > payment, but just a proof of access to certain coins.
> >
> > On Jun 15, 2015 11:24 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
> >>
> >> Hi all!
> >>
> >> I have made the discussed changes and updated my implementation
> >> (https://github.com/kallerosenbaum/poppoc) accordingly. These are the
> >> changes:
> >>
> >> * There is now only one output, the "pop output", of value 0.
> >> * The sequence number of all inputs of the PoP must be set to 0. I
> >> chose to set it to 0 for all inputs for simplicity.
> >> * The lock_time of the PoP must be set to 499999999 (max block height
> lock
> >> time).
> >>
> >> The comments so far has been mainly positive or neutral. Are there any
> >> major objections against any of the two proposals? If not, I will ask
> >> Gregory Maxwell to assign them BIP numbers.
> >>
> >> The two BIP proposals can be found at
> >> https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP and
> >> https://github.com/kallerosenbaum/poppoc/wiki/btcpop-scheme-BIP. The
> source
> >> for the Proof of Payment BIP proposal is also in-lined below.
> >>
> >> A number of alternative names have been proposed:
> >>
> >> * Proof of Potential
> >> * Proof of Control
> >> * Proof of Signature
> >> * Signatory Proof
> >> * Popo: Proof of payment origin
> >> * Pots: Proof of transaction signer
> >> * proof of transaction intent
> >> * Declaration of intent
> >> * Asset-access-and-action-affirmation, AAaAA, or A5
> >> * VeriBit
> >> * CertiBTC
> >> * VBit
> >> * PayID
> >>
> >> Given this list, I still think "Proof of Payment" is the most
> descriptive
> >> to non-technical people.
> >>
> >> Regards,
> >> Kalle
> >>
> >>
> >> #################################################
> >> <pre>
> >>   BIP: <BIP number>
> >>   Title: Proof of Payment
> >>   Author: Kalle Rosenbaum <kalle@rosenbaum.se>
> >>   Status: Draft
> >>   Type: Standards Track
> >>   Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
> >> </pre>
> >>
> >> == Abstract ==
> >>
> >> This BIP describes how a wallet can prove to a server that it has the
> >> ability to sign a certain transaction.
> >>
> >> == Motivation ==
> >>
> >> 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.
> >>
> >> == Rationale ==
> >>
> >> 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 an input script type is P2SH, any satisfying script should do, just
> as
> >> if it was 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 defeat the purpose of a multisig address.
> >>
> >> == Specification ==
> >>
> >> === Data structure ===
> >>
> >> 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 as T and in the same order as in T, but with each
> sequence
> >> number set to 0. There is exactly one output, here called the pop
> output,
> >> with value 0. The pop output must have the following format:
> >>
> >>  OP_RETURN <version> <txid> <nonce>
> >>
> >> {|
> >> ! Field        !! Size [B] !! Description
> >> |-
> >> | &lt;version> || 2        || Version, little endian, currently 0x01
> 0x00
> >> |-
> >> | &lt;txid>    || 32       || The transaction to prove
> >> |-
> >> | &lt;nonce>   || 6        || Random data
> >> |}
> >>
> >> The lock_time of the PoP must be set to 499999999 to prevent the PoP
> from
> >> being included in a block, should it appear on the bitcoin p2p network.
> This
> >> is also the reason for setting the sequence numbers to 0, since sequence
> >> number of ffffffff would make lock_time ineffective. This specification
> >> demands that all input sequence numbers are 0, not just one of them,
> which
> >> would be sufficient to make lock_time effective. This is for simplicity
> >> reasons.
> >>
> >> An illustration of the PoP data structure and its original payment is
> >> shown below.
> >>
> >> <pre>
> >>   T
> >>  +------------------------------------------------+
> >>  |inputs                | outputs                 |
> >>  |       Value,Sequence | Value,Script            |
> >>  +------------------------------------------------+
> >>  |input0 1,ffffffff     | 0,pay to A              |
> >>  |input1 3,ffffffff     | 2,OP_RETURN <some data> |
> >>  |input2 4,ffffffff     | 1,pay to B              |
> >>  |                      | 4,pay to C              |
> >>  +------------------------------------------------+
> >>
> >>   PoP(T)
> >>  +-------------------------------------------------------------+
> >>  | inputs               | outputs                              |
> >>  |       Value,Sequence | Value,Script                         |
> >>  +-------------------------------------------------------------+
> >>  |input0 1,00000000     | 0,OP_RETURN <version> <txid> <nonce> |
> >>  |input1 3,00000000     |                                      |
> >>  |input2 4,00000000     |                                      |
> >>  +-------------------------------------------------------------+
> >>  | lock_time=499999999                                         |
> >>  +-------------------------------------------------------------+
> >> </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 useless since the server
> will
> >> generate a new nonce for every PoP request.
> >>
> >> === Process ===
> >>
> >> # 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 URI
> >> # 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 “valid” or
> >> “invalid”.
> >> # 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.
> >>
> >> === Validating a PoP ===
> >>
> >> 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 that lock_time is 499999999.
> >> # Check that there is exactly one output. This output must have value 0
> >> and conform to the OP_RETURN output format outlined above.
> >> # Check that the nonce is the same as the one requested.
> >> # Check that the inputs of the PoP are exactly the same as in
> transaction
> >> T, except that the sequence numbers must all be 0. The ordering of the
> >> inputs must also be the same as in T.
> >> # Run the scripts of all the inputs. All scipts must return true.
> >> # Check that the txid in the PoP output is the transaction you actually
> >> want proof for. If you don’t know exactly what transaction you want
> proof
> >> for, check that the transaction actually pays for the product/service
> you
> >> deliver.
> >> # Return "valid".
> >>
> >> == Security considerations ==
> >>
> >> * Someone can intercept the PoP-request and change any parameter in it.
> >> These can be mitigated by using secure connections. For example:
> >> ** Pop destination - Stealing your PoP.
> >> ** label - Trick you to sign an unintended pop or set a label that your
> >> wallet doesn't have any record for, resulting in a broken service.
> Always
> >> check the PoP before signing.
> >> ** nonce - Your pop will not validate on server.
> >> * Someone can steal a PoP, for example by tampering with the PoP
> request,
> >> 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 for a payment than the client's wallet. In that case the
> >> wallet will not be able to prove the transaction to 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.
> >>
> >> == Reference implementation ==
> >>
> >> [https://github.com/kallerosenbaum/poppoc poppoc on GitHub]
> >>
> >> [https://github.com/kallerosenbaum/wallet Mycelium fork on GitHub]
> >>
> >> == References ==
> >>
> >> [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]]
> >>
> >> #########################################################
> >>
> >> 2015-06-06 23:25 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
> >> > Thank you all for the feedback.
> >> >
> >> > I will change the data structure as follows:
> >> >
> >> > * There will be only one output, the "pop output", and no outputs from
> >> > T will be copied to the PoP.
> >> > * The pop output will have value 0.
> >> > * The sequence number of all inputs of the PoP will be set to 0. I
> >> > chose to set it to 0 for all inputs for simplicity.
> >> > * The lock_time of the PoP is always set to 499999999.
> >> >
> >> > Any comments on this?
> >> >
> >> > /Kalle
> >> >
> >> > 2015-06-06 19:00 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
> >> >> 2015-06-06 18:10 GMT+02:00 Tom Harding <tomh@thinlink.com>:
> >> >>> On Jun 6, 2015 8:05 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se>
> wrote:
> >> >>>
> >> >>>> I'm open to changes here.
> >> >>>
> >> >>> I suggest:
> >> >>>
> >> >>> - Don't include any real outputs.   They are redundant because the
> >> >>> txid is
> >> >>> already referenced.
> >> >>
> >> >> with the nLocktime solution, the copied outputs are not needed.
> >> >>
> >> >>>
> >> >>> - Start the proof script, which should be invalid, with a magic
> >> >>> constant and
> >> >>> include space for future expansion.  This makes PoP's easy to
> identify
> >> >>> and
> >> >>> extend.
> >> >>
> >> >> I did remore the constant (a "PoP" literal ascii encoded string)
> >> >> because it didn't add much. The recipient will expect a pop, so it
> >> >> will simply treat it as one. I did add a 2 byte version field to make
> >> >> it extendable.
> >> >>
> >> >>>
> >> >>> - "Proof of Potential"
> >> >>
> >> >> Noted :-)
> >> >>
> >> >> Thank you
> >> >> /Kalle
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >>
> >> _______________________________________________
> >> Bitcoin-development mailing list
> >> Bitcoin-development@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
> >>
> >
>

[-- Attachment #2: Type: text/html, Size: 20723 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-15 10:00                 ` Pieter Wuille
@ 2015-06-15 11:59                   ` Kalle Rosenbaum
  2015-06-16 14:31                     ` Pieter Wuille
  2015-06-16  5:26                   ` Tom Harding
  1 sibling, 1 reply; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-15 11:59 UTC (permalink / raw)
  To: Pieter Wuille; +Cc: Bitcoin Dev

2015-06-15 12:00 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> I did misunderstand that. That changes things significantly.
>
> However, having paid is not the same as having had access to the input
> coins. What about shared wallets or coinjoin?

Wallets will have the same ability to make PoPs as they have in making
payments, see my motivation and rationale sections. CoinJoin is not
compatible with PoP, Luke-Jr brought that up a week ago:

"This appears to be incompatible with CoinJoin at least. Maybe there's some
clean way to avoid that by using
https://github.com/Blockstream/contracthashtool ?"

I'm not sure if we will be able to support PoP with CoinJoin. Maybe
someone with more insight into CoinJoin have some input?

>
> Also, if I understand correctly, there is no commitment to anything you're
> trying to say about the sender? So once I obtain a proof-of-payment from you
> about something you paid, I can go claim that it's mine?

I don't understand this. The pop includes a nonce randomly generated
by the server. If you're very lucky, 1/(2^48) per try, you can reuse a
pop.

>
> Why does anyone care who paid? This is like walking into a coffeshop,
> noticing I don't have money with me, let me friend pay for me, and then have
> the shop insist that I can't drink it because I'm not the buyer.

If you pay as you use the service (ie pay for coffee upfront), there's
no need for PoP. Please see the Motivation section. But you are right
that you must have the wallet(s) that paid at hand when you issue a
PoP.

>
> Track payments, don't try to assign identities to payers.

Please elaborate, I don't understand what you mean here.

Regards,
Kalle

>
> On Jun 15, 2015 11:35 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>>
>> Hi Pieter!
>>
>> It is intended to be a proof that you *have paid* for something. Not
>> that you have the intent to pay for something. You cannot use PoP
>> without a transaction to prove.
>>
>> So, yes, it's just a proof of access to certain coins that you no longer
>> have.
>>
>> Maybe I don't understand you correctly?
>>
>> /Kalle
>>
>> 2015-06-15 11:27 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
>> > Now that you have removed the outputs, I don't think it's even a intent
>> > of
>> > payment, but just a proof of access to certain coins.
>> >
>> > On Jun 15, 2015 11:24 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>> >>
>> >> Hi all!
>> >>
>> >> I have made the discussed changes and updated my implementation
>> >> (https://github.com/kallerosenbaum/poppoc) accordingly. These are the
>> >> changes:
>> >>
>> >> * There is now only one output, the "pop output", of value 0.
>> >> * The sequence number of all inputs of the PoP must be set to 0. I
>> >> chose to set it to 0 for all inputs for simplicity.
>> >> * The lock_time of the PoP must be set to 499999999 (max block height
>> >> lock
>> >> time).
>> >>
>> >> The comments so far has been mainly positive or neutral. Are there any
>> >> major objections against any of the two proposals? If not, I will ask
>> >> Gregory Maxwell to assign them BIP numbers.
>> >>
>> >> The two BIP proposals can be found at
>> >> https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP and
>> >> https://github.com/kallerosenbaum/poppoc/wiki/btcpop-scheme-BIP. The
>> >> source
>> >> for the Proof of Payment BIP proposal is also in-lined below.
>> >>
>> >> A number of alternative names have been proposed:
>> >>
>> >> * Proof of Potential
>> >> * Proof of Control
>> >> * Proof of Signature
>> >> * Signatory Proof
>> >> * Popo: Proof of payment origin
>> >> * Pots: Proof of transaction signer
>> >> * proof of transaction intent
>> >> * Declaration of intent
>> >> * Asset-access-and-action-affirmation, AAaAA, or A5
>> >> * VeriBit
>> >> * CertiBTC
>> >> * VBit
>> >> * PayID
>> >>
>> >> Given this list, I still think "Proof of Payment" is the most
>> >> descriptive
>> >> to non-technical people.
>> >>
>> >> Regards,
>> >> Kalle
>> >>
>> >>
>> >> #################################################
>> >> <pre>
>> >>   BIP: <BIP number>
>> >>   Title: Proof of Payment
>> >>   Author: Kalle Rosenbaum <kalle@rosenbaum.se>
>> >>   Status: Draft
>> >>   Type: Standards Track
>> >>   Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
>> >> </pre>
>> >>
>> >> == Abstract ==
>> >>
>> >> This BIP describes how a wallet can prove to a server that it has the
>> >> ability to sign a certain transaction.
>> >>
>> >> == Motivation ==
>> >>
>> >> 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.
>> >>
>> >> == Rationale ==
>> >>
>> >> 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 an input script type is P2SH, any satisfying script should do, just
>> >> as
>> >> if it was 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 defeat the purpose of a multisig address.
>> >>
>> >> == Specification ==
>> >>
>> >> === Data structure ===
>> >>
>> >> 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 as T and in the same order as in T, but with each
>> >> sequence
>> >> number set to 0. There is exactly one output, here called the pop
>> >> output,
>> >> with value 0. The pop output must have the following format:
>> >>
>> >>  OP_RETURN <version> <txid> <nonce>
>> >>
>> >> {|
>> >> ! Field        !! Size [B] !! Description
>> >> |-
>> >> | &lt;version> || 2        || Version, little endian, currently 0x01
>> >> 0x00
>> >> |-
>> >> | &lt;txid>    || 32       || The transaction to prove
>> >> |-
>> >> | &lt;nonce>   || 6        || Random data
>> >> |}
>> >>
>> >> The lock_time of the PoP must be set to 499999999 to prevent the PoP
>> >> from
>> >> being included in a block, should it appear on the bitcoin p2p network.
>> >> This
>> >> is also the reason for setting the sequence numbers to 0, since
>> >> sequence
>> >> number of ffffffff would make lock_time ineffective. This specification
>> >> demands that all input sequence numbers are 0, not just one of them,
>> >> which
>> >> would be sufficient to make lock_time effective. This is for simplicity
>> >> reasons.
>> >>
>> >> An illustration of the PoP data structure and its original payment is
>> >> shown below.
>> >>
>> >> <pre>
>> >>   T
>> >>  +------------------------------------------------+
>> >>  |inputs                | outputs                 |
>> >>  |       Value,Sequence | Value,Script            |
>> >>  +------------------------------------------------+
>> >>  |input0 1,ffffffff     | 0,pay to A              |
>> >>  |input1 3,ffffffff     | 2,OP_RETURN <some data> |
>> >>  |input2 4,ffffffff     | 1,pay to B              |
>> >>  |                      | 4,pay to C              |
>> >>  +------------------------------------------------+
>> >>
>> >>   PoP(T)
>> >>  +-------------------------------------------------------------+
>> >>  | inputs               | outputs                              |
>> >>  |       Value,Sequence | Value,Script                         |
>> >>  +-------------------------------------------------------------+
>> >>  |input0 1,00000000     | 0,OP_RETURN <version> <txid> <nonce> |
>> >>  |input1 3,00000000     |                                      |
>> >>  |input2 4,00000000     |                                      |
>> >>  +-------------------------------------------------------------+
>> >>  | lock_time=499999999                                         |
>> >>  +-------------------------------------------------------------+
>> >> </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 useless since the server
>> >> will
>> >> generate a new nonce for every PoP request.
>> >>
>> >> === Process ===
>> >>
>> >> # 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 URI
>> >> # 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 “valid”
>> >> or
>> >> “invalid”.
>> >> # 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.
>> >>
>> >> === Validating a PoP ===
>> >>
>> >> 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 that lock_time is 499999999.
>> >> # Check that there is exactly one output. This output must have value 0
>> >> and conform to the OP_RETURN output format outlined above.
>> >> # Check that the nonce is the same as the one requested.
>> >> # Check that the inputs of the PoP are exactly the same as in
>> >> transaction
>> >> T, except that the sequence numbers must all be 0. The ordering of the
>> >> inputs must also be the same as in T.
>> >> # Run the scripts of all the inputs. All scipts must return true.
>> >> # Check that the txid in the PoP output is the transaction you actually
>> >> want proof for. If you don’t know exactly what transaction you want
>> >> proof
>> >> for, check that the transaction actually pays for the product/service
>> >> you
>> >> deliver.
>> >> # Return "valid".
>> >>
>> >> == Security considerations ==
>> >>
>> >> * Someone can intercept the PoP-request and change any parameter in it.
>> >> These can be mitigated by using secure connections. For example:
>> >> ** Pop destination - Stealing your PoP.
>> >> ** label - Trick you to sign an unintended pop or set a label that your
>> >> wallet doesn't have any record for, resulting in a broken service.
>> >> Always
>> >> check the PoP before signing.
>> >> ** nonce - Your pop will not validate on server.
>> >> * Someone can steal a PoP, for example by tampering with the PoP
>> >> request,
>> >> 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 for a payment than the client's wallet. In that case the
>> >> wallet will not be able to prove the transaction to 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.
>> >>
>> >> == Reference implementation ==
>> >>
>> >> [https://github.com/kallerosenbaum/poppoc poppoc on GitHub]
>> >>
>> >> [https://github.com/kallerosenbaum/wallet Mycelium fork on GitHub]
>> >>
>> >> == References ==
>> >>
>> >> [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]]
>> >>
>> >> #########################################################
>> >>
>> >> 2015-06-06 23:25 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
>> >> > Thank you all for the feedback.
>> >> >
>> >> > I will change the data structure as follows:
>> >> >
>> >> > * There will be only one output, the "pop output", and no outputs
>> >> > from
>> >> > T will be copied to the PoP.
>> >> > * The pop output will have value 0.
>> >> > * The sequence number of all inputs of the PoP will be set to 0. I
>> >> > chose to set it to 0 for all inputs for simplicity.
>> >> > * The lock_time of the PoP is always set to 499999999.
>> >> >
>> >> > Any comments on this?
>> >> >
>> >> > /Kalle
>> >> >
>> >> > 2015-06-06 19:00 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
>> >> >> 2015-06-06 18:10 GMT+02:00 Tom Harding <tomh@thinlink.com>:
>> >> >>> On Jun 6, 2015 8:05 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se>
>> >> >>> wrote:
>> >> >>>
>> >> >>>> I'm open to changes here.
>> >> >>>
>> >> >>> I suggest:
>> >> >>>
>> >> >>> - Don't include any real outputs.   They are redundant because the
>> >> >>> txid is
>> >> >>> already referenced.
>> >> >>
>> >> >> with the nLocktime solution, the copied outputs are not needed.
>> >> >>
>> >> >>>
>> >> >>> - Start the proof script, which should be invalid, with a magic
>> >> >>> constant and
>> >> >>> include space for future expansion.  This makes PoP's easy to
>> >> >>> identify
>> >> >>> and
>> >> >>> extend.
>> >> >>
>> >> >> I did remore the constant (a "PoP" literal ascii encoded string)
>> >> >> because it didn't add much. The recipient will expect a pop, so it
>> >> >> will simply treat it as one. I did add a 2 byte version field to
>> >> >> make
>> >> >> it extendable.
>> >> >>
>> >> >>>
>> >> >>> - "Proof of Potential"
>> >> >>
>> >> >> Noted :-)
>> >> >>
>> >> >> Thank you
>> >> >> /Kalle
>> >>
>> >>
>> >>
>> >> ------------------------------------------------------------------------------
>> >>
>> >> _______________________________________________
>> >> Bitcoin-development mailing list
>> >> Bitcoin-development@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>> >>
>> >



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-15 10:00                 ` Pieter Wuille
  2015-06-15 11:59                   ` Kalle Rosenbaum
@ 2015-06-16  5:26                   ` Tom Harding
  2015-06-16 12:12                     ` Kalle Rosenbaum
  1 sibling, 1 reply; 32+ messages in thread
From: Tom Harding @ 2015-06-16  5:26 UTC (permalink / raw)
  To: bitcoin-development, Pieter Wuille

[-- Attachment #1: Type: text/plain, Size: 19466 bytes --]


Shared wallets were discussed earlier as a feature.  If you pay a for
dry cleaning with a shared wallet, a different 1-of-N signer can pick up
the clothes with no physical transfer of a claim check, by proving the
money that paid for the cleaning was his.

Many kinds of vouchers can be eliminated, because the money itself can
be vouched for, wirelessly, with ECDSA security.  A PoP would be much
more difficult to forge as a valet claim check, to steal a car.

Something like your coffee gift example was also mentioned.  The buyer
could export the private keys to your (the beneficiary's) wallet after
the purchase, by using an 'export gift claim check' function on the
spent transaction.  Then you pick up the coffee (car, concert seats...)
just as if you had paid.

Kalle goes to some trouble to describe how merchants need to ensure that
they only accept a PoP provided as a response to their challenge.

Coinjoin or simulfunding transactions wouldn't be PoP-able (nor should
they be) since no one signer has all the private keys.



On 6/15/2015 3:00 AM, Pieter Wuille wrote:
>
> I did misunderstand that. That changes things significantly.
>
> However, having paid is not the same as having had access to the input
> coins. What about shared wallets or coinjoin?
>
> Also, if I understand correctly, there is no commitment to anything
> you're trying to say about the sender? So once I obtain a
> proof-of-payment from you about something you paid, I can go claim
> that it's mine?
>
> Why does anyone care who paid? This is like walking into a coffeshop,
> noticing I don't have money with me, let me friend pay for me, and
> then have the shop insist that I can't drink it because I'm not the buyer.
>
> Track payments, don't try to assign identities to payers.
>
> On Jun 15, 2015 11:35 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se
> <mailto:kalle@rosenbaum.se>> wrote:
>
>     Hi Pieter!
>
>     It is intended to be a proof that you *have paid* for something. Not
>     that you have the intent to pay for something. You cannot use PoP
>     without a transaction to prove.
>
>     So, yes, it's just a proof of access to certain coins that you no
>     longer have.
>
>     Maybe I don't understand you correctly?
>
>     /Kalle
>
>     2015-06-15 11:27 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com
>     <mailto:pieter.wuille@gmail.com>>:
>     > Now that you have removed the outputs, I don't think it's even a
>     intent of
>     > payment, but just a proof of access to certain coins.
>     >
>     > On Jun 15, 2015 11:24 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se
>     <mailto:kalle@rosenbaum.se>> wrote:
>     >>
>     >> Hi all!
>     >>
>     >> I have made the discussed changes and updated my implementation
>     >> (https://github.com/kallerosenbaum/poppoc) accordingly. These
>     are the
>     >> changes:
>     >>
>     >> * There is now only one output, the "pop output", of value 0.
>     >> * The sequence number of all inputs of the PoP must be set to 0. I
>     >> chose to set it to 0 for all inputs for simplicity.
>     >> * The lock_time of the PoP must be set to 499999999 (max block
>     height lock
>     >> time).
>     >>
>     >> The comments so far has been mainly positive or neutral. Are
>     there any
>     >> major objections against any of the two proposals? If not, I
>     will ask
>     >> Gregory Maxwell to assign them BIP numbers.
>     >>
>     >> The two BIP proposals can be found at
>     >>
>     https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP and
>     >>
>     https://github.com/kallerosenbaum/poppoc/wiki/btcpop-scheme-BIP.
>     The source
>     >> for the Proof of Payment BIP proposal is also in-lined below.
>     >>
>     >> A number of alternative names have been proposed:
>     >>
>     >> * Proof of Potential
>     >> * Proof of Control
>     >> * Proof of Signature
>     >> * Signatory Proof
>     >> * Popo: Proof of payment origin
>     >> * Pots: Proof of transaction signer
>     >> * proof of transaction intent
>     >> * Declaration of intent
>     >> * Asset-access-and-action-affirmation, AAaAA, or A5
>     >> * VeriBit
>     >> * CertiBTC
>     >> * VBit
>     >> * PayID
>     >>
>     >> Given this list, I still think "Proof of Payment" is the most
>     descriptive
>     >> to non-technical people.
>     >>
>     >> Regards,
>     >> Kalle
>     >>
>     >>
>     >> #################################################
>     >> <pre>
>     >>   BIP: <BIP number>
>     >>   Title: Proof of Payment
>     >>   Author: Kalle Rosenbaum <kalle@rosenbaum.se
>     <mailto:kalle@rosenbaum.se>>
>     >>   Status: Draft
>     >>   Type: Standards Track
>     >>   Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
>     >> </pre>
>     >>
>     >> == Abstract ==
>     >>
>     >> This BIP describes how a wallet can prove to a server that it
>     has the
>     >> ability to sign a certain transaction.
>     >>
>     >> == Motivation ==
>     >>
>     >> 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.
>     >>
>     >> == Rationale ==
>     >>
>     >> 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 an input script type is P2SH, any satisfying script should
>     do, just as
>     >> if it was 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 defeat the purpose of a multisig
>     address.
>     >>
>     >> == Specification ==
>     >>
>     >> === Data structure ===
>     >>
>     >> 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 as T and in the same order as in T, but with
>     each sequence
>     >> number set to 0. There is exactly one output, here called the
>     pop output,
>     >> with value 0. The pop output must have the following format:
>     >>
>     >>  OP_RETURN <version> <txid> <nonce>
>     >>
>     >> {|
>     >> ! Field        !! Size [B] !! Description
>     >> |-
>     >> | &lt;version> || 2        || Version, little endian, currently
>     0x01 0x00
>     >> |-
>     >> | &lt;txid>    || 32       || The transaction to prove
>     >> |-
>     >> | &lt;nonce>   || 6        || Random data
>     >> |}
>     >>
>     >> The lock_time of the PoP must be set to 499999999 to prevent
>     the PoP from
>     >> being included in a block, should it appear on the bitcoin p2p
>     network. This
>     >> is also the reason for setting the sequence numbers to 0, since
>     sequence
>     >> number of ffffffff would make lock_time ineffective. This
>     specification
>     >> demands that all input sequence numbers are 0, not just one of
>     them, which
>     >> would be sufficient to make lock_time effective. This is for
>     simplicity
>     >> reasons.
>     >>
>     >> An illustration of the PoP data structure and its original
>     payment is
>     >> shown below.
>     >>
>     >> <pre>
>     >>   T
>     >>  +------------------------------------------------+
>     >>  |inputs                | outputs                 |
>     >>  |       Value,Sequence | Value,Script            |
>     >>  +------------------------------------------------+
>     >>  |input0 1,ffffffff     | 0,pay to A              |
>     >>  |input1 3,ffffffff     | 2,OP_RETURN <some data> |
>     >>  |input2 4,ffffffff     | 1,pay to B              |
>     >>  |                      | 4,pay to C              |
>     >>  +------------------------------------------------+
>     >>
>     >>   PoP(T)
>     >>  +-------------------------------------------------------------+
>     >>  | inputs               | outputs                              |
>     >>  |       Value,Sequence | Value,Script                         |
>     >>  +-------------------------------------------------------------+
>     >>  |input0 1,00000000     | 0,OP_RETURN <version> <txid> <nonce> |
>     >>  |input1 3,00000000     |                                      |
>     >>  |input2 4,00000000     |                                      |
>     >>  +-------------------------------------------------------------+
>     >>  | lock_time=499999999                                         |
>     >>  +-------------------------------------------------------------+
>     >> </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 useless since the
>     server will
>     >> generate a new nonce for every PoP request.
>     >>
>     >> === Process ===
>     >>
>     >> # 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 URI
>     >> # 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
>     “valid” or
>     >> “invalid”.
>     >> # 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.
>     >>
>     >> === Validating a PoP ===
>     >>
>     >> 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 that lock_time is 499999999.
>     >> # Check that there is exactly one output. This output must have
>     value 0
>     >> and conform to the OP_RETURN output format outlined above.
>     >> # Check that the nonce is the same as the one requested.
>     >> # Check that the inputs of the PoP are exactly the same as in
>     transaction
>     >> T, except that the sequence numbers must all be 0. The ordering
>     of the
>     >> inputs must also be the same as in T.
>     >> # Run the scripts of all the inputs. All scipts must return true.
>     >> # Check that the txid in the PoP output is the transaction you
>     actually
>     >> want proof for. If you don’t know exactly what transaction you
>     want proof
>     >> for, check that the transaction actually pays for the
>     product/service you
>     >> deliver.
>     >> # Return "valid".
>     >>
>     >> == Security considerations ==
>     >>
>     >> * Someone can intercept the PoP-request and change any
>     parameter in it.
>     >> These can be mitigated by using secure connections. For example:
>     >> ** Pop destination - Stealing your PoP.
>     >> ** label - Trick you to sign an unintended pop or set a label
>     that your
>     >> wallet doesn't have any record for, resulting in a broken
>     service. Always
>     >> check the PoP before signing.
>     >> ** nonce - Your pop will not validate on server.
>     >> * Someone can steal a PoP, for example by tampering with the
>     PoP request,
>     >> 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 for a payment than the client's wallet. In that
>     case the
>     >> wallet will not be able to prove the transaction to 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.
>     >>
>     >> == Reference implementation ==
>     >>
>     >> [https://github.com/kallerosenbaum/poppoc poppoc on GitHub]
>     >>
>     >> [https://github.com/kallerosenbaum/wallet Mycelium fork on GitHub]
>     >>
>     >> == References ==
>     >>
>     >> [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]]
>     >>
>     >> #########################################################
>     >>
>     >> 2015-06-06 23:25 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se
>     <mailto:kalle@rosenbaum.se>>:
>     >> > Thank you all for the feedback.
>     >> >
>     >> > I will change the data structure as follows:
>     >> >
>     >> > * There will be only one output, the "pop output", and no
>     outputs from
>     >> > T will be copied to the PoP.
>     >> > * The pop output will have value 0.
>     >> > * The sequence number of all inputs of the PoP will be set to
>     0. I
>     >> > chose to set it to 0 for all inputs for simplicity.
>     >> > * The lock_time of the PoP is always set to 499999999.
>     >> >
>     >> > Any comments on this?
>     >> >
>     >> > /Kalle
>     >> >
>     >> > 2015-06-06 19:00 GMT+02:00 Kalle Rosenbaum
>     <kalle@rosenbaum.se <mailto:kalle@rosenbaum.se>>:
>     >> >> 2015-06-06 18:10 GMT+02:00 Tom Harding <tomh@thinlink.com
>     <mailto:tomh@thinlink.com>>:
>     >> >>> On Jun 6, 2015 8:05 AM, "Kalle Rosenbaum"
>     <kalle@rosenbaum.se <mailto:kalle@rosenbaum.se>> wrote:
>     >> >>>
>     >> >>>> I'm open to changes here.
>     >> >>>
>     >> >>> I suggest:
>     >> >>>
>     >> >>> - Don't include any real outputs.   They are redundant
>     because the
>     >> >>> txid is
>     >> >>> already referenced.
>     >> >>
>     >> >> with the nLocktime solution, the copied outputs are not needed.
>     >> >>
>     >> >>>
>     >> >>> - Start the proof script, which should be invalid, with a magic
>     >> >>> constant and
>     >> >>> include space for future expansion.  This makes PoP's easy
>     to identify
>     >> >>> and
>     >> >>> extend.
>     >> >>
>     >> >> I did remore the constant (a "PoP" literal ascii encoded string)
>     >> >> because it didn't add much. The recipient will expect a pop,
>     so it
>     >> >> will simply treat it as one. I did add a 2 byte version
>     field to make
>     >> >> it extendable.
>     >> >>
>     >> >>>
>     >> >>> - "Proof of Potential"
>     >> >>
>     >> >> Noted :-)
>     >> >>
>     >> >> Thank you
>     >> >> /Kalle
>     >>
>     >>
>     >>
>     ------------------------------------------------------------------------------
>     >>
>     >> _______________________________________________
>     >> Bitcoin-development mailing list
>     >> Bitcoin-development@lists.sourceforge.net
>     <mailto:Bitcoin-development@lists.sourceforge.net>
>     >> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>     >>
>     >
>
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development


[-- Attachment #2: Type: text/html, Size: 27828 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-16  5:26                   ` Tom Harding
@ 2015-06-16 12:12                     ` Kalle Rosenbaum
  2015-06-16 12:31                       ` Kalle Rosenbaum
  2015-06-16 14:05                       ` Tom Harding
  0 siblings, 2 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-16 12:12 UTC (permalink / raw)
  To: Tom Harding; +Cc: Bitcoin Dev

2015-06-16 7:26 GMT+02:00 Tom Harding <tomh@thinlink.com>:
>
> Kalle goes to some trouble to describe how merchants need to ensure that
> they only accept a PoP provided as a response to their challenge.
>

Do you mean that it will be hard to explain to merchants that they
must check the nonce in the PoP so that it matches the nonce in the
pop request? I think not, this is a commonly used pattern that anyone
should be able to grasp. Anyway, merchants will probably use a library
(though yet non-existing) for PoP, that will hide the gory details. I
also think that payment providers may want to add PoP to their
offering to customers (merchants).

Regards,
/Kalle

>
>
> On 6/15/2015 3:00 AM, Pieter Wuille wrote:
>
> I did misunderstand that. That changes things significantly.
>
> However, having paid is not the same as having had access to the input
> coins. What about shared wallets or coinjoin?
>
> Also, if I understand correctly, there is no commitment to anything you're
> trying to say about the sender? So once I obtain a proof-of-payment from you
> about something you paid, I can go claim that it's mine?
>
> Why does anyone care who paid? This is like walking into a coffeshop,
> noticing I don't have money with me, let me friend pay for me, and then have
> the shop insist that I can't drink it because I'm not the buyer.
>
> Track payments, don't try to assign identities to payers.
>
> On Jun 15, 2015 11:35 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>>
>> Hi Pieter!
>>
>> It is intended to be a proof that you *have paid* for something. Not
>> that you have the intent to pay for something. You cannot use PoP
>> without a transaction to prove.
>>
>> So, yes, it's just a proof of access to certain coins that you no longer
>> have.
>>
>> Maybe I don't understand you correctly?
>>
>> /Kalle
>>
>> 2015-06-15 11:27 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
>> > Now that you have removed the outputs, I don't think it's even a intent
>> > of
>> > payment, but just a proof of access to certain coins.
>> >
>> > On Jun 15, 2015 11:24 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>> >>
>> >> Hi all!
>> >>
>> >> I have made the discussed changes and updated my implementation
>> >> (https://github.com/kallerosenbaum/poppoc) accordingly. These are the
>> >> changes:
>> >>
>> >> * There is now only one output, the "pop output", of value 0.
>> >> * The sequence number of all inputs of the PoP must be set to 0. I
>> >> chose to set it to 0 for all inputs for simplicity.
>> >> * The lock_time of the PoP must be set to 499999999 (max block height
>> >> lock
>> >> time).
>> >>
>> >> The comments so far has been mainly positive or neutral. Are there any
>> >> major objections against any of the two proposals? If not, I will ask
>> >> Gregory Maxwell to assign them BIP numbers.
>> >>
>> >> The two BIP proposals can be found at
>> >> https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP and
>> >> https://github.com/kallerosenbaum/poppoc/wiki/btcpop-scheme-BIP. The
>> >> source
>> >> for the Proof of Payment BIP proposal is also in-lined below.
>> >>
>> >> A number of alternative names have been proposed:
>> >>
>> >> * Proof of Potential
>> >> * Proof of Control
>> >> * Proof of Signature
>> >> * Signatory Proof
>> >> * Popo: Proof of payment origin
>> >> * Pots: Proof of transaction signer
>> >> * proof of transaction intent
>> >> * Declaration of intent
>> >> * Asset-access-and-action-affirmation, AAaAA, or A5
>> >> * VeriBit
>> >> * CertiBTC
>> >> * VBit
>> >> * PayID
>> >>
>> >> Given this list, I still think "Proof of Payment" is the most
>> >> descriptive
>> >> to non-technical people.
>> >>
>> >> Regards,
>> >> Kalle
>> >>
>> >>
>> >> #################################################
>> >> <pre>
>> >>   BIP: <BIP number>
>> >>   Title: Proof of Payment
>> >>   Author: Kalle Rosenbaum <kalle@rosenbaum.se>
>> >>   Status: Draft
>> >>   Type: Standards Track
>> >>   Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
>> >> </pre>
>> >>
>> >> == Abstract ==
>> >>
>> >> This BIP describes how a wallet can prove to a server that it has the
>> >> ability to sign a certain transaction.
>> >>
>> >> == Motivation ==
>> >>
>> >> 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.
>> >>
>> >> == Rationale ==
>> >>
>> >> 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 an input script type is P2SH, any satisfying script should do, just
>> >> as
>> >> if it was 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 defeat the purpose of a multisig address.
>> >>
>> >> == Specification ==
>> >>
>> >> === Data structure ===
>> >>
>> >> 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 as T and in the same order as in T, but with each
>> >> sequence
>> >> number set to 0. There is exactly one output, here called the pop
>> >> output,
>> >> with value 0. The pop output must have the following format:
>> >>
>> >>  OP_RETURN <version> <txid> <nonce>
>> >>
>> >> {|
>> >> ! Field        !! Size [B] !! Description
>> >> |-
>> >> | &lt;version> || 2        || Version, little endian, currently 0x01
>> >> 0x00
>> >> |-
>> >> | &lt;txid>    || 32       || The transaction to prove
>> >> |-
>> >> | &lt;nonce>   || 6        || Random data
>> >> |}
>> >>
>> >> The lock_time of the PoP must be set to 499999999 to prevent the PoP
>> >> from
>> >> being included in a block, should it appear on the bitcoin p2p network.
>> >> This
>> >> is also the reason for setting the sequence numbers to 0, since
>> >> sequence
>> >> number of ffffffff would make lock_time ineffective. This specification
>> >> demands that all input sequence numbers are 0, not just one of them,
>> >> which
>> >> would be sufficient to make lock_time effective. This is for simplicity
>> >> reasons.
>> >>
>> >> An illustration of the PoP data structure and its original payment is
>> >> shown below.
>> >>
>> >> <pre>
>> >>   T
>> >>  +------------------------------------------------+
>> >>  |inputs                | outputs                 |
>> >>  |       Value,Sequence | Value,Script            |
>> >>  +------------------------------------------------+
>> >>  |input0 1,ffffffff     | 0,pay to A              |
>> >>  |input1 3,ffffffff     | 2,OP_RETURN <some data> |
>> >>  |input2 4,ffffffff     | 1,pay to B              |
>> >>  |                      | 4,pay to C              |
>> >>  +------------------------------------------------+
>> >>
>> >>   PoP(T)
>> >>  +-------------------------------------------------------------+
>> >>  | inputs               | outputs                              |
>> >>  |       Value,Sequence | Value,Script                         |
>> >>  +-------------------------------------------------------------+
>> >>  |input0 1,00000000     | 0,OP_RETURN <version> <txid> <nonce> |
>> >>  |input1 3,00000000     |                                      |
>> >>  |input2 4,00000000     |                                      |
>> >>  +-------------------------------------------------------------+
>> >>  | lock_time=499999999                                         |
>> >>  +-------------------------------------------------------------+
>> >> </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 useless since the server
>> >> will
>> >> generate a new nonce for every PoP request.
>> >>
>> >> === Process ===
>> >>
>> >> # 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 URI
>> >> # 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 “valid”
>> >> or
>> >> “invalid”.
>> >> # 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.
>> >>
>> >> === Validating a PoP ===
>> >>
>> >> 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 that lock_time is 499999999.
>> >> # Check that there is exactly one output. This output must have value 0
>> >> and conform to the OP_RETURN output format outlined above.
>> >> # Check that the nonce is the same as the one requested.
>> >> # Check that the inputs of the PoP are exactly the same as in
>> >> transaction
>> >> T, except that the sequence numbers must all be 0. The ordering of the
>> >> inputs must also be the same as in T.
>> >> # Run the scripts of all the inputs. All scipts must return true.
>> >> # Check that the txid in the PoP output is the transaction you actually
>> >> want proof for. If you don’t know exactly what transaction you want
>> >> proof
>> >> for, check that the transaction actually pays for the product/service
>> >> you
>> >> deliver.
>> >> # Return "valid".
>> >>
>> >> == Security considerations ==
>> >>
>> >> * Someone can intercept the PoP-request and change any parameter in it.
>> >> These can be mitigated by using secure connections. For example:
>> >> ** Pop destination - Stealing your PoP.
>> >> ** label - Trick you to sign an unintended pop or set a label that your
>> >> wallet doesn't have any record for, resulting in a broken service.
>> >> Always
>> >> check the PoP before signing.
>> >> ** nonce - Your pop will not validate on server.
>> >> * Someone can steal a PoP, for example by tampering with the PoP
>> >> request,
>> >> 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 for a payment than the client's wallet. In that case the
>> >> wallet will not be able to prove the transaction to 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.
>> >>
>> >> == Reference implementation ==
>> >>
>> >> [https://github.com/kallerosenbaum/poppoc poppoc on GitHub]
>> >>
>> >> [https://github.com/kallerosenbaum/wallet Mycelium fork on GitHub]
>> >>
>> >> == References ==
>> >>
>> >> [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]]
>> >>
>> >> #########################################################
>> >>
>> >> 2015-06-06 23:25 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
>> >> > Thank you all for the feedback.
>> >> >
>> >> > I will change the data structure as follows:
>> >> >
>> >> > * There will be only one output, the "pop output", and no outputs
>> >> > from
>> >> > T will be copied to the PoP.
>> >> > * The pop output will have value 0.
>> >> > * The sequence number of all inputs of the PoP will be set to 0. I
>> >> > chose to set it to 0 for all inputs for simplicity.
>> >> > * The lock_time of the PoP is always set to 499999999.
>> >> >
>> >> > Any comments on this?
>> >> >
>> >> > /Kalle
>> >> >
>> >> > 2015-06-06 19:00 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
>> >> >> 2015-06-06 18:10 GMT+02:00 Tom Harding <tomh@thinlink.com>:
>> >> >>> On Jun 6, 2015 8:05 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se>
>> >> >>> wrote:
>> >> >>>
>> >> >>>> I'm open to changes here.
>> >> >>>
>> >> >>> I suggest:
>> >> >>>
>> >> >>> - Don't include any real outputs.   They are redundant because the
>> >> >>> txid is
>> >> >>> already referenced.
>> >> >>
>> >> >> with the nLocktime solution, the copied outputs are not needed.
>> >> >>
>> >> >>>
>> >> >>> - Start the proof script, which should be invalid, with a magic
>> >> >>> constant and
>> >> >>> include space for future expansion.  This makes PoP's easy to
>> >> >>> identify
>> >> >>> and
>> >> >>> extend.
>> >> >>
>> >> >> I did remore the constant (a "PoP" literal ascii encoded string)
>> >> >> because it didn't add much. The recipient will expect a pop, so it
>> >> >> will simply treat it as one. I did add a 2 byte version field to
>> >> >> make
>> >> >> it extendable.
>> >> >>
>> >> >>>
>> >> >>> - "Proof of Potential"
>> >> >>
>> >> >> Noted :-)
>> >> >>
>> >> >> Thank you
>> >> >> /Kalle
>> >>
>> >>
>> >>
>> >> ------------------------------------------------------------------------------
>> >>
>> >> _______________________________________________
>> >> Bitcoin-development mailing list
>> >> Bitcoin-development@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>> >>
>> >
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-16 12:12                     ` Kalle Rosenbaum
@ 2015-06-16 12:31                       ` Kalle Rosenbaum
  2015-06-16 14:05                       ` Tom Harding
  1 sibling, 0 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-16 12:31 UTC (permalink / raw)
  To: Bitcoin Dev

Another thing worth mentioning is that an SPV wallet cannot validate a
PoP without fetching the input transactions of the PoP from an
external (not bitcoin network) source, for example chain.com or some
other trusted full node's API.

The validation of the PoP depends on the external source(s) being
honest. It can make a valid pop look invalid, but it cannot make an
invalid pop look valid.

/Kalle



2015-06-16 14:12 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
> 2015-06-16 7:26 GMT+02:00 Tom Harding <tomh@thinlink.com>:
>>
>> Kalle goes to some trouble to describe how merchants need to ensure that
>> they only accept a PoP provided as a response to their challenge.
>>
>
> Do you mean that it will be hard to explain to merchants that they
> must check the nonce in the PoP so that it matches the nonce in the
> pop request? I think not, this is a commonly used pattern that anyone
> should be able to grasp. Anyway, merchants will probably use a library
> (though yet non-existing) for PoP, that will hide the gory details. I
> also think that payment providers may want to add PoP to their
> offering to customers (merchants).
>
> Regards,
> /Kalle
>
>>
>>
>> On 6/15/2015 3:00 AM, Pieter Wuille wrote:
>>
>> I did misunderstand that. That changes things significantly.
>>
>> However, having paid is not the same as having had access to the input
>> coins. What about shared wallets or coinjoin?
>>
>> Also, if I understand correctly, there is no commitment to anything you're
>> trying to say about the sender? So once I obtain a proof-of-payment from you
>> about something you paid, I can go claim that it's mine?
>>
>> Why does anyone care who paid? This is like walking into a coffeshop,
>> noticing I don't have money with me, let me friend pay for me, and then have
>> the shop insist that I can't drink it because I'm not the buyer.
>>
>> Track payments, don't try to assign identities to payers.
>>
>> On Jun 15, 2015 11:35 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>>>
>>> Hi Pieter!
>>>
>>> It is intended to be a proof that you *have paid* for something. Not
>>> that you have the intent to pay for something. You cannot use PoP
>>> without a transaction to prove.
>>>
>>> So, yes, it's just a proof of access to certain coins that you no longer
>>> have.
>>>
>>> Maybe I don't understand you correctly?
>>>
>>> /Kalle
>>>
>>> 2015-06-15 11:27 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
>>> > Now that you have removed the outputs, I don't think it's even a intent
>>> > of
>>> > payment, but just a proof of access to certain coins.
>>> >
>>> > On Jun 15, 2015 11:24 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>>> >>
>>> >> Hi all!
>>> >>
>>> >> I have made the discussed changes and updated my implementation
>>> >> (https://github.com/kallerosenbaum/poppoc) accordingly. These are the
>>> >> changes:
>>> >>
>>> >> * There is now only one output, the "pop output", of value 0.
>>> >> * The sequence number of all inputs of the PoP must be set to 0. I
>>> >> chose to set it to 0 for all inputs for simplicity.
>>> >> * The lock_time of the PoP must be set to 499999999 (max block height
>>> >> lock
>>> >> time).
>>> >>
>>> >> The comments so far has been mainly positive or neutral. Are there any
>>> >> major objections against any of the two proposals? If not, I will ask
>>> >> Gregory Maxwell to assign them BIP numbers.
>>> >>
>>> >> The two BIP proposals can be found at
>>> >> https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP and
>>> >> https://github.com/kallerosenbaum/poppoc/wiki/btcpop-scheme-BIP. The
>>> >> source
>>> >> for the Proof of Payment BIP proposal is also in-lined below.
>>> >>
>>> >> A number of alternative names have been proposed:
>>> >>
>>> >> * Proof of Potential
>>> >> * Proof of Control
>>> >> * Proof of Signature
>>> >> * Signatory Proof
>>> >> * Popo: Proof of payment origin
>>> >> * Pots: Proof of transaction signer
>>> >> * proof of transaction intent
>>> >> * Declaration of intent
>>> >> * Asset-access-and-action-affirmation, AAaAA, or A5
>>> >> * VeriBit
>>> >> * CertiBTC
>>> >> * VBit
>>> >> * PayID
>>> >>
>>> >> Given this list, I still think "Proof of Payment" is the most
>>> >> descriptive
>>> >> to non-technical people.
>>> >>
>>> >> Regards,
>>> >> Kalle
>>> >>
>>> >>
>>> >> #################################################
>>> >> <pre>
>>> >>   BIP: <BIP number>
>>> >>   Title: Proof of Payment
>>> >>   Author: Kalle Rosenbaum <kalle@rosenbaum.se>
>>> >>   Status: Draft
>>> >>   Type: Standards Track
>>> >>   Created: <date created on, in ISO 8601 (yyyy-mm-dd) format>
>>> >> </pre>
>>> >>
>>> >> == Abstract ==
>>> >>
>>> >> This BIP describes how a wallet can prove to a server that it has the
>>> >> ability to sign a certain transaction.
>>> >>
>>> >> == Motivation ==
>>> >>
>>> >> 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.
>>> >>
>>> >> == Rationale ==
>>> >>
>>> >> 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 an input script type is P2SH, any satisfying script should do, just
>>> >> as
>>> >> if it was 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 defeat the purpose of a multisig address.
>>> >>
>>> >> == Specification ==
>>> >>
>>> >> === Data structure ===
>>> >>
>>> >> 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 as T and in the same order as in T, but with each
>>> >> sequence
>>> >> number set to 0. There is exactly one output, here called the pop
>>> >> output,
>>> >> with value 0. The pop output must have the following format:
>>> >>
>>> >>  OP_RETURN <version> <txid> <nonce>
>>> >>
>>> >> {|
>>> >> ! Field        !! Size [B] !! Description
>>> >> |-
>>> >> | &lt;version> || 2        || Version, little endian, currently 0x01
>>> >> 0x00
>>> >> |-
>>> >> | &lt;txid>    || 32       || The transaction to prove
>>> >> |-
>>> >> | &lt;nonce>   || 6        || Random data
>>> >> |}
>>> >>
>>> >> The lock_time of the PoP must be set to 499999999 to prevent the PoP
>>> >> from
>>> >> being included in a block, should it appear on the bitcoin p2p network.
>>> >> This
>>> >> is also the reason for setting the sequence numbers to 0, since
>>> >> sequence
>>> >> number of ffffffff would make lock_time ineffective. This specification
>>> >> demands that all input sequence numbers are 0, not just one of them,
>>> >> which
>>> >> would be sufficient to make lock_time effective. This is for simplicity
>>> >> reasons.
>>> >>
>>> >> An illustration of the PoP data structure and its original payment is
>>> >> shown below.
>>> >>
>>> >> <pre>
>>> >>   T
>>> >>  +------------------------------------------------+
>>> >>  |inputs                | outputs                 |
>>> >>  |       Value,Sequence | Value,Script            |
>>> >>  +------------------------------------------------+
>>> >>  |input0 1,ffffffff     | 0,pay to A              |
>>> >>  |input1 3,ffffffff     | 2,OP_RETURN <some data> |
>>> >>  |input2 4,ffffffff     | 1,pay to B              |
>>> >>  |                      | 4,pay to C              |
>>> >>  +------------------------------------------------+
>>> >>
>>> >>   PoP(T)
>>> >>  +-------------------------------------------------------------+
>>> >>  | inputs               | outputs                              |
>>> >>  |       Value,Sequence | Value,Script                         |
>>> >>  +-------------------------------------------------------------+
>>> >>  |input0 1,00000000     | 0,OP_RETURN <version> <txid> <nonce> |
>>> >>  |input1 3,00000000     |                                      |
>>> >>  |input2 4,00000000     |                                      |
>>> >>  +-------------------------------------------------------------+
>>> >>  | lock_time=499999999                                         |
>>> >>  +-------------------------------------------------------------+
>>> >> </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 useless since the server
>>> >> will
>>> >> generate a new nonce for every PoP request.
>>> >>
>>> >> === Process ===
>>> >>
>>> >> # 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 URI
>>> >> # 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 “valid”
>>> >> or
>>> >> “invalid”.
>>> >> # 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.
>>> >>
>>> >> === Validating a PoP ===
>>> >>
>>> >> 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 that lock_time is 499999999.
>>> >> # Check that there is exactly one output. This output must have value 0
>>> >> and conform to the OP_RETURN output format outlined above.
>>> >> # Check that the nonce is the same as the one requested.
>>> >> # Check that the inputs of the PoP are exactly the same as in
>>> >> transaction
>>> >> T, except that the sequence numbers must all be 0. The ordering of the
>>> >> inputs must also be the same as in T.
>>> >> # Run the scripts of all the inputs. All scipts must return true.
>>> >> # Check that the txid in the PoP output is the transaction you actually
>>> >> want proof for. If you don’t know exactly what transaction you want
>>> >> proof
>>> >> for, check that the transaction actually pays for the product/service
>>> >> you
>>> >> deliver.
>>> >> # Return "valid".
>>> >>
>>> >> == Security considerations ==
>>> >>
>>> >> * Someone can intercept the PoP-request and change any parameter in it.
>>> >> These can be mitigated by using secure connections. For example:
>>> >> ** Pop destination - Stealing your PoP.
>>> >> ** label - Trick you to sign an unintended pop or set a label that your
>>> >> wallet doesn't have any record for, resulting in a broken service.
>>> >> Always
>>> >> check the PoP before signing.
>>> >> ** nonce - Your pop will not validate on server.
>>> >> * Someone can steal a PoP, for example by tampering with the PoP
>>> >> request,
>>> >> 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 for a payment than the client's wallet. In that case the
>>> >> wallet will not be able to prove the transaction to 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.
>>> >>
>>> >> == Reference implementation ==
>>> >>
>>> >> [https://github.com/kallerosenbaum/poppoc poppoc on GitHub]
>>> >>
>>> >> [https://github.com/kallerosenbaum/wallet Mycelium fork on GitHub]
>>> >>
>>> >> == References ==
>>> >>
>>> >> [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]]
>>> >>
>>> >> #########################################################
>>> >>
>>> >> 2015-06-06 23:25 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
>>> >> > Thank you all for the feedback.
>>> >> >
>>> >> > I will change the data structure as follows:
>>> >> >
>>> >> > * There will be only one output, the "pop output", and no outputs
>>> >> > from
>>> >> > T will be copied to the PoP.
>>> >> > * The pop output will have value 0.
>>> >> > * The sequence number of all inputs of the PoP will be set to 0. I
>>> >> > chose to set it to 0 for all inputs for simplicity.
>>> >> > * The lock_time of the PoP is always set to 499999999.
>>> >> >
>>> >> > Any comments on this?
>>> >> >
>>> >> > /Kalle
>>> >> >
>>> >> > 2015-06-06 19:00 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
>>> >> >> 2015-06-06 18:10 GMT+02:00 Tom Harding <tomh@thinlink.com>:
>>> >> >>> On Jun 6, 2015 8:05 AM, "Kalle Rosenbaum" <kalle@rosenbaum.se>
>>> >> >>> wrote:
>>> >> >>>
>>> >> >>>> I'm open to changes here.
>>> >> >>>
>>> >> >>> I suggest:
>>> >> >>>
>>> >> >>> - Don't include any real outputs.   They are redundant because the
>>> >> >>> txid is
>>> >> >>> already referenced.
>>> >> >>
>>> >> >> with the nLocktime solution, the copied outputs are not needed.
>>> >> >>
>>> >> >>>
>>> >> >>> - Start the proof script, which should be invalid, with a magic
>>> >> >>> constant and
>>> >> >>> include space for future expansion.  This makes PoP's easy to
>>> >> >>> identify
>>> >> >>> and
>>> >> >>> extend.
>>> >> >>
>>> >> >> I did remore the constant (a "PoP" literal ascii encoded string)
>>> >> >> because it didn't add much. The recipient will expect a pop, so it
>>> >> >> will simply treat it as one. I did add a 2 byte version field to
>>> >> >> make
>>> >> >> it extendable.
>>> >> >>
>>> >> >>>
>>> >> >>> - "Proof of Potential"
>>> >> >>
>>> >> >> Noted :-)
>>> >> >>
>>> >> >> Thank you
>>> >> >> /Kalle
>>> >>
>>> >>
>>> >>
>>> >> ------------------------------------------------------------------------------
>>> >>
>>> >> _______________________________________________
>>> >> Bitcoin-development mailing list
>>> >> Bitcoin-development@lists.sourceforge.net
>>> >> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>>> >>
>>> >
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>>
>>
>> _______________________________________________
>> Bitcoin-development mailing list
>> Bitcoin-development@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Bitcoin-development mailing list
>> Bitcoin-development@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-16 12:12                     ` Kalle Rosenbaum
  2015-06-16 12:31                       ` Kalle Rosenbaum
@ 2015-06-16 14:05                       ` Tom Harding
  2015-06-16 16:22                         ` Kalle Rosenbaum
  1 sibling, 1 reply; 32+ messages in thread
From: Tom Harding @ 2015-06-16 14:05 UTC (permalink / raw)
  To: Kalle Rosenbaum; +Cc: Bitcoin Dev

On 6/16/2015 5:12 AM, Kalle Rosenbaum wrote:
> 2015-06-16 7:26 GMT+02:00 Tom Harding <tomh@thinlink.com>:
>> Kalle goes to some trouble to describe how merchants need to ensure that
>> they only accept a PoP provided as a response to their challenge.
>>
> Do you mean that it will be hard to explain to merchants that they
> must check the nonce in the PoP so that it matches the nonce in the
> pop request?

Sorry for the idiomatic language.  No, I just meant that you have
thought it out in detail!  You standardize a latent capability of the
cryptosystem.  It seems very powerful for some classes of users.





^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-15 11:59                   ` Kalle Rosenbaum
@ 2015-06-16 14:31                     ` Pieter Wuille
  2015-06-16 19:22                       ` Kalle Rosenbaum
  0 siblings, 1 reply; 32+ messages in thread
From: Pieter Wuille @ 2015-06-16 14:31 UTC (permalink / raw)
  To: Kalle Rosenbaum; +Cc: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 2312 bytes --]

On Mon, Jun 15, 2015 at 1:59 PM, Kalle Rosenbaum <kalle@rosenbaum.se> wrote:

> 2015-06-15 12:00 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> I'm not sure if we will be able to support PoP with CoinJoin. Maybe
> someone with more insight into CoinJoin have some input?
>

Not really. The problem is that you assume a transaction corresponds to a
single payment. This is true for simple wallet use cases, but not
compatible with CoinJoin, or with systems that for example would want to
combine multiple payments in a single transaction.


> > Also, if I understand correctly, there is no commitment to anything
> you're
> > trying to say about the sender? So once I obtain a proof-of-payment from
> you
> > about something you paid, I can go claim that it's mine?
>
> I don't understand this. The pop includes a nonce randomly generated
> by the server. If you're very lucky, 1/(2^48) per try, you can reuse a
> pop.
>
>
I owe you an apology here, for judging based on the summary you posted
rather than reading the actual text.

48 bits seems low to me, but it does indeed solve the problem. Why not 128
or 256 bits?

> Why does anyone care who paid? This is like walking into a coffeshop,
> > noticing I don't have money with me, let me friend pay for me, and then
> have
> > the shop insist that I can't drink it because I'm not the buyer.
>
> If you pay as you use the service (ie pay for coffee upfront), there's
> no need for PoP. Please see the Motivation section. But you are right
> that you must have the wallet(s) that paid at hand when you issue a
> PoP.
>
> >
> > Track payments, don't try to assign identities to payers.
>
> Please elaborate, I don't understand what you mean here.
>

I think that is a mistake. You should not assume that the wallet who held
the coins is the payer/buyer. That's what I said earlier; you're implicitly
creating an identity (the one who holds these keys) based on the
transaction. This seems fundamentally wrong to me, and not necessary. The
receiver should not care who paid or how, he should care what was payed for.

The easiest solution to this IMHO would be an extension to the payment
protocol that gives you (or your wallet) a token in return for paying, and
that knowledge of that token is used to gain access to the services you
provide.

-- 
Pieter

[-- Attachment #2: Type: text/html, Size: 3350 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-16 14:05                       ` Tom Harding
@ 2015-06-16 16:22                         ` Kalle Rosenbaum
  0 siblings, 0 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-16 16:22 UTC (permalink / raw)
  To: Tom Harding; +Cc: Bitcoin Dev

Thank you for the clarification Tom!

/Kalle

2015-06-16 16:05 GMT+02:00 Tom Harding <tomh@thinlink.com>:
> On 6/16/2015 5:12 AM, Kalle Rosenbaum wrote:
>> 2015-06-16 7:26 GMT+02:00 Tom Harding <tomh@thinlink.com>:
>>> Kalle goes to some trouble to describe how merchants need to ensure that
>>> they only accept a PoP provided as a response to their challenge.
>>>
>> Do you mean that it will be hard to explain to merchants that they
>> must check the nonce in the PoP so that it matches the nonce in the
>> pop request?
>
> Sorry for the idiomatic language.  No, I just meant that you have
> thought it out in detail!  You standardize a latent capability of the
> cryptosystem.  It seems very powerful for some classes of users.
>
>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-16 14:31                     ` Pieter Wuille
@ 2015-06-16 19:22                       ` Kalle Rosenbaum
  2015-06-16 19:25                         ` Pieter Wuille
  0 siblings, 1 reply; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-16 19:22 UTC (permalink / raw)
  To: Pieter Wuille; +Cc: Bitcoin Dev

Thank you for your comments Pieter! Please find my answers below.

2015-06-16 16:31 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> On Mon, Jun 15, 2015 at 1:59 PM, Kalle Rosenbaum <kalle@rosenbaum.se> wrote:
>>
>> 2015-06-15 12:00 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
>> I'm not sure if we will be able to support PoP with CoinJoin. Maybe
>> someone with more insight into CoinJoin have some input?
>
>
> Not really. The problem is that you assume a transaction corresponds to a
> single payment. This is true for simple wallet use cases, but not compatible
> with CoinJoin, or with systems that for example would want to combine
> multiple payments in a single transaction.
>

Yes, you are right. It's not compatible with CoinJoin and the likes.

>
> 48 bits seems low to me, but it does indeed solve the problem. Why not 128
> or 256 bits?

The nonce is limited because of the OP_RETURN output being limited to
40 bytes of data: 2 bytes version, 32 bytes txid, 6 bytes nonce.

>
>> > Why does anyone care who paid? This is like walking into a coffeshop,
>> > noticing I don't have money with me, let me friend pay for me, and then
>> > have
>> > the shop insist that I can't drink it because I'm not the buyer.
>>
>> If you pay as you use the service (ie pay for coffee upfront), there's
>> no need for PoP. Please see the Motivation section. But you are right
>> that you must have the wallet(s) that paid at hand when you issue a
>> PoP.
>>
>> >
>> > Track payments, don't try to assign identities to payers.
>>
>> Please elaborate, I don't understand what you mean here.
>
>
> I think that is a mistake. You should not assume that the wallet who held
> the coins is the payer/buyer. That's what I said earlier; you're implicitly
> creating an identity (the one who holds these keys) based on the
> transaction. This seems fundamentally wrong to me, and not necessary. The
> receiver should not care who paid or how, he should care what was payed for.

You are saying that it's a problem that the wallet used to pay, must
also be used to issue the PoP? That may very well be a problem in some
cases. People using PoP should of course be aware of it's limitations
and act accordingly, i.e. don't pay for concert tickets for a friend
and expect your friend to be able to enter the arena with her wallet.
As Tom Harding noted, it is possible to transfer keys to your friend's
wallet, but that might not be desirable if those keys are also used
for other payments. Also that would weaken the security of an HD
wallet, since a chain code along with a private key would reveal all
keys in that tree. Another solution is that your friend forwards the
PoP request to your wallet, through twitter or SMS, and you send the
PoP for her. Maybe that forwarding mechanism can be built into wallets
and automated so that the wallet automatically suggests to sign the
PoP for your friend. This is probably something to investigate
further, but not within the scope of this BIP.

Of course the simplest solution would be to send money to your friend
first so that she can pay for the ticket from her own wallet, but
that's not always feasible.

>
> The easiest solution to this IMHO would be an extension to the payment
> protocol that gives you (or your wallet) a token in return for paying, and
> that knowledge of that token is used to gain access to the services you
> provide.
>

That token would then be reusable. Someone stealing it would be able
to use it as much as she wants. That is what I want to avoid with PoP.
The BIP proposal briefly mentions something like this in the
rationale. I also had a discussion about this with Mike Hearn on this
list on Mars 13 that I think covers most pros and cons of the
different approaches.

While your suggestion does indeed separate the transaction from the
proof of payment, it also assumes that the token is held in the wallet
that pays. Otherwise you would need to keep it in another safe place,
remember it's reusable. Where would that be? How would you transfer
that token to your friend?

Thank you again for your comments. I appreciate it.

Best regards,
Kalle

> --
> Pieter
>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-16 19:22                       ` Kalle Rosenbaum
@ 2015-06-16 19:25                         ` Pieter Wuille
       [not found]                           ` <CAPswA9yFUAqFyNBFBnnwpT=B9RcdNssdjz-_KWbX5GuLM5Uyxw@mail.gmail.com>
  0 siblings, 1 reply; 32+ messages in thread
From: Pieter Wuille @ 2015-06-16 19:25 UTC (permalink / raw)
  To: Kalle Rosenbaum; +Cc: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 4669 bytes --]

You can't avoid sharing the token, and you can't avoid sharing the private
keys used for signing either. If they are single use, you don't lose
anything by sharing them.

Also you are not creating a real transaction. Why does the OP_RETURN
limitation matter?
On Jun 16, 2015 9:22 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:

> Thank you for your comments Pieter! Please find my answers below.
>
> 2015-06-16 16:31 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> > On Mon, Jun 15, 2015 at 1:59 PM, Kalle Rosenbaum <kalle@rosenbaum.se>
> wrote:
> >>
> >> 2015-06-15 12:00 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> >> I'm not sure if we will be able to support PoP with CoinJoin. Maybe
> >> someone with more insight into CoinJoin have some input?
> >
> >
> > Not really. The problem is that you assume a transaction corresponds to a
> > single payment. This is true for simple wallet use cases, but not
> compatible
> > with CoinJoin, or with systems that for example would want to combine
> > multiple payments in a single transaction.
> >
>
> Yes, you are right. It's not compatible with CoinJoin and the likes.
>
> >
> > 48 bits seems low to me, but it does indeed solve the problem. Why not
> 128
> > or 256 bits?
>
> The nonce is limited because of the OP_RETURN output being limited to
> 40 bytes of data: 2 bytes version, 32 bytes txid, 6 bytes nonce.
>
> >
> >> > Why does anyone care who paid? This is like walking into a coffeshop,
> >> > noticing I don't have money with me, let me friend pay for me, and
> then
> >> > have
> >> > the shop insist that I can't drink it because I'm not the buyer.
> >>
> >> If you pay as you use the service (ie pay for coffee upfront), there's
> >> no need for PoP. Please see the Motivation section. But you are right
> >> that you must have the wallet(s) that paid at hand when you issue a
> >> PoP.
> >>
> >> >
> >> > Track payments, don't try to assign identities to payers.
> >>
> >> Please elaborate, I don't understand what you mean here.
> >
> >
> > I think that is a mistake. You should not assume that the wallet who held
> > the coins is the payer/buyer. That's what I said earlier; you're
> implicitly
> > creating an identity (the one who holds these keys) based on the
> > transaction. This seems fundamentally wrong to me, and not necessary. The
> > receiver should not care who paid or how, he should care what was payed
> for.
>
> You are saying that it's a problem that the wallet used to pay, must
> also be used to issue the PoP? That may very well be a problem in some
> cases. People using PoP should of course be aware of it's limitations
> and act accordingly, i.e. don't pay for concert tickets for a friend
> and expect your friend to be able to enter the arena with her wallet.
> As Tom Harding noted, it is possible to transfer keys to your friend's
> wallet, but that might not be desirable if those keys are also used
> for other payments. Also that would weaken the security of an HD
> wallet, since a chain code along with a private key would reveal all
> keys in that tree. Another solution is that your friend forwards the
> PoP request to your wallet, through twitter or SMS, and you send the
> PoP for her. Maybe that forwarding mechanism can be built into wallets
> and automated so that the wallet automatically suggests to sign the
> PoP for your friend. This is probably something to investigate
> further, but not within the scope of this BIP.
>
> Of course the simplest solution would be to send money to your friend
> first so that she can pay for the ticket from her own wallet, but
> that's not always feasible.
>
> >
> > The easiest solution to this IMHO would be an extension to the payment
> > protocol that gives you (or your wallet) a token in return for paying,
> and
> > that knowledge of that token is used to gain access to the services you
> > provide.
> >
>
> That token would then be reusable. Someone stealing it would be able
> to use it as much as she wants. That is what I want to avoid with PoP.
> The BIP proposal briefly mentions something like this in the
> rationale. I also had a discussion about this with Mike Hearn on this
> list on Mars 13 that I think covers most pros and cons of the
> different approaches.
>
> While your suggestion does indeed separate the transaction from the
> proof of payment, it also assumes that the token is held in the wallet
> that pays. Otherwise you would need to keep it in another safe place,
> remember it's reusable. Where would that be? How would you transfer
> that token to your friend?
>
> Thank you again for your comments. I appreciate it.
>
> Best regards,
> Kalle
>
> > --
> > Pieter
> >
>

[-- Attachment #2: Type: text/html, Size: 5648 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
       [not found]                           ` <CAPswA9yFUAqFyNBFBnnwpT=B9RcdNssdjz-_KWbX5GuLM5Uyxw@mail.gmail.com>
@ 2015-06-16 19:48                             ` Pieter Wuille
  2015-06-17  9:51                               ` Kalle Rosenbaum
  0 siblings, 1 reply; 32+ messages in thread
From: Pieter Wuille @ 2015-06-16 19:48 UTC (permalink / raw)
  To: Kalle Rosenbaum, Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 6423 bytes --]

I don't see why existing software could create a 40-byte OP_RETURN but not
larger? The limitation comes from a relay policy in full nodes, not a
limitation is wallet software... and PoPs are not relayed on the network.

Regarding sharing, I think you're talking about a different use case. Say
you want to pay for 1-week valid entrance to some venue. I thought the
purpose of the PoP was to be sure that only the person who paid for it, and
not anyone else can use it during that week.

My argument against that is that the original payer can also hand the
private keys in his wallet to someone else, who would then become able to
create PoPs for the service. He does not lose anything by this, assuming
the address is not reused.

So, using a token does not change anything, except it can be provided to
the payer - instead of relying on creating an implicit identity based on
who seems to have held particular private keys in the past.
On Jun 16, 2015 9:41 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:

> 2015-06-16 21:25 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> > You can't avoid sharing the token, and you can't avoid sharing the
> private
> > keys used for signing either. If they are single use, you don't lose
> > anything by sharing them.
>
> Forwarding the PoP request would be a way to avoid sharing keys, as
> suggested above.
>
> >
> > Also you are not creating a real transaction. Why does the OP_RETURN
> > limitation matter?
>
> This was discussed in the beginning of this thread: "The idea is to
> simplify implementation. Existing software can be used as is to sign
> and validate PoPs"
>
> Regards,
> Kalle
>
> >
> > On Jun 16, 2015 9:22 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
> >>
> >> Thank you for your comments Pieter! Please find my answers below.
> >>
> >> 2015-06-16 16:31 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> >> > On Mon, Jun 15, 2015 at 1:59 PM, Kalle Rosenbaum <kalle@rosenbaum.se>
> >> > wrote:
> >> >>
> >> >> 2015-06-15 12:00 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> >> >> I'm not sure if we will be able to support PoP with CoinJoin. Maybe
> >> >> someone with more insight into CoinJoin have some input?
> >> >
> >> >
> >> > Not really. The problem is that you assume a transaction corresponds
> to
> >> > a
> >> > single payment. This is true for simple wallet use cases, but not
> >> > compatible
> >> > with CoinJoin, or with systems that for example would want to combine
> >> > multiple payments in a single transaction.
> >> >
> >>
> >> Yes, you are right. It's not compatible with CoinJoin and the likes.
> >>
> >> >
> >> > 48 bits seems low to me, but it does indeed solve the problem. Why not
> >> > 128
> >> > or 256 bits?
> >>
> >> The nonce is limited because of the OP_RETURN output being limited to
> >> 40 bytes of data: 2 bytes version, 32 bytes txid, 6 bytes nonce.
> >>
> >> >
> >> >> > Why does anyone care who paid? This is like walking into a
> coffeshop,
> >> >> > noticing I don't have money with me, let me friend pay for me, and
> >> >> > then
> >> >> > have
> >> >> > the shop insist that I can't drink it because I'm not the buyer.
> >> >>
> >> >> If you pay as you use the service (ie pay for coffee upfront),
> there's
> >> >> no need for PoP. Please see the Motivation section. But you are right
> >> >> that you must have the wallet(s) that paid at hand when you issue a
> >> >> PoP.
> >> >>
> >> >> >
> >> >> > Track payments, don't try to assign identities to payers.
> >> >>
> >> >> Please elaborate, I don't understand what you mean here.
> >> >
> >> >
> >> > I think that is a mistake. You should not assume that the wallet who
> >> > held
> >> > the coins is the payer/buyer. That's what I said earlier; you're
> >> > implicitly
> >> > creating an identity (the one who holds these keys) based on the
> >> > transaction. This seems fundamentally wrong to me, and not necessary.
> >> > The
> >> > receiver should not care who paid or how, he should care what was
> payed
> >> > for.
> >>
> >> You are saying that it's a problem that the wallet used to pay, must
> >> also be used to issue the PoP? That may very well be a problem in some
> >> cases. People using PoP should of course be aware of it's limitations
> >> and act accordingly, i.e. don't pay for concert tickets for a friend
> >> and expect your friend to be able to enter the arena with her wallet.
> >> As Tom Harding noted, it is possible to transfer keys to your friend's
> >> wallet, but that might not be desirable if those keys are also used
> >> for other payments. Also that would weaken the security of an HD
> >> wallet, since a chain code along with a private key would reveal all
> >> keys in that tree. Another solution is that your friend forwards the
> >> PoP request to your wallet, through twitter or SMS, and you send the
> >> PoP for her. Maybe that forwarding mechanism can be built into wallets
> >> and automated so that the wallet automatically suggests to sign the
> >> PoP for your friend. This is probably something to investigate
> >> further, but not within the scope of this BIP.
> >>
> >> Of course the simplest solution would be to send money to your friend
> >> first so that she can pay for the ticket from her own wallet, but
> >> that's not always feasible.
> >>
> >> >
> >> > The easiest solution to this IMHO would be an extension to the payment
> >> > protocol that gives you (or your wallet) a token in return for paying,
> >> > and
> >> > that knowledge of that token is used to gain access to the services
> you
> >> > provide.
> >> >
> >>
> >> That token would then be reusable. Someone stealing it would be able
> >> to use it as much as she wants. That is what I want to avoid with PoP.
> >> The BIP proposal briefly mentions something like this in the
> >> rationale. I also had a discussion about this with Mike Hearn on this
> >> list on Mars 13 that I think covers most pros and cons of the
> >> different approaches.
> >>
> >> While your suggestion does indeed separate the transaction from the
> >> proof of payment, it also assumes that the token is held in the wallet
> >> that pays. Otherwise you would need to keep it in another safe place,
> >> remember it's reusable. Where would that be? How would you transfer
> >> that token to your friend?
> >>
> >> Thank you again for your comments. I appreciate it.
> >>
> >> Best regards,
> >> Kalle
> >>
> >> > --
> >> > Pieter
> >> >
>

[-- Attachment #2: Type: text/html, Size: 8353 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-16 19:48                             ` Pieter Wuille
@ 2015-06-17  9:51                               ` Kalle Rosenbaum
  2015-06-21 14:39                                 ` Kalle Rosenbaum
       [not found]                                 ` <CABm2gDrickFojwmUi7GqAhSW5K0yTa_59VjKrY+wAXEq1MYUoA@mail.gmail.com>
  0 siblings, 2 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-17  9:51 UTC (permalink / raw)
  To: Pieter Wuille; +Cc: Bitcoin Dev

2015-06-16 21:48 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> I don't see why existing software could create a 40-byte OP_RETURN but not
> larger? The limitation comes from a relay policy in full nodes, not a
> limitation is wallet software... and PoPs are not relayed on the network.

You are probably right here. The thing is that I don't know how *all*
wallet signing and validating software is written, so I figure it's
better to stick to a "valid" output. Since I don't *need* more data
than 40 bytes, why bother. There's another constraint to this as well:
The other BIP proposal, "Proof of Payment URI scheme", includes a
nonce parameter in the URI. If the nonce is very long, the QR code
will be unnecessarily big. The server should try to detect a brute
force of the 48 bit nonce, or at least delay the pop requests by some
100 ms or so.

Do you think this is an actual problem, and why? Is your suggestion to
use a bigger nonce, given the above?

>
> Regarding sharing, I think you're talking about a different use case. Say
> you want to pay for 1-week valid entrance to some venue. I thought the
> purpose of the PoP was to be sure that only the person who paid for it, and
> not anyone else can use it during that week.
>

That's right. That's one use case. You pay for the 1-week entrance and
then you use your wallet to sign PoPs when you enter the venue.

> My argument against that is that the original payer can also hand the
> private keys in his wallet to someone else, who would then become able to
> create PoPs for the service. He does not lose anything by this, assuming the
> address is not reused.
>

Yes, that is possible. It's about the same as giving out a
username/password for a service that you have paid for. In the case of
a concert ticket, it's simple. Just allow one entrance per payment.
But in the example you gave, it's a bit more complicated. You could
for example give all guests a bracelet upon first entry or upon first
exit. Or you can put a stamp on people leaving the venue, and demand
that all re-entries show the stamp, possibly along with a new PoP.
Pretty much as is done already. Different use cases will need
different protection. In this example, the value added by PoP is that
the venue does not have to distribute tickets in advance. This in turn
allows for better privacy for the customer, who don't have to give out
personal information such as an email-address.

> So, using a token does not change anything, except it can be provided to the
> payer - instead of relying on creating an implicit identity based on who
> seems to have held particular private keys in the past.
>

Yes, that's a difference, but it comes at the cost of security. The
stolen token can be used over and over. In the case of PoP it's only
usable once, and it's only created when it's actually needed,
minimizing the window of opportunity for the thief.

Regards,
Kalle

> On Jun 16, 2015 9:41 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>>
>> 2015-06-16 21:25 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
>> > You can't avoid sharing the token, and you can't avoid sharing the
>> > private
>> > keys used for signing either. If they are single use, you don't lose
>> > anything by sharing them.
>>
>> Forwarding the PoP request would be a way to avoid sharing keys, as
>> suggested above.
>>
>> >
>> > Also you are not creating a real transaction. Why does the OP_RETURN
>> > limitation matter?
>>
>> This was discussed in the beginning of this thread: "The idea is to
>> simplify implementation. Existing software can be used as is to sign
>> and validate PoPs"
>>
>> Regards,
>> Kalle
>>
>> >
>> > On Jun 16, 2015 9:22 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>> >>
>> >> Thank you for your comments Pieter! Please find my answers below.
>> >>
>> >> 2015-06-16 16:31 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
>> >> > On Mon, Jun 15, 2015 at 1:59 PM, Kalle Rosenbaum <kalle@rosenbaum.se>
>> >> > wrote:
>> >> >>
>> >> >> 2015-06-15 12:00 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
>> >> >> I'm not sure if we will be able to support PoP with CoinJoin. Maybe
>> >> >> someone with more insight into CoinJoin have some input?
>> >> >
>> >> >
>> >> > Not really. The problem is that you assume a transaction corresponds
>> >> > to
>> >> > a
>> >> > single payment. This is true for simple wallet use cases, but not
>> >> > compatible
>> >> > with CoinJoin, or with systems that for example would want to combine
>> >> > multiple payments in a single transaction.
>> >> >
>> >>
>> >> Yes, you are right. It's not compatible with CoinJoin and the likes.
>> >>
>> >> >
>> >> > 48 bits seems low to me, but it does indeed solve the problem. Why
>> >> > not
>> >> > 128
>> >> > or 256 bits?
>> >>
>> >> The nonce is limited because of the OP_RETURN output being limited to
>> >> 40 bytes of data: 2 bytes version, 32 bytes txid, 6 bytes nonce.
>> >>
>> >> >
>> >> >> > Why does anyone care who paid? This is like walking into a
>> >> >> > coffeshop,
>> >> >> > noticing I don't have money with me, let me friend pay for me, and
>> >> >> > then
>> >> >> > have
>> >> >> > the shop insist that I can't drink it because I'm not the buyer.
>> >> >>
>> >> >> If you pay as you use the service (ie pay for coffee upfront),
>> >> >> there's
>> >> >> no need for PoP. Please see the Motivation section. But you are
>> >> >> right
>> >> >> that you must have the wallet(s) that paid at hand when you issue a
>> >> >> PoP.
>> >> >>
>> >> >> >
>> >> >> > Track payments, don't try to assign identities to payers.
>> >> >>
>> >> >> Please elaborate, I don't understand what you mean here.
>> >> >
>> >> >
>> >> > I think that is a mistake. You should not assume that the wallet who
>> >> > held
>> >> > the coins is the payer/buyer. That's what I said earlier; you're
>> >> > implicitly
>> >> > creating an identity (the one who holds these keys) based on the
>> >> > transaction. This seems fundamentally wrong to me, and not necessary.
>> >> > The
>> >> > receiver should not care who paid or how, he should care what was
>> >> > payed
>> >> > for.
>> >>
>> >> You are saying that it's a problem that the wallet used to pay, must
>> >> also be used to issue the PoP? That may very well be a problem in some
>> >> cases. People using PoP should of course be aware of it's limitations
>> >> and act accordingly, i.e. don't pay for concert tickets for a friend
>> >> and expect your friend to be able to enter the arena with her wallet.
>> >> As Tom Harding noted, it is possible to transfer keys to your friend's
>> >> wallet, but that might not be desirable if those keys are also used
>> >> for other payments. Also that would weaken the security of an HD
>> >> wallet, since a chain code along with a private key would reveal all
>> >> keys in that tree. Another solution is that your friend forwards the
>> >> PoP request to your wallet, through twitter or SMS, and you send the
>> >> PoP for her. Maybe that forwarding mechanism can be built into wallets
>> >> and automated so that the wallet automatically suggests to sign the
>> >> PoP for your friend. This is probably something to investigate
>> >> further, but not within the scope of this BIP.
>> >>
>> >> Of course the simplest solution would be to send money to your friend
>> >> first so that she can pay for the ticket from her own wallet, but
>> >> that's not always feasible.
>> >>
>> >> >
>> >> > The easiest solution to this IMHO would be an extension to the
>> >> > payment
>> >> > protocol that gives you (or your wallet) a token in return for
>> >> > paying,
>> >> > and
>> >> > that knowledge of that token is used to gain access to the services
>> >> > you
>> >> > provide.
>> >> >
>> >>
>> >> That token would then be reusable. Someone stealing it would be able
>> >> to use it as much as she wants. That is what I want to avoid with PoP.
>> >> The BIP proposal briefly mentions something like this in the
>> >> rationale. I also had a discussion about this with Mike Hearn on this
>> >> list on Mars 13 that I think covers most pros and cons of the
>> >> different approaches.
>> >>
>> >> While your suggestion does indeed separate the transaction from the
>> >> proof of payment, it also assumes that the token is held in the wallet
>> >> that pays. Otherwise you would need to keep it in another safe place,
>> >> remember it's reusable. Where would that be? How would you transfer
>> >> that token to your friend?
>> >>
>> >> Thank you again for your comments. I appreciate it.
>> >>
>> >> Best regards,
>> >> Kalle
>> >>
>> >> > --
>> >> > Pieter
>> >> >



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [Bitcoin-development] BIP for Proof of Payment
  2015-06-17  9:51                               ` Kalle Rosenbaum
@ 2015-06-21 14:39                                 ` Kalle Rosenbaum
       [not found]                                   ` <CAPswA9w8QaWV72UuGnitWWeDTr5MPKvzwrD5udmq_FQke-NGAQ@mail.gmail.com>
       [not found]                                 ` <CABm2gDrickFojwmUi7GqAhSW5K0yTa_59VjKrY+wAXEq1MYUoA@mail.gmail.com>
  1 sibling, 1 reply; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-06-21 14:39 UTC (permalink / raw)
  To: Greg Maxwell; +Cc: Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 9635 bytes --]

Hi Greg!

After a lot of constructive discussion, feedback and updating, I'm
requesting that you please assign these proposals BIP numbers. It's both
the "Proof of Payment" proposal and the "Proof of Payment URI scheme"
proposal that I'm referring to.

The wikimedia source is available here:
https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP and
https://github.com/kallerosenbaum/poppoc/wiki/btcpop-scheme-BIP.

Is this what you need in order to proceed or is there something else you
need from me?

Best regards,
/Kalle

2015-06-17 11:51 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:

> 2015-06-16 21:48 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> > I don't see why existing software could create a 40-byte OP_RETURN but
> not
> > larger? The limitation comes from a relay policy in full nodes, not a
> > limitation is wallet software... and PoPs are not relayed on the network.
>
> You are probably right here. The thing is that I don't know how *all*
> wallet signing and validating software is written, so I figure it's
> better to stick to a "valid" output. Since I don't *need* more data
> than 40 bytes, why bother. There's another constraint to this as well:
> The other BIP proposal, "Proof of Payment URI scheme", includes a
> nonce parameter in the URI. If the nonce is very long, the QR code
> will be unnecessarily big. The server should try to detect a brute
> force of the 48 bit nonce, or at least delay the pop requests by some
> 100 ms or so.
>
> Do you think this is an actual problem, and why? Is your suggestion to
> use a bigger nonce, given the above?
>
> >
> > Regarding sharing, I think you're talking about a different use case. Say
> > you want to pay for 1-week valid entrance to some venue. I thought the
> > purpose of the PoP was to be sure that only the person who paid for it,
> and
> > not anyone else can use it during that week.
> >
>
> That's right. That's one use case. You pay for the 1-week entrance and
> then you use your wallet to sign PoPs when you enter the venue.
>
> > My argument against that is that the original payer can also hand the
> > private keys in his wallet to someone else, who would then become able to
> > create PoPs for the service. He does not lose anything by this, assuming
> the
> > address is not reused.
> >
>
> Yes, that is possible. It's about the same as giving out a
> username/password for a service that you have paid for. In the case of
> a concert ticket, it's simple. Just allow one entrance per payment.
> But in the example you gave, it's a bit more complicated. You could
> for example give all guests a bracelet upon first entry or upon first
> exit. Or you can put a stamp on people leaving the venue, and demand
> that all re-entries show the stamp, possibly along with a new PoP.
> Pretty much as is done already. Different use cases will need
> different protection. In this example, the value added by PoP is that
> the venue does not have to distribute tickets in advance. This in turn
> allows for better privacy for the customer, who don't have to give out
> personal information such as an email-address.
>
> > So, using a token does not change anything, except it can be provided to
> the
> > payer - instead of relying on creating an implicit identity based on who
> > seems to have held particular private keys in the past.
> >
>
> Yes, that's a difference, but it comes at the cost of security. The
> stolen token can be used over and over. In the case of PoP it's only
> usable once, and it's only created when it's actually needed,
> minimizing the window of opportunity for the thief.
>
> Regards,
> Kalle
>
> > On Jun 16, 2015 9:41 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
> >>
> >> 2015-06-16 21:25 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> >> > You can't avoid sharing the token, and you can't avoid sharing the
> >> > private
> >> > keys used for signing either. If they are single use, you don't lose
> >> > anything by sharing them.
> >>
> >> Forwarding the PoP request would be a way to avoid sharing keys, as
> >> suggested above.
> >>
> >> >
> >> > Also you are not creating a real transaction. Why does the OP_RETURN
> >> > limitation matter?
> >>
> >> This was discussed in the beginning of this thread: "The idea is to
> >> simplify implementation. Existing software can be used as is to sign
> >> and validate PoPs"
> >>
> >> Regards,
> >> Kalle
> >>
> >> >
> >> > On Jun 16, 2015 9:22 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se>
> wrote:
> >> >>
> >> >> Thank you for your comments Pieter! Please find my answers below.
> >> >>
> >> >> 2015-06-16 16:31 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
> >> >> > On Mon, Jun 15, 2015 at 1:59 PM, Kalle Rosenbaum <
> kalle@rosenbaum.se>
> >> >> > wrote:
> >> >> >>
> >> >> >> 2015-06-15 12:00 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com
> >:
> >> >> >> I'm not sure if we will be able to support PoP with CoinJoin.
> Maybe
> >> >> >> someone with more insight into CoinJoin have some input?
> >> >> >
> >> >> >
> >> >> > Not really. The problem is that you assume a transaction
> corresponds
> >> >> > to
> >> >> > a
> >> >> > single payment. This is true for simple wallet use cases, but not
> >> >> > compatible
> >> >> > with CoinJoin, or with systems that for example would want to
> combine
> >> >> > multiple payments in a single transaction.
> >> >> >
> >> >>
> >> >> Yes, you are right. It's not compatible with CoinJoin and the likes.
> >> >>
> >> >> >
> >> >> > 48 bits seems low to me, but it does indeed solve the problem. Why
> >> >> > not
> >> >> > 128
> >> >> > or 256 bits?
> >> >>
> >> >> The nonce is limited because of the OP_RETURN output being limited to
> >> >> 40 bytes of data: 2 bytes version, 32 bytes txid, 6 bytes nonce.
> >> >>
> >> >> >
> >> >> >> > Why does anyone care who paid? This is like walking into a
> >> >> >> > coffeshop,
> >> >> >> > noticing I don't have money with me, let me friend pay for me,
> and
> >> >> >> > then
> >> >> >> > have
> >> >> >> > the shop insist that I can't drink it because I'm not the buyer.
> >> >> >>
> >> >> >> If you pay as you use the service (ie pay for coffee upfront),
> >> >> >> there's
> >> >> >> no need for PoP. Please see the Motivation section. But you are
> >> >> >> right
> >> >> >> that you must have the wallet(s) that paid at hand when you issue
> a
> >> >> >> PoP.
> >> >> >>
> >> >> >> >
> >> >> >> > Track payments, don't try to assign identities to payers.
> >> >> >>
> >> >> >> Please elaborate, I don't understand what you mean here.
> >> >> >
> >> >> >
> >> >> > I think that is a mistake. You should not assume that the wallet
> who
> >> >> > held
> >> >> > the coins is the payer/buyer. That's what I said earlier; you're
> >> >> > implicitly
> >> >> > creating an identity (the one who holds these keys) based on the
> >> >> > transaction. This seems fundamentally wrong to me, and not
> necessary.
> >> >> > The
> >> >> > receiver should not care who paid or how, he should care what was
> >> >> > payed
> >> >> > for.
> >> >>
> >> >> You are saying that it's a problem that the wallet used to pay, must
> >> >> also be used to issue the PoP? That may very well be a problem in
> some
> >> >> cases. People using PoP should of course be aware of it's limitations
> >> >> and act accordingly, i.e. don't pay for concert tickets for a friend
> >> >> and expect your friend to be able to enter the arena with her wallet.
> >> >> As Tom Harding noted, it is possible to transfer keys to your
> friend's
> >> >> wallet, but that might not be desirable if those keys are also used
> >> >> for other payments. Also that would weaken the security of an HD
> >> >> wallet, since a chain code along with a private key would reveal all
> >> >> keys in that tree. Another solution is that your friend forwards the
> >> >> PoP request to your wallet, through twitter or SMS, and you send the
> >> >> PoP for her. Maybe that forwarding mechanism can be built into
> wallets
> >> >> and automated so that the wallet automatically suggests to sign the
> >> >> PoP for your friend. This is probably something to investigate
> >> >> further, but not within the scope of this BIP.
> >> >>
> >> >> Of course the simplest solution would be to send money to your friend
> >> >> first so that she can pay for the ticket from her own wallet, but
> >> >> that's not always feasible.
> >> >>
> >> >> >
> >> >> > The easiest solution to this IMHO would be an extension to the
> >> >> > payment
> >> >> > protocol that gives you (or your wallet) a token in return for
> >> >> > paying,
> >> >> > and
> >> >> > that knowledge of that token is used to gain access to the services
> >> >> > you
> >> >> > provide.
> >> >> >
> >> >>
> >> >> That token would then be reusable. Someone stealing it would be able
> >> >> to use it as much as she wants. That is what I want to avoid with
> PoP.
> >> >> The BIP proposal briefly mentions something like this in the
> >> >> rationale. I also had a discussion about this with Mike Hearn on this
> >> >> list on Mars 13 that I think covers most pros and cons of the
> >> >> different approaches.
> >> >>
> >> >> While your suggestion does indeed separate the transaction from the
> >> >> proof of payment, it also assumes that the token is held in the
> wallet
> >> >> that pays. Otherwise you would need to keep it in another safe place,
> >> >> remember it's reusable. Where would that be? How would you transfer
> >> >> that token to your friend?
> >> >>
> >> >> Thank you again for your comments. I appreciate it.
> >> >>
> >> >> Best regards,
> >> >> Kalle
> >> >>
> >> >> > --
> >> >> > Pieter
> >> >> >
>

[-- Attachment #2: Type: text/html, Size: 13307 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [bitcoin-dev] [Bitcoin-development] BIP for Proof of Payment
       [not found]                                   ` <CAPswA9w8QaWV72UuGnitWWeDTr5MPKvzwrD5udmq_FQke-NGAQ@mail.gmail.com>
@ 2015-07-24  6:55                                     ` Kalle Rosenbaum
  2015-07-27  8:14                                       ` Sriram Karra
  0 siblings, 1 reply; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-07-24  6:55 UTC (permalink / raw)
  To: bitcoin-dev

[-- Attachment #1: Type: text/plain, Size: 10600 bytes --]

These BIPs have been assigned 120 and 121:

120: Proof of Payment
121: Proof of Payment URI scheme

Regards,
Kalle
Den 24 jul 2015 08:27 skrev "Kalle Rosenbaum" <kalle@rosenbaum.se>:

> These BIPs have been assigned 120 and 121:
>
> 120: Proof of Payment
> 121: Proof of Payment URI scheme
>
> Regards,
> Kalle
> Den 21 jun 2015 16:39 skrev "Kalle Rosenbaum" <kalle@rosenbaum.se>:
>
>> Hi Greg!
>>
>> After a lot of constructive discussion, feedback and updating, I'm
>> requesting that you please assign these proposals BIP numbers. It's both
>> the "Proof of Payment" proposal and the "Proof of Payment URI scheme"
>> proposal that I'm referring to.
>>
>> The wikimedia source is available here:
>> https://github.com/kallerosenbaum/poppoc/wiki/Proof-of-Payment-BIP and
>> https://github.com/kallerosenbaum/poppoc/wiki/btcpop-scheme-BIP.
>>
>> Is this what you need in order to proceed or is there something else you
>> need from me?
>>
>> Best regards,
>> /Kalle
>>
>> 2015-06-17 11:51 GMT+02:00 Kalle Rosenbaum <kalle@rosenbaum.se>:
>>
>>> 2015-06-16 21:48 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
>>> > I don't see why existing software could create a 40-byte OP_RETURN but
>>> not
>>> > larger? The limitation comes from a relay policy in full nodes, not a
>>> > limitation is wallet software... and PoPs are not relayed on the
>>> network.
>>>
>>> You are probably right here. The thing is that I don't know how *all*
>>> wallet signing and validating software is written, so I figure it's
>>> better to stick to a "valid" output. Since I don't *need* more data
>>> than 40 bytes, why bother. There's another constraint to this as well:
>>> The other BIP proposal, "Proof of Payment URI scheme", includes a
>>> nonce parameter in the URI. If the nonce is very long, the QR code
>>> will be unnecessarily big. The server should try to detect a brute
>>> force of the 48 bit nonce, or at least delay the pop requests by some
>>> 100 ms or so.
>>>
>>> Do you think this is an actual problem, and why? Is your suggestion to
>>> use a bigger nonce, given the above?
>>>
>>> >
>>> > Regarding sharing, I think you're talking about a different use case.
>>> Say
>>> > you want to pay for 1-week valid entrance to some venue. I thought the
>>> > purpose of the PoP was to be sure that only the person who paid for
>>> it, and
>>> > not anyone else can use it during that week.
>>> >
>>>
>>> That's right. That's one use case. You pay for the 1-week entrance and
>>> then you use your wallet to sign PoPs when you enter the venue.
>>>
>>> > My argument against that is that the original payer can also hand the
>>> > private keys in his wallet to someone else, who would then become able
>>> to
>>> > create PoPs for the service. He does not lose anything by this,
>>> assuming the
>>> > address is not reused.
>>> >
>>>
>>> Yes, that is possible. It's about the same as giving out a
>>> username/password for a service that you have paid for. In the case of
>>> a concert ticket, it's simple. Just allow one entrance per payment.
>>> But in the example you gave, it's a bit more complicated. You could
>>> for example give all guests a bracelet upon first entry or upon first
>>> exit. Or you can put a stamp on people leaving the venue, and demand
>>> that all re-entries show the stamp, possibly along with a new PoP.
>>> Pretty much as is done already. Different use cases will need
>>> different protection. In this example, the value added by PoP is that
>>> the venue does not have to distribute tickets in advance. This in turn
>>> allows for better privacy for the customer, who don't have to give out
>>> personal information such as an email-address.
>>>
>>> > So, using a token does not change anything, except it can be provided
>>> to the
>>> > payer - instead of relying on creating an implicit identity based on
>>> who
>>> > seems to have held particular private keys in the past.
>>> >
>>>
>>> Yes, that's a difference, but it comes at the cost of security. The
>>> stolen token can be used over and over. In the case of PoP it's only
>>> usable once, and it's only created when it's actually needed,
>>> minimizing the window of opportunity for the thief.
>>>
>>> Regards,
>>> Kalle
>>>
>>> > On Jun 16, 2015 9:41 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
>>> >>
>>> >> 2015-06-16 21:25 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com>:
>>> >> > You can't avoid sharing the token, and you can't avoid sharing the
>>> >> > private
>>> >> > keys used for signing either. If they are single use, you don't lose
>>> >> > anything by sharing them.
>>> >>
>>> >> Forwarding the PoP request would be a way to avoid sharing keys, as
>>> >> suggested above.
>>> >>
>>> >> >
>>> >> > Also you are not creating a real transaction. Why does the OP_RETURN
>>> >> > limitation matter?
>>> >>
>>> >> This was discussed in the beginning of this thread: "The idea is to
>>> >> simplify implementation. Existing software can be used as is to sign
>>> >> and validate PoPs"
>>> >>
>>> >> Regards,
>>> >> Kalle
>>> >>
>>> >> >
>>> >> > On Jun 16, 2015 9:22 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se>
>>> wrote:
>>> >> >>
>>> >> >> Thank you for your comments Pieter! Please find my answers below.
>>> >> >>
>>> >> >> 2015-06-16 16:31 GMT+02:00 Pieter Wuille <pieter.wuille@gmail.com
>>> >:
>>> >> >> > On Mon, Jun 15, 2015 at 1:59 PM, Kalle Rosenbaum <
>>> kalle@rosenbaum.se>
>>> >> >> > wrote:
>>> >> >> >>
>>> >> >> >> 2015-06-15 12:00 GMT+02:00 Pieter Wuille <
>>> pieter.wuille@gmail.com>:
>>> >> >> >> I'm not sure if we will be able to support PoP with CoinJoin.
>>> Maybe
>>> >> >> >> someone with more insight into CoinJoin have some input?
>>> >> >> >
>>> >> >> >
>>> >> >> > Not really. The problem is that you assume a transaction
>>> corresponds
>>> >> >> > to
>>> >> >> > a
>>> >> >> > single payment. This is true for simple wallet use cases, but not
>>> >> >> > compatible
>>> >> >> > with CoinJoin, or with systems that for example would want to
>>> combine
>>> >> >> > multiple payments in a single transaction.
>>> >> >> >
>>> >> >>
>>> >> >> Yes, you are right. It's not compatible with CoinJoin and the
>>> likes.
>>> >> >>
>>> >> >> >
>>> >> >> > 48 bits seems low to me, but it does indeed solve the problem.
>>> Why
>>> >> >> > not
>>> >> >> > 128
>>> >> >> > or 256 bits?
>>> >> >>
>>> >> >> The nonce is limited because of the OP_RETURN output being limited
>>> to
>>> >> >> 40 bytes of data: 2 bytes version, 32 bytes txid, 6 bytes nonce.
>>> >> >>
>>> >> >> >
>>> >> >> >> > Why does anyone care who paid? This is like walking into a
>>> >> >> >> > coffeshop,
>>> >> >> >> > noticing I don't have money with me, let me friend pay for
>>> me, and
>>> >> >> >> > then
>>> >> >> >> > have
>>> >> >> >> > the shop insist that I can't drink it because I'm not the
>>> buyer.
>>> >> >> >>
>>> >> >> >> If you pay as you use the service (ie pay for coffee upfront),
>>> >> >> >> there's
>>> >> >> >> no need for PoP. Please see the Motivation section. But you are
>>> >> >> >> right
>>> >> >> >> that you must have the wallet(s) that paid at hand when you
>>> issue a
>>> >> >> >> PoP.
>>> >> >> >>
>>> >> >> >> >
>>> >> >> >> > Track payments, don't try to assign identities to payers.
>>> >> >> >>
>>> >> >> >> Please elaborate, I don't understand what you mean here.
>>> >> >> >
>>> >> >> >
>>> >> >> > I think that is a mistake. You should not assume that the wallet
>>> who
>>> >> >> > held
>>> >> >> > the coins is the payer/buyer. That's what I said earlier; you're
>>> >> >> > implicitly
>>> >> >> > creating an identity (the one who holds these keys) based on the
>>> >> >> > transaction. This seems fundamentally wrong to me, and not
>>> necessary.
>>> >> >> > The
>>> >> >> > receiver should not care who paid or how, he should care what was
>>> >> >> > payed
>>> >> >> > for.
>>> >> >>
>>> >> >> You are saying that it's a problem that the wallet used to pay,
>>> must
>>> >> >> also be used to issue the PoP? That may very well be a problem in
>>> some
>>> >> >> cases. People using PoP should of course be aware of it's
>>> limitations
>>> >> >> and act accordingly, i.e. don't pay for concert tickets for a
>>> friend
>>> >> >> and expect your friend to be able to enter the arena with her
>>> wallet.
>>> >> >> As Tom Harding noted, it is possible to transfer keys to your
>>> friend's
>>> >> >> wallet, but that might not be desirable if those keys are also used
>>> >> >> for other payments. Also that would weaken the security of an HD
>>> >> >> wallet, since a chain code along with a private key would reveal
>>> all
>>> >> >> keys in that tree. Another solution is that your friend forwards
>>> the
>>> >> >> PoP request to your wallet, through twitter or SMS, and you send
>>> the
>>> >> >> PoP for her. Maybe that forwarding mechanism can be built into
>>> wallets
>>> >> >> and automated so that the wallet automatically suggests to sign the
>>> >> >> PoP for your friend. This is probably something to investigate
>>> >> >> further, but not within the scope of this BIP.
>>> >> >>
>>> >> >> Of course the simplest solution would be to send money to your
>>> friend
>>> >> >> first so that she can pay for the ticket from her own wallet, but
>>> >> >> that's not always feasible.
>>> >> >>
>>> >> >> >
>>> >> >> > The easiest solution to this IMHO would be an extension to the
>>> >> >> > payment
>>> >> >> > protocol that gives you (or your wallet) a token in return for
>>> >> >> > paying,
>>> >> >> > and
>>> >> >> > that knowledge of that token is used to gain access to the
>>> services
>>> >> >> > you
>>> >> >> > provide.
>>> >> >> >
>>> >> >>
>>> >> >> That token would then be reusable. Someone stealing it would be
>>> able
>>> >> >> to use it as much as she wants. That is what I want to avoid with
>>> PoP.
>>> >> >> The BIP proposal briefly mentions something like this in the
>>> >> >> rationale. I also had a discussion about this with Mike Hearn on
>>> this
>>> >> >> list on Mars 13 that I think covers most pros and cons of the
>>> >> >> different approaches.
>>> >> >>
>>> >> >> While your suggestion does indeed separate the transaction from the
>>> >> >> proof of payment, it also assumes that the token is held in the
>>> wallet
>>> >> >> that pays. Otherwise you would need to keep it in another safe
>>> place,
>>> >> >> remember it's reusable. Where would that be? How would you transfer
>>> >> >> that token to your friend?
>>> >> >>
>>> >> >> Thank you again for your comments. I appreciate it.
>>> >> >>
>>> >> >> Best regards,
>>> >> >> Kalle
>>> >> >>
>>> >> >> > --
>>> >> >> > Pieter
>>> >> >> >
>>>
>>
>>

[-- Attachment #2: Type: text/html, Size: 14354 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [bitcoin-dev] [Bitcoin-development] BIP for Proof of Payment
       [not found]                                 ` <CABm2gDrickFojwmUi7GqAhSW5K0yTa_59VjKrY+wAXEq1MYUoA@mail.gmail.com>
@ 2015-07-26 21:13                                   ` Kalle Rosenbaum
  2015-07-27  9:08                                     ` Jorge Timón
  0 siblings, 1 reply; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-07-26 21:13 UTC (permalink / raw)
  To: Jorge Timón; +Cc: bitcoin-dev

(Resending to the new bitcoin-dev list after sending to the old list)

2015-07-25 21:34 GMT+02:00 Jorge Timón <jtimon@jtimon.cc>:
> Then why do you assume they have a policy limit that not even bitcoin core
> itself maintains (the default limit was moved from 42 to 83 [counting the
> op_return and pushes])?
>
> The policy check is not a consensus rule. Other implementations may have
> another default or not have a limit at all.

Thank you for pointing this out.

That's right. Bitcoin core now support 80 bytes data by default. And
yes, I was wrong in assuming 40 bytes policy in all implementations,
even if 40 bytes was the limit in bitcoin core at the time of writing
the BIP.

If there's a need to increase the size of the nonce, for example to
128 bits instead of the 48 bits as designed in BIP 120, then we can of
course do that, either now or in a subsequent version of PoP.

As noted before though, a longer nonce also means bigger QR codes
generated from the BIP 121 URIs. So I think that 48 bits is a good
tradeoff right now. And as stated in BIP120, a server generating PoP
requests should try to detect brute force attacks, or at least delay
the response (containing the nonce) by some 100 ms or so.

Do you think we need a bigger nonce? In that case, why?

If PoP later becomes an extension of BIP70, then there is no such size
constraint on the nonce, since it will be part of some kind of (e.g.)
PopRequest message and not contained in a QR encoded URI.

/Kalle


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [bitcoin-dev] [Bitcoin-development] BIP for Proof of Payment
  2015-07-24  6:55                                     ` [bitcoin-dev] " Kalle Rosenbaum
@ 2015-07-27  8:14                                       ` Sriram Karra
  0 siblings, 0 replies; 32+ messages in thread
From: Sriram Karra @ 2015-07-27  8:14 UTC (permalink / raw)
  To: Kalle Rosenbaum; +Cc: bitcoin-dev

[-- Attachment #1: Type: text/plain, Size: 288 bytes --]

On Fri, Jul 24, 2015 at 12:25 PM, Kalle Rosenbaum via bitcoin-dev <
bitcoin-dev@lists.linuxfoundation.org> wrote:

> These BIPs have been assigned 120 and 121:
>
Did you break open the bubbly? From the outside it certainly looked harder
than everything else about this proposal combined.

[-- Attachment #2: Type: text/html, Size: 623 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [bitcoin-dev] [Bitcoin-development] BIP for Proof of Payment
  2015-07-26 21:13                                   ` Kalle Rosenbaum
@ 2015-07-27  9:08                                     ` Jorge Timón
  2015-07-27 11:21                                       ` Kalle Rosenbaum
  0 siblings, 1 reply; 32+ messages in thread
From: Jorge Timón @ 2015-07-27  9:08 UTC (permalink / raw)
  To: Kalle Rosenbaum; +Cc: bitcoin-dev

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

On Jul 26, 2015 11:13 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
> Do you think we need a bigger nonce? In that case, why?

I don't know, it wasn't me that proposed a bigger nonce. I just wanted to
point out that the policy limit shouldn't be a concern.

[-- Attachment #2: Type: text/html, Size: 374 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [bitcoin-dev] [Bitcoin-development] BIP for Proof of Payment
  2015-07-27  9:08                                     ` Jorge Timón
@ 2015-07-27 11:21                                       ` Kalle Rosenbaum
  0 siblings, 0 replies; 32+ messages in thread
From: Kalle Rosenbaum @ 2015-07-27 11:21 UTC (permalink / raw)
  To: Jorge Timón; +Cc: bitcoin-dev

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

Ok, Thanks
Den 27 jul 2015 11:08 skrev "Jorge Timón" <jtimon@jtimon.cc>:

>
> On Jul 26, 2015 11:13 PM, "Kalle Rosenbaum" <kalle@rosenbaum.se> wrote:
> > Do you think we need a bigger nonce? In that case, why?
>
> I don't know, it wasn't me that proposed a bigger nonce. I just wanted to
> point out that the policy limit shouldn't be a concern.
>

[-- Attachment #2: Type: text/html, Size: 673 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2015-07-27 11:21 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-06 14:35 [Bitcoin-development] BIP for Proof of Payment Kalle Rosenbaum
2015-06-06 14:47 ` Pieter Wuille
2015-06-06 15:05   ` Kalle Rosenbaum
2015-06-06 15:13     ` Pieter Wuille
2015-06-06 16:20       ` Kalle Rosenbaum
2015-06-06 16:10     ` Tom Harding
2015-06-06 17:00       ` Kalle Rosenbaum
2015-06-06 21:25         ` Kalle Rosenbaum
2015-06-06 22:01           ` Luke Dashjr
2015-06-15  9:21           ` Kalle Rosenbaum
     [not found]             ` <CAPg+sBiWykR6RaHhbyYQbL=A5t1TmHgEmS_sC7jj9d3SUTMO9g@mail.gmail.com>
     [not found]               ` <CAPswA9zycU0pwZKaHU9J3Tvg=ovLJ8TZ9OH6ebTPONaRaiOE8g@mail.gmail.com>
2015-06-15 10:00                 ` Pieter Wuille
2015-06-15 11:59                   ` Kalle Rosenbaum
2015-06-16 14:31                     ` Pieter Wuille
2015-06-16 19:22                       ` Kalle Rosenbaum
2015-06-16 19:25                         ` Pieter Wuille
     [not found]                           ` <CAPswA9yFUAqFyNBFBnnwpT=B9RcdNssdjz-_KWbX5GuLM5Uyxw@mail.gmail.com>
2015-06-16 19:48                             ` Pieter Wuille
2015-06-17  9:51                               ` Kalle Rosenbaum
2015-06-21 14:39                                 ` Kalle Rosenbaum
     [not found]                                   ` <CAPswA9w8QaWV72UuGnitWWeDTr5MPKvzwrD5udmq_FQke-NGAQ@mail.gmail.com>
2015-07-24  6:55                                     ` [bitcoin-dev] " Kalle Rosenbaum
2015-07-27  8:14                                       ` Sriram Karra
     [not found]                                 ` <CABm2gDrickFojwmUi7GqAhSW5K0yTa_59VjKrY+wAXEq1MYUoA@mail.gmail.com>
2015-07-26 21:13                                   ` Kalle Rosenbaum
2015-07-27  9:08                                     ` Jorge Timón
2015-07-27 11:21                                       ` Kalle Rosenbaum
2015-06-16  5:26                   ` Tom Harding
2015-06-16 12:12                     ` Kalle Rosenbaum
2015-06-16 12:31                       ` Kalle Rosenbaum
2015-06-16 14:05                       ` Tom Harding
2015-06-16 16:22                         ` Kalle Rosenbaum
2015-06-06 15:18 ` Luke Dashjr
2015-06-06 15:23   ` Pieter Wuille
2015-06-06 15:32     ` Peter Todd
2015-06-06 16:35       ` Kalle Rosenbaum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox