# One hundred twenty-eight

@ b.charr.xyz/128

Sending data on the internet is just like sending mail, and even the technical terms themselves seem a lot like you’re sending things through the post. One example is that the Internet Protocol, IP, marks where to send data by assigning everyone an address. And while the Internet Protocol describes a lot more than just addresses, the term has become so ubiquitous that an IP address is often just called an IP.

## Bits

Most people know that computers work by sending zeroes and ones, or “bits.” Adding an extra bit to a set of data doubles the amount of data we store; for example, if our data were a single digit from 0 to 9, adding a bit brings us from ten possibilities to twenty: in addition to storing 00 to 09, we can now store 10 to 19. Mathematically, if we have $n$ bits of information, this allows for $2^n$ possible combinations.

The previous version of the Internet Protocol, IPv4, represented addresses using 32 bits. This allowed roughly four billion addresses, which meant that at maximum, around four billion computers could access the internet at any given time. This may seem like a lot, but in reality, it wasn’t enough: many people have multiple internet-connected devices, and online organisations can often have hundreds to millions of physical computers, each running multiple instances of a piece of software, each potentially having their own IP address.

To fix this problem, the latest version, IPv6, represents addresses using 128 bits. Because this has four times the number of bits, the number of combinations from IPv4 has been squared, twice. Most people don’t even know how to say this number out loud, but it’s over 340 undecillion, or 340 billion billion billion billion— the fact that “billion” is repeated four times is no coincidence.

## Nanobots

Most people have absolutely no way of visualising the scale of this number. One example I’ve seen is that if we were to cover the entirety of the surface of the Earth with nanobots, each assigned an IPv6 address, there would be thousands of nanobots for every atom on the Earth’s surface. The calculations for this are a bit excessive. Please, just scroll past this unless you care:

\begin{aligned} R_\oplus &\approx 6.3781 \times 10^6 \textrm{ m (Earth radius)} \\ m_e &\approx 9.10938188 \times 10^{-31} \textrm{ kg (mass of electron)} \\ \alpha &\approx 7.2973525664 \times 10^{-3} \textrm{ (fine structure constant)} \\ \\ h &= 6.62607015 \times 10^{-34} \textrm{ J s (Planck constant)} \\ \hbar &= \frac{h}{2\pi} \textrm{ (reduced Planck constant)} \\ h^2 &= 4.3904806 \times 10^{-67} \textrm{ J}^2 \textrm{ s}^2 \\ \hbar^2 &= \frac{4.3904806 \times 10^{-67} \textrm{ J}^2 \textrm{ s}^2}{4\pi^2} \\ c &= 2.99792458 \times 10^8 \textrm{ m} \textrm{ s}^{-1} \textrm{ (light speed)} \\ c^2 &= 8.9875517873681764 \times 10^{16} \textrm{ m}^2 \textrm{ s}^{-2} \\ 4c^2 &= 3.59502071494727056 \times 10^{17} \textrm{ m}^2 \textrm{ s}^{-2} \\ 8c^2 &= 7.19004142989454112 \times 10^{17} \textrm{ m}^2 \textrm{ s}^{-2} \\ a_0 &= \frac{\hbar}{m_e c \alpha} \textrm{ (Bohr radius)} \\ a_0^2 &= \frac{\hbar^2}{m_e^2 c^2 \alpha^2} \\ a_0^2 &= \frac{h^2}{4 \pi^2 m_e^2 c^2 \alpha^2} \\ &= \frac{4.3904806 \times 10^{-84} \textrm{ kg}^2 \textrm{ m}^2}{3.59502071494727056 \pi^2 m_e^2 \alpha^2} \\ \eta_h &= \frac{\pi}{2 \sqrt{3}} \textrm{ (circle packing density)} \\ \\ n_a &= \frac{4 \pi \eta_h R_\oplus^2}{\pi a_0^2} \textrm{ (atoms on Earth’s surface)} \\ &= \frac{4 \eta_h R_\oplus^2}{a_0^2} \\ &= \frac{2 \pi R_\oplus^2}{a_o^2 \sqrt{3}} \\ &= \frac{7.19004142989454112 \pi^3 m_e^2 \alpha^2 R_\oplus^2 \times 10^{84} \textrm{ kg}^{-2} \textrm{ m}^{-2}}{4.3904806 \sqrt{3}} \\ &\approx \frac{7.19004142989454112 \times 9.10938188^2 \times 7.2973525664^2 \times 6.3781^2 \times \pi^3 \times 10^{28}}{4.3904806 \sqrt{3}} \\ &\approx 5.2699 \times 10^{34} \textrm{ atoms} \\ \\ \frac{2^{128}}{n_a} &\approx 6457 \textrm{ IPv6 addresses per atom} \end{aligned}

And unfortunately, this kind of calculation does not lend itself to easy maths. I can’t say how many times I had to check my work before I actually got the right answer here, but it was too many. And even then, this calculation bears the assumptions:

1. The Earth is a perfect sphere. (It's not.)
2. The Earth's surface has a dimension of 2. (It's not.)
3. The atoms on the Earth's surface are all the same size. (They're not.)

And honestly, this estimation is awful in so many ways. Even if the end result (IPv6 > Earth) is the same, the means doesn't explain why.

## Humans

Imagine that there’s no life outside of Earth in the entire universe. In this case, that’s because the entire universe is made of Earths. More specifically, if we divide the mass of the observable universe by the mass of the Earth, we can get an absurd upper bound for the number of planets in this universe that could be inhabited by humans.

And, if we multiply this number by the current population of humans on Earth, we can get the number of humans living in this hypothetical universe. Hypothetically.

To simplify the numbers, we’ll assume that the universe is $10^{53} \textrm{ kg}$, and that the Earth is $6 \times 10^{24} \textrm{ kg}$ with $7 \times 10^9$ people. And honestly, $\frac{7}{6}$ is a really annoying fraction, so, let’s treat it as $1$.

That means that $10^{53-24+9} = 10^{38}$ people live in our hypothetical universe. How many IPv6 addresses did we have? Oh.

It was about $10^{38}$.

There’s no way in the universe we’ll ever run out of IPv6 addresses.