Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-17 Thread Kalle Rosenbaum
2015-06-16 21:48 GMT+02:00 Pieter Wuille pieter.wui...@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 ka...@rosenbaum.se wrote:

 2015-06-16 21:25 GMT+02:00 Pieter Wuille pieter.wui...@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 ka...@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.wui...@gmail.com:
   On Mon, Jun 15, 2015 at 1:59 PM, Kalle Rosenbaum ka...@rosenbaum.se
   wrote:
  
   2015-06-15 12:00 GMT+02:00 Pieter Wuille pieter.wui...@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 

Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-16 Thread Kalle Rosenbaum
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 ka...@rosenbaum.se:
 2015-06-16 7:26 GMT+02:00 Tom Harding t...@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 ka...@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.wui...@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 ka...@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 4 (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 ka...@rosenbaum.se
Status: Draft
Type: Standards Track
Created: date created on, in ISO 8601 (-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 

Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-16 Thread Kalle Rosenbaum
Thank you for the clarification Tom!

/Kalle

2015-06-16 16:05 GMT+02:00 Tom Harding t...@thinlink.com:
 On 6/16/2015 5:12 AM, Kalle Rosenbaum wrote:
 2015-06-16 7:26 GMT+02:00 Tom Harding t...@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.



--
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-16 Thread Pieter Wuille
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 ka...@rosenbaum.se wrote:

 2015-06-16 21:25 GMT+02:00 Pieter Wuille pieter.wui...@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 ka...@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.wui...@gmail.com:
   On Mon, Jun 15, 2015 at 1:59 PM, Kalle Rosenbaum ka...@rosenbaum.se
   wrote:
  
   2015-06-15 12:00 GMT+02:00 Pieter Wuille pieter.wui...@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 

Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-15 Thread Pieter Wuille
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 ka...@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.wui...@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 ka...@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 4 (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 ka...@rosenbaum.se
Status: Draft
Type: Standards Track
Created: date created on, in ISO 8601 (-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 

Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-15 Thread Tom Harding

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 ka...@rosenbaum.se
 mailto:ka...@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.wui...@gmail.com
 mailto:pieter.wui...@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 ka...@rosenbaum.se
 mailto:ka...@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 4 (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 ka...@rosenbaum.se
 mailto:ka...@rosenbaum.se
Status: Draft
Type: Standards Track
Created: date created on, in ISO 8601 (-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 

Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-06 Thread Pieter Wuille
On Sat, Jun 6, 2015 at 5:05 PM, Kalle Rosenbaum ka...@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
--
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-06 Thread Pieter Wuille
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 ka...@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 ka...@rosenbaum.se
   Status: Draft
   Type: Standards Track
   Created: date created on, in ISO 8601 (-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  |
  

Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-06 Thread Kalle Rosenbaum
 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


--
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-06 Thread Luke Dashjr
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

--
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-06 Thread Pieter Wuille
On Sat, Jun 6, 2015 at 5:18 PM, Luke Dashjr l...@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
--
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-06 Thread Tom Harding
On Jun 6, 2015 8:05 AM, Kalle Rosenbaum ka...@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
--
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development


Re: [Bitcoin-development] BIP for Proof of Payment

2015-06-06 Thread Luke Dashjr
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

--
___
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development