0

so i was parsing the block #496 of bitcoin which contains two transactions, first tx in the list is the reward tx and the second tx contains three inputs and one output. i tried to parse each scriptSig but it's completely different bytes array in compare to the a format like

OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

which get used when we want to make a transaction. the first input's scriptSig is a 73 byte data which is equal to (each byte is in it's decimal form):

<<72,48,69,2,33,0,203,44,107,52,106,151,138,184,198,27,24,
                    181,233,57,119,85,203,209,125,110,178,254,0,131,239,50,224,
                    103,250,108,120,90,2,32,108,228,78,97,63,49,217,166,176,81,
                    126,70,243,219,21,118,233,129,44,201,141,21,155,253,175,
                    117,154,80,20,8,27,92,1>>

my first question is how to parse it, and my next question is, in block response we got only the tx value, is there any way to check how much btc was took from each address?

in block #496 there are 3 input and only 1 total tx value.

1

1 Answer 1

1

All three inputs in the second transaction of the 496th block consume P2PK outputs, not P2PKH outputs. If they were consuming P2PKH outputs, the scriptSig would be of the format you specified. Since these are P2PK outputs, then scriptSig contains only signature.

Here you can find a table with all standard locking scripts (scriptPubKey) and their corresponding unlocking scripts (scriptSig). The first output type (row) in the given table represents P2PK.

When the input provides the correct scriptSig for the scriptPubKey in the referenced output, it unlocks the entire amount locked in the output. So, nowhere in the input is it written how much amount it unlocks, that is, it spends, since it is the entire amount. To see exactly what that amount is, you need to look at the referenced transaction and the referenced output in it.

2
  • thanks for answer, can you explain more on this : To see exactly what that amount is, you need to look at the referenced transaction and the referenced output in it. thats my script sig that i specified and i get pubkey of destination on tx_out which can be translated to dest address. but all block explorers have the source destination, how they take it? i'm trying to use bitcoin protocol to take them, not APIs. Oct 23, 2023 at 9:09
  • 1
    @MonteConte The output contains the amount of satoshis that are locked with the scriptPubKey (say 1,000,000). When the input offers the correct scriptSig, all satoshis (all 1,000,000 satoshis) from the referenced output are unlocked. However, that amount is not written anywhere in the input. To see how much is being spent, it is necessary to look at the referenced transaction and output. Block explorers do the same when they show how many bitcoins are spent/taken with some input.
    – dassd
    Oct 23, 2023 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.