Bitcoin Forum
July 03, 2024, 11:55:08 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Really simple question  (Read 180 times)
BusyAssistant (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 4


View Profile
February 01, 2019, 03:10:58 AM
 #1

Hi. This is a dumb question but, how come when I copy a value from bitcoin, e.g. raw hex of a tx, and paste it in a text editor and read the length, it reads 600 chars (bytes), but when I look in the RPC result for size it reads exactly half of that (300) ? Thanks.
xhomerx10
Legendary
*
Offline Offline

Activity: 3892
Merit: 8324



View Profile
February 01, 2019, 03:22:02 AM
Merited by bones261 (1)
 #2

First of all, you are mistaken to think that one character equals one byte so your conclusions will be incorrect as well.

One byte is equal to eight bits and it takes two characters to represent one byte in hexadecimal format.

 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23...
 ...F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF

 I'm sure you already knew that but your initial premise threw off your thinking.


BusyAssistant (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 4


View Profile
February 01, 2019, 03:44:09 AM
 #3

Ahhhh damn ok thanks for pointing it out to me, I'm bad at thinking about encoding stuff. Thanks.
nc50lc
Legendary
*
Offline Offline

Activity: 2464
Merit: 5763


Self-proclaimed Genius


View Profile
February 01, 2019, 03:50:00 AM
 #4

One character is one byte & one byte is 8 bits alright, but it will make him more puzzled by that explanation.
1HEX (00 to FF)=8bits (00000000 to 11111111)=1byte; 1HEX=1Byte.

Where it gone wrong is how the text editor "counts" HEX.
If it was a text editor (example for hex, raw tx), it reads each of the characters as "characters" which is one byte each.

Now, RPC call counts HEX as "HEX" thus each of the two characters were counted as one byte.
That why it's exactly half of the size counted by a text editor like "notepad".

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
xhomerx10
Legendary
*
Offline Offline

Activity: 3892
Merit: 8324



View Profile
February 01, 2019, 03:53:53 AM
 #5

Ahhhh damn ok thanks for pointing it out to me, I'm bad at thinking about encoding stuff. Thanks.

 Not too many are good at thinking about encoding so it's understandable.  Kudos to you for learning.

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!