How does Bitcoin work?

Disponible en podcast
Share article:

Bitcoin is the first monetary system to operate without the intervention of a central authority. It is based on several concepts that ensure its proper functioning. Among other things, it is established on a distributed timestamp server in order to generate proof of the chronology of transactions. This tool solves one of the most important problems in implementing a payment system without a central authority: double spending.

In this article, we study some of the technical aspects at the base of the Bitcoin protocol: digital signatures, the distributed timestamp server, and the transaction.

Digital signatures

Unlike the traditional banking system that associates money with identity, ownership of a Bitcoin coin is ensured through the use of asymmetric cryptography. Each piece of bitcoin is associated on the network with a pair of cryptographic keys.

Two concepts are thus defined: the public key and the private key. The public key allows the user to receive bitcoins, in particular through an address, by producing an expenditure condition on a coin. To spend these funds, the legitimate owner will need to produce a signature using the associated private key.

The user must therefore ensure the security of his private keys, since they give unrestricted access to his bitcoins.

The problem with this system is that people receiving bitcoins have no way of verifying that these units have not been spent twice: this is called double spending. A payment network that allows this obviously cannot work. We need a way for the beneficiary of a Bitcoin payment to verify that the coins received were not already spent during a previous transaction to another payee.

The Bitcoin network thus uses a timestamp server in order to be able to mark transactions over time.

➤ Learn more about what Bitcoin is.

The distributed timestamp server (blockchain)

To avoid double spending, on Bitcoin, it is defined that the oldest transaction is the one that counts. For example, let's say Alice has 2 bitcoins, and sends them to Bob at 15:00. This transaction will be validated by the network. If Alice tries to send these same 2 bitcoins to Charles at 16:00, this transaction will be refused since Alice has already spent them in the past.

For Bob to be able to ensure that Alice has not already spent these bitcoins, he must have access to a register listing all the transactions that have already been validated. On Bitcoin, this ledger is a timestamp server.

We could thus define a central actor, who would manage this register, and who would determine which transactions came first. But on Bitcoin, in order to reduce the need for trust, we want to have a payment network that does not rely on any central authority. This timestamp server must therefore be distributed to each user. To avoid double spending, everyone should be aware of all transaction history. So when Bob receives a transaction from Alice, he himself is able to verify that the bitcoins committed have not already been committed in another transaction in the past.

The timestamp server format chosen for Bitcoin is a blockchain. While this term is often misunderstood, it's what you know as “Blockchain.”

➤ Learn more about Blockchain.

Its principle is simple: each transaction is recorded in a timestamp block. A block is simply an agglomeration of transactions. They are created on average every 10 minutes and each includes the footprint of the block preceding it. They thus form a chain.

What I call “fingerprint” is actually a hash. We pass the block header into a hash function, that is to say a function which associates data of arbitrary size with values of fixed size, and we obtain the block fingerprint. The imprint is therefore a summary of all the information contained in the block.

With all of these nuts and bolts, we're starting to guess an efficient payment network. But we still have a few problems to solve! How do you ensure that users agree on a single common blockchain? And how do you choose who enters the new blocks, and thus the new transactions, into this distributed ledger?

This is where the cornerstone of the Bitcoin system comes in: the Nakamoto Proof-of-Work Consensus (Proof-of-Work).

➤ Learn more about the Nakamoto Consensus by proof of work.

How does a Bitcoin transaction work?

First, the user who wants to send a payment will build a transaction. In it, he will indicate which bitcoins to spend and where to send them. The Bitcoin transaction is then made up of inputs and outputs (in English the “inputs” and the “outputs”). The entries represent the bitcoins used to pay. The entries are said to be “consumed” by the transaction. Outputs represent payment destinations. It is said that outputs are “created” in exchange for inputs that are “consumed.”

For the transaction to be valid, the total amount of outflows must be less than or equal to the total amount of entries. Transaction fees, which are paid to miners, represent the difference between total inflows and total exits.

Once this information is gathered, the sender of the transaction will sign it with the private key associated with the bitcoins used for the input payment. The signature makes it possible to prove that the user who wants to spend is in fact the legitimate owner of the private key, and therefore of the bitcoins committed, without revealing the key. If the Bitcoin inputs are associated with different key pairs, one signature must be produced for each key pair.

The sender then broadcasts its signed transaction to the Bitcoin network, i.e. to the nodes. The nodes individually verify that the transaction and the signatures received are valid. If this is the case, each node broadcasts this transaction to other nodes who will also check it and then rebroadcast it. This process continues until all nodes in the network are notified of the existence of this transaction.

The issuer transaction is now in the “mempool” (Memory Pool). In other words, it is in the memory of the nodes, waiting for a miner to include it in a valid block, which will represent their first confirmation.

This stage in the creation of the block by the miner will be the subject of next week's article.

Conclusion

The Bitcoin monetary system is based on numerous mechanisms. Each of these cogs is not a real technology in itself, yet they are all essential for the proper functioning of Bitcoin.

Bitcoin ownership is ensured through the use of electronic signatures. Public keys allow you to receive bitcoins by creating spending conditions, and the associated private keys allow them to be unlocked.

To avoid double spending on this peer-to-peer network, a timestamp server, also sometimes called a “Blockchain”, is used.

A Bitcoin transaction consists of entries (Inputs) and outings (Outputs). The inputs are consumed to be able to create the outputs.

Podcast available

Table of contents

Share article

You may also like these articles

Bitstack SAS, a company registered with the Aix-en-Provence Trade and Companies Register under number 899 125 090 and operating under the trade name Bitstack, is licenced as an agent of Xpollens — an electronic money institution authorized by the ACPR (CIB 16528 – RCS Nanterre no. 501586341, 110 Avenue de France, 75013 Paris) — with the Autorité de Contrôle Prudentiel et de Résolution (ACPR) under number 747088, and is also licensed as a Crypto-Assets Service Provider (CASP) with the French Financial Markets Authority (AMF) under number A2025-003 for the following activities: exchange of crypto-assets for funds, exchange of crypto-assets for other crypto-assets, execution of orders for crypto-assets on behalf of clients, providing custody and administration of crypto-assets on behalf of clients, and providing transfer services for crypto-assets on behalf of clients, with its registered office located at 100 impasse des Houillères, 13590 Meyreuil, France.

Investing in digital assets carries a risk of partial or total loss of the invested capital.
Past performance is not indicative of future results.
DOWNLOAD BITSTACK