<p>It was chosen because it is a prime number, and also because 4190024921 is the hypotenuse of a primitive Pythagorean triple:
4190024921^2 = 2924728880^2 + 3000378279^2</p>
<p>Edit: Note that you must consider byte order. The TCP protocol requires the number to be encoded in big-endian. 0xf9beb4d9 (little) = 0xd9b4bef9 (big)</p>
<p>See <a href="https://stackoverflow.com/a/13514942">https://stackoverflow.com/a/13514942</a> for more info about that.</p>
<p>Update:  It is also a sum of squares.</p>

CC BY-SA 3.0
2017-03-30T22:37:12.320Z
How do you know that it was chosen for that reason?
Nick ODell
CC BY-SA 4.0
2018-05-08T19:11:29.883Z
@NickODell He knows because he is either Satoshi, or a savant. Otherwise he simply pasted the number into WA https://www.wolframalpha.com/input/?i=4190024921

I'll let you decide the likeliest scenario.
DenisM
CC BY-SA 4.0
2018-05-15T01:05:59.223Z
@DenisM ;)  Satoshi was into numbers, so I was pretty sure it had some interesting property to it, and indeed, WA to the rescue.  :)
Richard Anthony Hein
CC BY-SA 4.0
2021-04-26T19:34:29.730Z
@DenisM Why not both?  

Or all three?  Bitcoin/Botcoin =::= Ying/Yang
Richard Anthony Hein
CC BY-SA 4.0
2017-03-30T15:07:46.810Z
2024-04-07T01:09:16.993Z
2024-04-07T01:09:16.993Z
Richard Anthony Hein
<p>main.cpp carries this comment:</p>
<pre class="lang-cpp prettyprint-override"><code>// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ascii, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
unsigned char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };
</code></pre>

CC BY-SA 3.0
2016-03-04T21:06:53.057Z
Actually, also see [this](http://bitcoin.stackexchange.com/questions/43189/what-is-the-magic-number-used-in-the-block-structure/43191#43191) answer.
karask
CC BY-SA 3.0
2016-03-05T09:46:27.460Z
I find the rational of the code comment interesting. I believe that unless you stream the blocks the probability of these bytes occurring in normal data is irrelevant. Since bitcoin communicates with TCP it doesn't make sense. Can anyone shed more light to this?
karask
CC BY-SA 3.0
2017-12-12T05:46:08.307Z
@karask It could mean that Bitcoin itself was designed by a large corporation or government (someone with the means to watch packets going over the network in bulk.)  That's the only context it likely gets streamed anyway.
CoryG
CC BY-SA 4.0
2011-12-30T06:07:22.147Z
2023-08-15T19:47:34.010Z
2023-08-15T19:47:34.010Z
jarpiain
<p>Messages on the Bitcoin network are identified by the magic value 0xD9B4BEF9, and on the testnet by 0xDAB5BFFA. Why were these values chosen?</p>

CC BY-SA 3.0
2016-03-04T21:09:41.103Z
Also check [this](http://bitcoin.stackexchange.com/questions/43189/what-is-the-magic-number-used-in-the-block-structure/43191#43191) answer.
karask
<protocol>
How was the magic network ID value chosen?
jl6
# How was the magic network ID value chosen?

(Asked by: username_0 on 2011-12-29)

Messages on the Bitcoin network are identified by the magic value 0xD9B4BEF9, and on the testnet by 0xDAB5BFFA. Why were these values chosen?

**Tags:** protocol

> **Comments:**
> **username_1**: Also check [this](http://bitcoin.stackexchange.com/questions/43189/what-is-the-magic-number-used-in-the-block-structure/43191#43191) answer.  

---

## 2 answers

### Answer by username_5 on 2011-12-30. Score: 26 | Accepted answer

main.cpp carries this comment:

```cpp
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ascii, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
unsigned char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };

```

> **Comments:**
> **username_1**: Actually, also see [this](http://bitcoin.stackexchange.com/questions/43189/what-is-the-magic-number-used-in-the-block-structure/43191#43191) answer.  
> **username_1**: I find the rational of the code comment interesting. I believe that unless you stream the blocks the probability of these bytes occurring in normal data is irrelevant. Since bitcoin communicates with TCP it doesn't make sense. Can anyone shed more light to this?  
> **username_6**: @username_1 It could mean that Bitcoin itself was designed by a large corporation or government (someone with the means to watch packets going over the network in bulk.)  That's the only context it likely gets streamed anyway.  

---

### Answer by username_2 on 2017-03-30. Score: 1

It was chosen because it is a prime number, and also because 4190024921 is the hypotenuse of a primitive Pythagorean triple:
4190024921^2 = 2924728880^2 + 3000378279^2

Edit: Note that you must consider byte order. The TCP protocol requires the number to be encoded in big-endian. 0xf9beb4d9 (little) = 0xd9b4bef9 (big)

See <https://stackoverflow.com/a/13514942> for more info about that.

Update: It is also a sum of squares.

> **Comments:**
> **username_3**: How do you know that it was chosen for that reason?  
> **username_4**: @username_3 He knows because he is either Satoshi, or a savant. Otherwise he simply pasted the number into WA https://www.wolframalpha.com/input/?i=4190024921  I'll let you decide the likeliest scenario.  
> **username_2**: @username_4 ;)  Satoshi was into numbers, so I was pretty sure it had some interesting property to it, and indeed, WA to the rescue.  :)  
> **username_2**: @username_4 Why not both?    Or all three?  Bitcoin/Botcoin =::= Ying/Yang  

---

