Author

Topic: scriptSig (Read 118 times)

newbie
Activity: 21
Merit: 0
December 19, 2017, 08:39:52 PM
#6
Thank you!
legendary
Activity: 4466
Merit: 3391
December 19, 2017, 07:36:23 PM
#5

Question: in step 3, how to get the public key from scriptSig? In simple terms, I give you scriptSig, will you be able to tell the public key?


Probably. There is nothing in the script that identifies data as a public key, but you can probably deduce it.

The typical P2PKH scriptsig is:

PUSHDATA(72)

PUSHDATA(33)
newbie
Activity: 21
Merit: 0
December 19, 2017, 05:53:46 PM
#4
Thank you very much for answering! As I see it:

1. scriptSig is an input of the "redeeming" transaction (the one where I want to spend previously earned bitcoins) and scriptPubKey is an output specified in the "referenced" transaction (the one where I earned those bitcoins that I'm trying to spend now).

2. To see if I'm allowed to spend those bitcoins, a miner will concatenate scriptSig and scriptPubKey and run the resulting script.

3. From scriptSig signature and public key come out. This public key is then hashed and compared with the hash of the public key specified in scriptPubKey. This is the first check for validity of the transaction. The second check if for the signature.

Question: in step 3, how to get the public key from scriptSig? In simple terms, I give you scriptSig, will you be able to tell the public key?
legendary
Activity: 4466
Merit: 3391
December 19, 2017, 12:58:18 AM
#3
Hello!
Could someone explain how and come out of scriptSig script? Of course, scriptSig in not equal concatenate(,). How is this information incorporated into scriptSig?
Thank you!

It's a script.

PUSHDATA opcode
Signature data
PUSHDATA opcode
Public key data

In this input of a transaction

scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501

where is the public key?

That is just the signature. The output that it spends is from doesn't require a pubkey because the output script includes the pubkey:
Quote
PUSHDATA(65)
04283338ffd784c1 ... 8af332fe4d8cde20
CHECKSIG

Here is a typical raw scriptsig (https://blockchain.info/tx/f1f1ce5a0411d890ee3c543df2302c2691129e700bb72fed9eac0fff9cc5a0d0):
Quote
48
3045022100b028b2 ... 9f49ad32a3b53e01
21
027ca78d2199b4fb6 ... 929e18f3276062e7
newbie
Activity: 21
Merit: 0
December 19, 2017, 12:06:48 AM
#2
In this input of a transaction

scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501

where is the public key?
newbie
Activity: 21
Merit: 0
December 16, 2017, 12:58:12 AM
#1
Hello!
Could someone explain how and come out of scriptSig script? Of course, scriptSig in not equal concatenate(,). How is this information incorporated into scriptSig?
Thank you!
Jump to: