Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: rasem_ on December 23, 2020, 04:27:39 PM



Title: Pubkey & Sigscript
Post by: rasem_ on December 23, 2020, 04:27:39 PM
Good day!

Im new from BTC.
I take a random BTC transaction: 6db26c6da67bfb3f87de32de61fe63b5f5beeb573f710e0620748b730d97b47a
using https://www.blockchain.com/btc/tx/6db26c6da67bfb3f87de32de61fe63b5f5beeb573f710e0620748b730d97b47a

The input wallet is 1JyzsWNPQ5LWoagkcrHzExCPfa6FDo7vU7

How can I get pub key from:

Pkscript
76a914c541bd83f6dcefcbcb19a78b4e21d8fd4c73a24a88ac
Sigscript
483045022100a4122309203bfcfe8f9ea9f7b2d503895fc0669300d5b26fb15d88b5626f3a8d022 027b2ed245627fc0edc5d26b61dd7ac501ec7152ec405d93500cfd1ee1007e6ee0121034acce93c 52ec4ceef893014f139ca3a8ac817cef1bd397d328981b68d6bf7b67

to get then from it wallet: 1JyzsWNPQ5LWoagkcrHzExCPfa6FDo7vU7
?


Title: Re: Pubkey & Sigscript
Post by: o_e_l_e_o on December 23, 2020, 04:53:10 PM
The public key is right there as the last 66 characters (33 bytes) of the ScriptSig.

The compressed public key is:
Code:
034acce93c52ec4ceef893014f139ca3a8ac817cef1bd397d328981b68d6bf7b67

Which gives the address:
Code:
1JyzsWNPQ5LWoagkcrHzExCPfa6FDo7vU7

For future, if you look up the transaction on blockstream.info instead, and click on the "Details" tab, you will find the "ScriptSig (ASM)" field much easier to interpret - https://blockstream.info/tx/6db26c6da67bfb3f87de32de61fe63b5f5beeb573f710e0620748b730d97b47a?expand


Title: Re: Pubkey & Sigscript
Post by: ranochigo on December 23, 2020, 04:54:54 PM
It's 034acce93c52ec4ceef893014f139ca3a8ac817cef1bd397d328981b68d6bf7b67.

The formatting for Blockchain.com is always kind of weird when copied. This is a compressed public key.

48 - OP_Pushbytes_72

3045022100a4122309203bfcfe8f9ea9f7b2d503895fc0669300d5b26fb15d88b5626f3a8d02202 7b2ed245627fc0edc5d26b61dd7ac501ec7152ec405d93500cfd1ee1007e6ee01 - ECDSA signature

21 - OP_Pushbytes_33 for compressed public keys


034acce93c52ec4ceef893014f139ca3a8ac817cef1bd397d328981b68d6bf7b67 - Public key

Note that a compressed public key is always 33 bytes while uncompressed is 65 bytes.