Bitcoin Forum
June 07, 2024, 11:13:02 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Question about the index field of a transaction in  (Read 849 times)
eclipseoto (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
March 20, 2014, 09:10:23 PM
 #1

I've recently been investigating the transaction protocol and have come into a question;

The index on a txin refers to the output of the previous, but can't there be up to 8bytes worth of outputs, while this input field is limited to 4 bytes?  What am I missing here?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3416
Merit: 4658



View Profile
March 20, 2014, 10:21:50 PM
 #2

I've recently been investigating the transaction protocol and have come into a question;

The index on a txin refers to the output of the previous, but can't there be up to 8bytes worth of outputs, while this input field is limited to 4 bytes?  What am I missing here?

While I see your point:
Previous Txout-index (Also known as "vout") in the input is an unsigned 4 byte INT while the transaction Out-counter is an unsigned VarInt between 1 and 9 bytes long

It isn't really a problem at the moment because blocks can't exceed a megabyte, and each transaction output is approximately 34 bytes in size.  This means that even if there was a block that was completely filled to max size with nothing but outputs, you couldn't have more than 30,800 ouputs in a transaction.  You don't need a 9 byte VarInt to represent 30,800.  You don't even need a 4 byte unsigned INT.

Therefore, unless the protocol is changed to allow blocks larger than 1 megabyte, Out-Counter shouldn't ever exceed 3 bytes in length.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!