# How does Abe or any blockchain explorer determine transaction size?

I was looking over the Abe code once again, and came to a stumbling point. I can't understand how this is accurate:

tx['size'] = len(tx['tx'])

Transaction size is simply the length of the raw transaction string? I did not think that 1 character of that string was equal to one byte.

Edit: while tinkering around with this with a simple python command line program, I was able to determine that the block size is actually half of the raw transaction string length. I also found out this:

Each hexadecimal digit represents four binary digits (bits), and the primary use of hexadecimal notation is a human-friendly representation of binary-coded values in computing and digital electronics. One hexadecimal digit represents a nibble, which is half of an octet or byte (8 bits).

Though it still doesn't answer the question, why isn't the size divided by two in the ABE source code?

• This answer in StackExchange might help: bitcoin.stackexchange.com/a/3011/38618 – MCCCS Jul 14 '16 at 10:41
• As you said tx['tx'] is the "raw transaction string" and not it's hexadecimal representation. In this case 1 char does represent 1 byte – Dylan James McGannon Sep 10 '16 at 0:11
• You are confusing hexadecimal (which is not raw) with a raw string. For example, the raw string "X" can be represented by the hexadecimal string "58". There is no reason to halve the length of the raw transaction string. – David Schwartz Jun 7 '17 at 5:05