Bitcoin Forum
December 11, 2017, 09:49:45 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: What's the Extra Byte for P2PK?  (Read 611 times)
evansste
Newbie
*
Offline Offline

Activity: 16


View Profile WWW
March 23, 2017, 01:48:54 AM
 #1

I've been looking at raw transactions on the blockchain and have noticed that transaction outputs which use a pay-to-public-key locking script, tend to have an extra byte in front of the public key.  Does anyone know what this preceding byte is?

For instance, take a look at the following raw transaction from block #10 on the blockchain:

01000000010000000000000000000000000000000000000000000000000000000000000000fffff fff0704ffff001d0136ffffffff0100f2052a01000000434104fcc2888ca91cf0103d8c5797c256 bf976e81f280205d002d85b9b622ed1a6f820866c7b5fe12285cfa78c035355d752fc94a398b675 97dc4fbb5b386816425ddac00000000

Now let me point out the extra byte in between -> and <-:

01000000010000000000000000000000000000000000000000000000000000000000000000fffff fff0704ffff001d0136ffffffff0100f2052a0100000043 -> 41 <- 04fcc2888ca91cf0103d8c5797c256bf976e81f280205d002d85b9b622ed1a6f820866c7b5fe122 85cfa78c035355d752fc94a398b67597dc4fbb5b386816425ddac00000000

As you can see, there's this 41 hexadecimal byte.

The first transaction, on block 277316, also has an extra byte in front of the public key.  Take a look:

01000000010000000000000000000000000000000000000000000000000000000000000000fffff fff0f03443b0403858402062f503253482fffffffff0110c08d950000000023 -> 21 <- 02aa970c592640d19de03ff6f329d6fd2eecb023263b9ba5d1b81c29b523da8b21ac00000000

This time it's hexadecimal 21.

Does anyone know why these P2PK locking scripts have an extra byte?  My understanding is that it's just supposed to be the public key and then the OP_CHECKSIG operator (hex ac) on the end.  Am I missing something?

Thanks for your time, and I appreciate any help that anyone is willing to provide.


BoolEngine.com
A Tool for the Technical Community
1513028985
Hero Member
*
Offline Offline

Posts: 1513028985

View Profile Personal Message (Offline)

Ignore
1513028985
Reply with quote  #2

1513028985
Report to moderator
1513028985
Hero Member
*
Offline Offline

Posts: 1513028985

View Profile Personal Message (Offline)

Ignore
1513028985
Reply with quote  #2

1513028985
Report to moderator
1513028985
Hero Member
*
Offline Offline

Posts: 1513028985

View Profile Personal Message (Offline)

Ignore
1513028985
Reply with quote  #2

1513028985
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513028985
Hero Member
*
Offline Offline

Posts: 1513028985

View Profile Personal Message (Offline)

Ignore
1513028985
Reply with quote  #2

1513028985
Report to moderator
1513028985
Hero Member
*
Offline Offline

Posts: 1513028985

View Profile Personal Message (Offline)

Ignore
1513028985
Reply with quote  #2

1513028985
Report to moderator
1513028985
Hero Member
*
Offline Offline

Posts: 1513028985

View Profile Personal Message (Offline)

Ignore
1513028985
Reply with quote  #2

1513028985
Report to moderator
achow101
Moderator
Legendary
*
Offline Offline

Activity: 1246


17kKQppUsngUiByDsce4JXoZEjjpvX9bpR


View Profile WWW
March 23, 2017, 02:20:56 AM
 #2

It is a size indicator opcode. It means that the next n bytes are to be pushed to the stack as one element. Otherwise a script interpreter wouldn't know that the next 65 or 33 bytes represented a public key and had to be pushed to the stack as such.

evansste
Newbie
*
Offline Offline

Activity: 16


View Profile WWW
March 23, 2017, 01:08:59 PM
 #3

Thanks so much for your response, achow101.  Your answer has cleared things up.  I appreciate it.

BoolEngine.com
A Tool for the Technical Community
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!