Author

Topic: When does your public key get broadcast? (Read 127 times)

sr. member
Activity: 467
Merit: 578
February 20, 2023, 06:36:06 PM
#5
Thank you every one I could not wrap my head around it when I started looking into it after having some issues with a hardware wallet. I think I understand a more now.
legendary
Activity: 4298
Merit: 3209
February 19, 2023, 05:15:32 PM
#4
I know that potentially the public key could become vulnerable in the future if there are ever quantum computers that are capable but I do not believe that this will be a realistic threat until a very long time and I know that the public key gets exposed to the blockchain when a person sends a transaction to another address but does the sender only get exposed or does the address receiving also get exposed?

I learned that a hardware wallet has your public key on generation but looking at the blockchain explorers does not show this public key. How can you derive a public key from a transaction ID on the blockchain if this is hidden and only created at generation? I recently found out that you can check the public key which ties all of the addresses that were created on generation of the wallet and shows change addresses but this is not obvious on the blockchain explorers and requires you converting the public key into a different format to check.

In short, in a transaction you must include a signature to spend a UTXO. The public key is in the signature.
legendary
Activity: 2380
Merit: 5213
February 19, 2023, 10:40:04 AM
#3
To add to pooya87's post:

You can check the transaction details on a block explorer to extract the public key of the sending address(es).

If the address is P2PKH (legacy), the public key is the last 66 characters (if it's a compressed key) or the last 130 characters (of it's an uncompressed key) of the sigscript.
If the the address is P2WPKH (native segwit) or P2WPKH-P2SH (nested segwit), the public key is the second part of witness.
If the address is P2SH, P2WSH or P2TR, you should decode the redeem script to extract the public keys.
legendary
Activity: 3444
Merit: 10558
February 19, 2023, 09:55:01 AM
#2
I know that the public key gets exposed to the blockchain when a person sends a transaction to another address but does the sender only get exposed or does the address receiving also get exposed?
It depends on the address (better said output script) type you are sending to. The very old type that is no longer in use called P2PK is directly sending coins to a public key hence the receiver's public key is already revealed. The new types P2TR are also revealing a tweaked public key of the receiver.
The sender should always provide their public key when they are sending coins using an unlocking script that has any of the checksig operations.

Quote
How can you derive a public key from a transaction ID on the blockchain if this is hidden and only created at generation?
The transaction as I explained above should contain the sender's public key in its scriptsig or witness. You just have to decode the raw transaction bytes to extract them.

Quote
I recently found out that you can check the public key which ties all of the addresses that were created on generation of the wallet and shows change addresses but this is not obvious on the blockchain explorers and requires you converting the public key into a different format to check.
It sounds like you are referring to master public key that deterministic wallets use. It is not something you reveal to the public so it can not be found on a blockchain explorer. It is something the wallet can use to derive child public keys from if they are not hardened. You can read more about it in BIP32 https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
sr. member
Activity: 467
Merit: 578
February 19, 2023, 09:17:18 AM
#1
I know that potentially the public key could become vulnerable in the future if there are ever quantum computers that are capable but I do not believe that this will be a realistic threat until a very long time and I know that the public key gets exposed to the blockchain when a person sends a transaction to another address but does the sender only get exposed or does the address receiving also get exposed?

I learned that a hardware wallet has your public key on generation but looking at the blockchain explorers does not show this public key. How can you derive a public key from a transaction ID on the blockchain if this is hidden and only created at generation? I recently found out that you can check the public key which ties all of the addresses that were created on generation of the wallet and shows change addresses but this is not obvious on the blockchain explorers and requires you converting the public key into a different format to check.
Jump to: