Bitcoin For Dummies. Peter Kent
Читать онлайн книгу.servers.
Bitcoin is sometimes known as a “trustless” system; not because it can’t be trusted, but because trust in a single person or company isn’t required. In a sense, trust is already baked into the system. It’s “trustless” because you don’t have to trust any particular individual, or any particular organization. This is because of the way the mathematics behind Bitcoin functions (keeping participants honest, in effect): It ensures that many servers are involved, and that the system itself can be trusted.
So we have Bitcoin transactions stored in the Bitcoin ledger. Where and how is that ledger stored? To understand that, we have to take another step back, and understand a little about blockchains.
Bitcoin uses a blockchain ledger
The Bitcoin ledger — the record of Bitcoin transactions — is saved in the Bitcoin blockchain. What’s a blockchain, you ask? A blockchain is a very special type of database. So once again, we need to step back — very quickly this time — to ask, what’s a database?
Quite simply, a database is an electronic store of information, that is being stored in a structured format on a computer. If you open a word-processing file and type a bunch of names and addresses into a document and save it, that’s not really a database; it’s just a jumble of information. But if you open a spreadsheet document and save the names and addresses — first name in the first column, last name in the second column, street address in the third, and so on — then you are creating a form of simple database where the information is stored in an organized, structured format.
Blockchains are a form of database; more specifically, they are specialized, sophisticated databases with special features that make them immutable unchangeable and unhackable.
The first significant characteristic is (and perhaps once we’ve said this, it may not be a surprise) that the blockchain uses blocks of data that are, um, chained together in a manner that makes it impossible to change any piece of data — a particular transaction, for instance — without changing the entire chain of blocks (we’ll explain how that works in a moment).
The other important characteristic is that the blockchain database is duplicated and distributed. Let’s look at these two issues one by one, starting with the duplication and distribution.
Looking at the Bitcoin Distributed, Peer-to-Peer Network
Without the Internet, there’s no Bitcoin. Bitcoin is an Internet technology, just as email and the World Wide Web are Internet technologies. And all three of these technologies require networks. (You might think of the Internet as the road system, and the different networks as different types of traffic — cars, trucks, buses — running over those roads.)
The Bitcoin ledger is stored on Bitcoin “nodes” on what is known as a peer-to-peer network: thousands of computers spread across the world. Each of these nodes contains a full copy or a portion of the blockchain, and so in effect thousands of copies of the ledger exist. Because of this, if you wanted to hack into the ledger and change a transaction, you’d have to convince all these computers to agree. By peer-to-peer, we mean that every one of these nodes is “equal”; there is no central server (or central group of servers) that manages the process, as there is with, say, a bank’s or credit-card network’s transactions. Rather, the process is managed according to a set of rules by which the entire community abides (again, the rules are baked into the mathematics that runs the system).
The nodes make the entire Bitcoin system function; they add transactions — including your transactions when you buy and sell Bitcoin — to the blockchain. Some of these nodes are also mining nodes, by the way, the nodes that are part of the process that brings new Bitcoin into existence (in the form of what is known as a coinbase transaction in the blockchain, a transaction in which new Bitcoin is added to the ledger).
However, having said that the Bitcoin network is a peer-to-peer network, it also works in some ways like a client-server network. Consider, for instance, the email system. Computers throughout the world exist that can manage email (we call them email servers). And what we call email clients (servers provide services to clients) also exist. An email client is a program such as Microsoft Outlook that sends email to a server — or the web program you see when you log into Gmail or Yahoo! Mail; that’s a client, too. These programs communicate with the servers. So, for instance, when you send email from, say, your Gmail account to, perhaps, grandma, that message first goes from your Gmail account to one of the Gmail system’s email servers, which then sends the email across the Internet to the server that manages gran’s email. Gran then uses her client program — Outlook, Gmail, Yahoo! Mail, or whatever — to get the email from that server.
The Bitcoin network is very similar. For example, it’s a peer-to-peer system of nodes that communicate with each other, each storing a copy of part (or all) of the blockchain ledger. But most Bitcoin owners don’t run one of these nodes. Instead, they have wallets. Now, different types of wallets exist, including what are known as cold wallets, wallets that are not connected to the Internet (see Chapter 4 for more). And while some of these wallets are offline most of the time, but online when needed, other wallets are never connected to the Internet at all (such as paper wallets, brain wallets, and metal wallets).
However, hot wallets also exist, which are essentially wallet software programs connected to the Internet (and the program might be running on a personal computer, a tablet, a smartphone, or even a dedicated computer, known as a hardware wallet). These hot wallets can be regarded as client programs, and the Bitcoin nodes as servers.
You, the Bitcoin owner or buyer or seller, communicate with the servers that validate transactions using your Bitcoin client program (your wallet). (Wallets, by the way, are also a form of node — a device connected to the network — but typically when someone is talking about a Bitcoin node, they are talking about more than a simple wallet.) Let’s say you want to sell some Bitcoin, or buy something with Bitcoin (which is essentially the same thing, right? You give some Bitcoin to someone and in return get something back.). You use your wallet to send a message to the Bitcoin network, asking the nodes to add your transaction to the blockchain, showing a transfer from your address in the blockchain to someone else’s address (don’t worry, we’ll get to addresses in a moment!).
With us so far? There’s a network of computers — the Bitcoin network — all talking to each other to manage the processing of Bitcoin transactions. Nodes exist that add transactions to the blockchain ledger, some of which are also mining, and wallets are used by individuals to manage their Bitcoin, acting as clients sending messages to the server nodes to move Bitcoin around in the ledger.
How many servers are there? It’s hard to tell. Servers come, servers go, and in fact, one can run a server privately, so it can’t be seen on the network. The number of active nodes fluctuates greatly, in particular based on the price of Bitcoin; as the price rises, more nodes come online, because mining becomes more profitable (remember, some nodes, but not all, are also mining Bitcoin).
Thus, estimates for the number of active nodes vary greatly; and the number you end up with also depends on what exactly you are trying to measure. Some surveys are looking for all nodes, both full nodes and listening nodes, while others are looking for only full nodes or only listening nodes.
Full nodes — or more properly, fully validating nodes — are those that are involved in the process of validating and adding transactions to the ledger (some of them are mining, too). A subset of these fully validating nodes are also listening nodes (also known as super nodes), which are full nodes that are publicly connectable, not behind a firewall or locked port.
When we did a quick Google search on the subject, we found sources claiming anywhere from 13,000 to 47,000