Bitcoin Forum
November 12, 2024, 11:59:24 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: New Address Message Validation / Expose Public Key via GUI  (Read 1052 times)
bytemaster (OP)
Hero Member
*****
Offline Offline

Activity: 770
Merit: 568

fractally


View Profile WWW
August 29, 2012, 02:16:36 AM
 #1

I want to create a service that gives credibility to users based upon a balance they maintain in a specific BTC address.   Namely, I don't want to require users to deposite money with me, I just need to prove that they 'own' BTC somewhere.

I would ask users to 'create a new address' and then sign "Map address XXXX to account USERNAME". 

In order for this process to work, I need the user to provide me both the PUBLIC KEY and the SIGNATURE because until they spend money from that address, I have no way of getting the public key from the network and therefore am unable to validate the message.

Unfortunately, the GUI only gives me the signature.   

I could add the 'public key' as an additional field and submit a pull request, but would like to know if there is any reason why the GUI does not expose the public key?


https://fractally.com - the next generation of decentralized autonomous organizations (DAOs).
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4270
Merit: 8805



View Profile WWW
August 29, 2012, 02:21:08 AM
 #2

In order for this process to work, I need the user to provide me both the PUBLIC KEY and the SIGNATURE because until they spend money from that address, I have no way of getting the public key from the network and therefore am unable to validate the message.
Unfortunately, the GUI only gives me the signature.   
I could add the 'public key' as an additional field and submit a pull request, but would like to know if there is any reason why the GUI does not expose the public key?
You do not need the public key.
You only need to know the signature, the message being signed, and the address that you're going to compare it to.
bytemaster (OP)
Hero Member
*****
Offline Offline

Activity: 770
Merit: 568

fractally


View Profile WWW
August 29, 2012, 02:24:18 AM
 #3

It was my understanding that until coins are spent from an address the public key does not exist in the block chain. 

If the public key is published upon receiving money to an address, then I could see it working for any address with non-0 balance.

https://fractally.com - the next generation of decentralized autonomous organizations (DAOs).
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
August 29, 2012, 02:27:50 AM
 #4

In order for this process to work, I need the user to provide me both the PUBLIC KEY and the SIGNATURE because until they spend money from that address, I have no way of getting the public key from the network and therefore am unable to validate the message.
Unfortunately, the GUI only gives me the signature.   
I could add the 'public key' as an additional field and submit a pull request, but would like to know if there is any reason why the GUI does not expose the public key?
You do not need the public key.
You only need to know the signature, the message being signed, and the address that you're going to compare it to.

Since it is signed with the private key wouldn't he need to know the public key?

If the address has been used as an input for a tx the public key can be located in the blockchain but the public key is still needed right?

IF the address has not been used as an input for a tx the public key is not available in the blockchain.
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4270
Merit: 8805



View Profile WWW
August 29, 2012, 03:05:43 AM
 #5

Since it is signed with the private key wouldn't he need to know the public key?
No. Or rather he'll compute it with the information he already has.
Quote
If the address has been used as an input for a tx the public key can be located in the blockchain but the public key is still needed right?
Yes, it can. But no, it is not needed in any case.
Quote
IF the address has not been used as an input for a tx the public key is not available in the blockchain.
Correct, but irrelevant. You do not need the public key to validate the signature.

This is because Bitcoin uses public key recovery.

F'king MATHMATICS. HOW DOES IT WORK?

With the only message and the signature Bitcoin recovers the public key mathematically (technically two more bits are required than the signature, but our signatures include those two bits). The blockchain is not used.  Bitcoin then hashes the recovered public key to get the address. The address is then compared to the address you provide. The public key is not only not required, the verification interface doesn't even give you a place to provide it.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
August 29, 2012, 04:07:21 AM
 #6

Thanks gmaxwell.  We really need a "Bitcoin compendium" I learn something new everyday (ok at least once a week).
bytemaster (OP)
Hero Member
*****
Offline Offline

Activity: 770
Merit: 568

fractally


View Profile WWW
August 29, 2012, 04:23:43 AM
 #7

The public key is not only not required, the verification interface doesn't even give you a place to provide it.

I got the idea that I needed the public key from an out-moded json-rpc interface... 
I had no idea that you could recover the public key from the signature and 2 other bits of info... that is cool, thanks for sharing!

Unfortunately, I think my whole plan is fundamentally flawed as the bitcoin client gives very little control over which addresses are used when spending which combined with the fact that every spend 'spends all' of an address means that users would have to do a lot of work to use my system.
 

https://fractally.com - the next generation of decentralized autonomous organizations (DAOs).
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4270
Merit: 8805



View Profile WWW
August 29, 2012, 04:28:12 AM
 #8

Unfortunately, I think my whole plan is fundamentally flawed as the bitcoin client gives very little control over which addresses are used when spending which combined with the fact that every spend 'spends all' of an address means that users would have to do a lot of work to use my system.
I'm very interested in being able to freeze specified addresses so that they won't be used for spending. But I (and, apparently, no one else) had time to work on it before 0.7's release. I'm not sure when I'll have time to work on it.

If you'd like to work on it, it would be helpful. If you decide to do so should start with a RPC interface because the RPC/CLI/GUI-Console is generally the starting point for advanced features.
cbeast
Donator
Legendary
*
Offline Offline

Activity: 1736
Merit: 1014

Let's talk governance, lipstick, and pigs.


View Profile
August 29, 2012, 03:09:45 PM
 #9

F'king MATHMATICS. HOW DOES IT WORK?
I'm taking that online crypto class. I'm getting a better perspective on ideas such as the ones proposed in this thread. Crypto isn't quite as intuitive as it seems sometimes.

Any significantly advanced cryptocurrency is indistinguishable from Ponzi Tulips.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!