Why does the Bitcoin use the litte-endian notation? It is less common than big-endian notation, thus when programming low-level applications working with Bitcoin protocol, one quite often has to create custom operations for handling the endianness switching. Is there some specific reason why this notation was chosen?

link|improve this question

72% accept rate
Why "the Bitcoin" and not "Bitcoin" or "the Bitcoin protocol"? – ripper234 Nov 26 '11 at 13:38
English is not my strong side;). – ThePiachu Nov 26 '11 at 23:24
Usually I just edit such mistakes, but given a high rep user I commented instead. Alrighty then. – ripper234 Nov 27 '11 at 7:26
feedback

3 Answers

up vote 4 down vote accepted

Most likely it is a small design error, but there is big argument about it at bitcointalk.org:What would you change about the Bitcoin protocol?.

link|improve this answer
feedback

Modern computers almost always use little-endian internally, so this choice improves speed. If Bitcoin used network byte order, then order conversions would be necessary for every message sent or received.

Hashes are defined by the standards as being big-endian, and crypto libraries deal with them in that form, so hashes are transmitted in big-endian. Bitcoin displays hashes in little-endian because Bitcoin sometimes considers hashes to be little-endian integers instead of strings.

link|improve this answer
feedback

Modern CPUs also typically have byte-swapping load and store instructions, or at least a byte swap register instruction, so that effective programmers (and optimizing compilers) may eliminate, or nearly eliminate, the overhead of endianness compensation.

This "small design error" may be a simple case of "premature optimization".

link|improve this answer
1  
Well, a premature optimization is a design error ^^ – Lohoris Nov 27 '11 at 19:28
feedback

Your Answer

 
or
required, but never shown

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