In this guide
  1. How blockchain technology works
  2. Key security principles
    1. Decentralisation
    2. The chain of blocks
    3. Consensus
    4. Cryptography
  3. Where blockchain security can fail
  4. How to protect yourself
  5. Frequently asked questions
    1. Can a blockchain be hacked?
    2. Are blockchain transactions reversible?
    3. Is it safer to keep crypto on an exchange or in my own wallet?
    4. What is a smart contract audit?

Thanks to the growing interest in bitcoin and other cryptocurrencies, blockchain technology is better known than ever. It is often described as “unhackable”, yet people still lose money to crypto hacks and scams. Both statements can be true, because the security of a blockchain itself is different from the security of the wallets, apps, exchanges and people that use it. This explainer covers how blockchain works, the principles that make it secure, where the real weaknesses lie, and practical steps to protect yourself. It is aimed at beginners and curious readers. We also touch on related topics such as web application security testing services, which matter because most attacks target the apps built around blockchains.

How blockchain technology works

A blockchain is a kind of digital ledger, a record of transactions, that is copied across many computers (called nodes) rather than stored in one place.

Each user has a public key and a private key. The public key (or an address derived from it) works like an account number that you can share. The private key is secret and proves that you own the funds at that address; you can read more about how protocols protect these systems in this guide to blockchain protocol security.

Suppose one user wants to send cryptocurrency to another:

  1. The sender creates a transaction and signs it with their private key. The signature proves the transaction came from the owner without revealing the key itself.
  2. The transaction is broadcast to the network.
  3. Nodes check that the signature is valid and that the sender actually has the funds.
  4. Valid transactions are grouped into a new block, which is added to the chain once the network agrees on it.

Key security principles

Decentralisation

The basis of blockchain technology is a shared register of transactions. Because the register is decentralised, no single computer or organisation controls it. To change the record, an attacker would have to overpower a large part of the network, not just break into one server.

The chain of blocks

The main register is a long chain of consecutive blocks, going all the way back to the very first block. Each block contains a cryptographic hash, a kind of digital fingerprint, of the block before it. If anyone changes the details of a past transaction, that block’s fingerprint changes, which breaks the link to every block after it.

This means anyone who wants to alter one transaction would have to rewrite that block and every block after it, and convince the rest of the network to accept the new version. On a large network, that is extremely difficult and expensive.

Consensus

Nodes need a way to agree on which new blocks are valid. The two best-known methods are:

  • Proof of work, used by Bitcoin, where “miners” compete to solve a computational puzzle. Attacking the network would require enormous computing power and electricity.
  • Proof of stake, now used by Ethereum and many other networks, where “validators” lock up cryptocurrency as a stake. Validators who try to cheat can lose part of their stake.

Cryptography

Digital signatures and hashing are well-studied cryptographic tools. When implemented properly, they make it practically impossible to forge a signature or reverse a hash.

Where blockchain security can fail

A blockchain’s design is strong, but the ecosystem around it has weak points:

  • 51% attacks. If one group controls most of a network’s mining power or stake, it could rewrite recent transactions. This is a realistic risk mainly for smaller networks.
  • Smart contract bugs. Smart contracts are programs that run on blockchains such as Ethereum. A coding mistake can let attackers drain funds, and because blockchain transactions are generally irreversible, losses are hard to recover. This is why projects pay for code audits.
  • Bridges and DeFi platforms. Services that move tokens between blockchains, or that offer lending and trading, hold large sums and have been frequent targets.
  • Exchanges and wallet apps. Centralised exchanges and wallet software can be hacked like any other online service, which is where web and mobile application security testing comes in.
  • Phishing and scams. Most individual losses come from people being tricked into revealing their recovery phrase, signing a malicious transaction, or sending money to a fake investment scheme.
  • Lost keys. If you lose your private key or recovery phrase, nobody can restore access for you.

How to protect yourself

  1. Never share your recovery (seed) phrase or private key. No genuine support agent, exchange or wallet will ever ask for it.
  2. Store your recovery phrase offline, written down and kept somewhere safe, not in screenshots, email or cloud notes.
  3. Use a hardware wallet for larger amounts. It keeps your private keys off your internet-connected phone or computer.
  4. Turn on two-factor authentication on exchange accounts, preferably with an authenticator app rather than SMS.
  5. Check addresses and links carefully. Type website addresses yourself or use bookmarks, and double-check the first and last characters of any wallet address before sending.
  6. Be careful what you sign. Read wallet prompts before approving a transaction, especially on unfamiliar websites.
  7. Be sceptical of guaranteed returns. Promises of fixed high profits, pressure to act quickly or requests to recruit others are classic signs of a scam.
  8. Keep software updated, including your phone, browser and wallet apps.

Frequently asked questions

Can a blockchain be hacked?

Large, well-established blockchains are very hard to attack directly. Most losses happen through hacked exchanges, faulty smart contracts, stolen keys and scams rather than through breaking the blockchain itself.

Are blockchain transactions reversible?

Generally, no. Once a transaction is confirmed, it cannot be cancelled, which is why sending funds to the wrong address or a scammer usually means the money is lost.

Is it safer to keep crypto on an exchange or in my own wallet?

A self-custody wallet gives you full control, but you are responsible for its security and backup. An exchange is convenient, but you depend on its security and solvency. Many people keep small amounts on exchanges and larger amounts in a hardware wallet.

What is a smart contract audit?

An audit is a professional review of a smart contract’s code to find vulnerabilities before it handles real money. It reduces risk but does not guarantee the contract is safe.

Technology Sage

The Technology Sage desk: guides, explainers and contributed articles since 2014.