Author

Topic: How does the blockchain know the public address? (Read 120 times)

member
Activity: 113
Merit: 28
December 30, 2023, 12:52:21 PM
#5
Thank you all for your very detailed replies.
Now I understand.  Grin
legendary
Activity: 2856
Merit: 7410
Crypto Swap Exchange
My understanding is that 1BOB.... is a more readable version of the X,Y co ordinates of the public key obtained after a 1 way hash function. (ripemd160)
So given that the co ordinates X,Y have been hashed, How does the blockchain work out X,Y (the full public key) in order to create the transaction ?

I am obviously missing something

The wallet you use contain data which map between private key, public key, address and other related information. So when Bob want to spend his Bitcoin, his wallet create transaction with associated private key and create signature where you can extract associated public key.
legendary
Activity: 3444
Merit: 10537
Stop thinking in terms of addresses and public keys. In bitcoin we are "locking" up coins inside "smart contracts" and to spend those coins you need to provide an "unlocking mechanism/script" to be able to spend them.

It could be described as locked mailboxes. If you know the address of the mailbox you can go to it and insert the mail into its opening slot. But only the owner who has the key can open the lid and take the contents out.

In Bitcoin the "key" that unlocks your coins to allow you to spend them or the "unlocking mechanism" is a script in the Bitcoin's smart contract protocol.

For example take this very simple example: 3MaB7QVq3k4pQx3BhsvEADgzQonLSBwMdj
Coins sent to this address can be spent by providing a very simple unlocking script that only contains OP_TRUE.
<0x51> + OP_HASH160 da1745e9b549bd0bfa1a569971c77eba30cd5a4b OP_EQUAL
As you can see there is no public key here.

It's the same with everything else like when you send coins to a P2PKH address you are locking coins inside a OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG smart contract. To unlock this the owner has to provide a script like containing ECDSA signature and public key.

To verify the validity of these scripts, the nodes evaluate and execute these scripts in a FORTH like script language and if it ends up with a success, the transaction is valid and coins can be spent.
hero member
Activity: 789
Merit: 1909
Quote
How does the blockchain work out X,Y (the full public key) in order to create the transaction ?
It simply does not. It is only checked, when the owner reveals that public key explicitly. Which means, you can send your coins, even to some invalid hash of some public key, and then it will never be moved.

And yes, it happened in the past, for example those coins are unspendable forever: https://bitcointalksearch.org/topic/someone-fucked-up-and-lost-alot-of-money-50206
member
Activity: 113
Merit: 28
Alice wants to send Bob some Bitcoin so he creates an address 1BOB.... which he sends to Alice.
Alice sends the Bitcoin and the transaction proceeds.

My understanding is that 1BOB.... is a more readable version of the X,Y co ordinates of the public key obtained after a 1 way hash function. (ripemd160)
So given that the co ordinates X,Y have been hashed, How does the blockchain work out X,Y (the full public key) in order to create the transaction ?

I am obviously missing something
Jump to: