<p>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.</p>

<p>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 <em>displays</em> hashes in little-endian because Bitcoin sometimes considers hashes to be little-endian integers instead of strings.</p>

CC BY-SA 4.0
2018-05-15T17:03:34.177Z
When you say Bitcoin `displays` hashes, do you mean how it's commonly displayed on Bitcoin software, tools, and websites? Or are you talking about something actually in the bitcoin core code for displays hashes a certain way?
Jacob Ford
CC BY-SA 3.0
2011-11-25T23:44:02.360Z
2011-11-25T23:44:02.360Z
theymos
<p>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.</p>

<p>This "small design error" may be a simple case of "premature optimization".</p>

CC BY-SA 3.0
2011-11-27T19:28:27.420Z
Well, a premature optimization *is* a design error ^^
o0'.
CC BY-SA 3.0
2011-11-26T16:40:48.630Z
2011-11-26T16:40:48.630Z
McKenzie
<p>Most likely it is a small design error, but there is big argument about it at <a href="https://bitcointalk.org/index.php?topic=4278.0">bitcointalk.org:What would you change about the Bitcoin protocol?</a>.</p>

CC BY-SA 3.0
2011-11-25T20:13:14.590Z
2011-11-25T20:13:14.590Z
Serith
<p>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?</p>

<protocol><standard><endianness>
Why does the Bitcoin protocol use the little-endian notation?
ThePiachu
# Why does the Bitcoin protocol use the little-endian notation?

(Asked by: username_0 on 2011-11-25)

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?

**Tags:** protocol, standard, endianness


---

## 3 answers

### Answer by username_5 on 2011-11-25. Score: 13 | Accepted answer

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?](https://bitcointalk.org/index.php?topic=4278.0).


---

### Answer by username_1 on 2011-11-25. Score: 17

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.

> **Comments:**
> **username_2**: When you say Bitcoin `displays` hashes, do you mean how it's commonly displayed on Bitcoin software, tools, and websites? Or are you talking about something actually in the bitcoin core code for displays hashes a certain way?  

---

### Answer by username_3 on 2011-11-26. Score: 6

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".

> **Comments:**
> **username_4**: Well, a premature optimization *is* a design error ^^  

---

