Crypto ELI8: Peer-to-Peer (P2P) Network
Understanding what P2P networks are and the role they play in crypto
The Crypto ELI8, or Explain Like I’m Eight, series is for anyone who wants to learn about the exciting world of cryptocurrency. Each post is organized around a specific term, concept, question, or other topic related to crypto.
For more on what the series is and a full list of posts check out this series guide.
A peer is someone like you. For example, your classmates or teammates are your peers. Believe it or not, computers can have peers too! In this post, we’ll look at what a peer-to-peer computer network is and the role that these networks play in cryptocurrencies.
It’s the middle of summer and your hometown is hosting the annual county fair. It’s the best county fair in the state. It has every ride, game, and food you could ever want at a fair.
Since it’s such a fun time, people from all over the state come and the lines can get really long. The longest line of all is always the Ticket Stand line. That’s because everything at the fair has to be paid for with tickets so everyone has to stand in line to buy tickets before they can pay for stuff at the fair.
There are two types of tickets: ride & game tickets and food tickets. The fair organizers made it like this so they can keep better track of what kind of stuff people are buying. They also made some rules for standing in line and buying tickets.
Rule #1 is everyone has to stand in a single file line so no one tries to budge. Rule #2 is no more than 10 total tickets per kid at a time. They do this so kids don’t waste tickets. Rule #3 is that there has to be at least 1 adult per 4 kids. Rule #4 is only adults can pay.
You think these rules are stupid because you end up spending half your time at the fair standing in line. It also means that whenever you want more tickets to have to find one of the adults you came with to pay. They’re also annoying because sometimes, for example, you only have food tickets but you aren’t hungry and want to play more games.
What if you could figure out a way to get the tickets you want without standing in line?
Then an idea hits you. In the corner of the fair grounds, there’s an empty area that used to be called “Kid Zone”. No one uses it anymore because all the rides and games it used to have were super boring.
You decide to turn it into a place where kids can trade tickets with other kids so they don’t have to stand in line. This way, if someone only has food tickets but they want ride & game tickets, they can go to Kid Zone and trade with someone. Or, if someone wants to trade the giant stuffed dinosaur they won for more food tickets, they can trade it with another kid.
To make sure things don’t get too crazy, you make some ground rules. Rule #1: kids only. It’s called Kid Zone, duh. Rule #2: no yelling or mean names. Rule #3: no bullies, if you bully someone you get kicked out. Rule#4: say please and thank you.
You start to tell other kids at the fair about it and word travels fast. Kid Zone is a hit! Before you know it kids are coming and trading directly with one another. That means kids get to spend less time in line and more time having fun!
So, what is a P2P network?
A peer-to-peer, or P2P, network is a type of computer network. In computer terms, “network” is a fancy way of saying a bunch of computers that are interconnected and talk to each other using a certain set of rules. In a P2P network, the computers are often called “nodes”, and these nodes can talk directly to one another. The set of rules the nodes follow to do this is called a “protocol”.
In contrast, there are client-server networks. In these types of networks, there are a bunch of littler computers, called “clients”, that are connected to at least one big computer, called a “server”. Depending on the “protocol”, or set of rules, clients can connect to more than one server. The server is where all the network’s information is stored. If a client wants to do things on the network such as access information or talk to another client, they have to go through the server.
In the county fair example, getting tickets at the Ticket Stand is like a client-server network. Here, the kids and parents are the clients while the workers in the ticket stand are like the server. The rules you need to follow to get tickets — stand in a single file line, at least one adult per 4 kids, only adults can pay, no more than 10 total tickets per kid at a time — are the protocol
If the Ticket Stand represents the client-server network, then getting tickets at Kid Zone is like a P2P network. Here, the kids are the “nodes” and the information they transfer is tickets. There’s no need for a central server, or Ticket Stand, because kids can trade tickets directly with one another. The rules you need to follow — kids only, no yelling or mean names, no hitting, say please and thank you — are the protocol.
How does this relate to cryptocurrencies?
Cryptocurrencies are built using something called a blockchain. Blockchain is a type of P2P network technology that stores a bunch of information publicly so that anyone can access it.* Since it’s a P2P network without a central server, network participants are called nodes.
Nodes need to follow a certain protocol, or set of rules, in order to participate on a blockchain. These rules can differ from blockchain to blockchain. For example, Bitcoin and Ethereum are both cryptocurrency blockchains but they have different protocols.
In cryptocurrencies, such as Bitcoin, the information that’s stored on the blockchain is about transactions that happen on the network. For example, who sent what amount to who and when. Except, instead of a person’s name or account number, the blockchain uses super secret codes and puzzles to keep this information private.
Similarly, the blockchain uses codes and puzzles to store its entire transaction history. Since it’s a P2P network and since the information is public, all the nodes participating help to make sure no one tries to come in and cheat.
A peer-to-peer, or P2P, network is a distributed computer network that stores and transfers information with no central server. The computers on the network are called nodes. Nodes participate in the network following a protocol, or set of rules.
Blockchain is the technology upon which cryptocurrencies are built. Blockchains are P2P networks in which participating nodes store a full history of all transactions on the network. Different blockchains follow different protocols.
*NOTE: this simplified, general definition refers mostly to public blockchains