Table of contents
Lesson 9
Are public blockchains safe?
Are public blockchains safe?

11 min reading time

Updated

Are public blockchains safe?

Public blockchains can be used by anyone. There are no restrictions for participation in the blockchain. Because anyone can use the blockchain, it can quickly grow and the blockchain is decentralized.

On the other hand, this also means that a large network of different computers is responsible for storing data and validating transactions. 

If the security of certain data requires privacy, a public blockchain may not be the most appropriate solution.

The blockchain’s large network however ensures there is no single-point-of-failure. When a web server is attacked, the website on it is no longer accessible. Should one node be attacked, it will not affect the operation of the rest of the blockchain. After all, the network consists of thousands of computers. These all have to be unavailable for the blockchain to come to a stop. The chance that this happens is incredibly small.

What is a public blockchain?

A public blockchain is a blockchain that is public and available to anyone. This means that users can carry out transactions without requesting permission. Developers are also able to develop an application on the blockchain, provided the blockchain is fit for this. This is only possible when the blockchain provides support for smart contracts, as is the case with Ethereum.

Public blockchains are always open-source. This means that the blockchain’s code is public, and that people are entitled to copy, reuse or update the code. Because the blockchain is open-source, there is also a risk that various versions of a blockchain are created.

Bitcoin is an example of a public blockchain. Anyone is able to carry out a transaction on the blockchain. Users do not need to be pre-approved in order to use the blockchain.

Because everyone can participate in the blockchain, rules were drawn up. This is the blockchain’s consensus algorithm that ensures that the blockchain participants are sticking to the rules. When this does not happen, users are automatically penalized. What this punishment looks like differs from blockchain to blockchain. For example, the system can impose a fine, but the user can also be banned.

Because everyone is able to participate in a public blockchain, most networks are very decentralized. After all, there are no restrictions to participate in the network, which often makes the network very large.

A decentralized network is a network that consists of a large number of devices that are all connected to each other. This is in contrast to a centralized network, which consists of only one or several devices. For example, think of a web server with a single-point-of failure: once the web server is disabled due to an attack, the websites on it won’t be available to anyone.

Blockchains have no single-point-of-failure because many devices must be disabled before the blockchain stops working.

The difference between public and private blockchains

The private blockchain is a different type of blockchain. As the name suggests, this type of blockchain is not public. Not everyone can participate in the network of a private blockchain. Instead, participants are assessed, or the blockchain developers themselves provide the network.

Private blockchains are primarily used by companies, organizations and governments. For example, a large company with various branches could create a private blockchain, whereby each branch has its own server that forms part of the blockchain.

The servers are connected to each other, and as a result the various locations can quickly and safely exchange data with each other. The most important advantage of a private blockchain is security. Because the network is completely shielded, the developer can set the blockchain’s network up himself. It is not possible for other devices to access the network, meaning that data stored on the blockchain is in safe hands.

Hybrid blockchains

The third type is hybrid blockchains. This is a combination between the public and private blockchain. The blockchain in this case is not entirely closed off from the outside world, although not just anyone can participate in its network.

Instead, nodes can register to join the network, after which they’ll need to be approved in order to gain access to the network. This can be done through a vote, whereby a large group of people vote on who they trust the most. Or a number of people, such as the blockchain’s developers, can manually select these nodes.

Choosing the nodes that can go into the network is meant to ensure that only the best nodes participate in the network.

Are public blockchains safe?

In contrast to a private blockchain, anyone can access the network of a public blockchain. 

This can raise the question of whether the data and cryptocurrencies on a public blockchain are in a secure place.

The safety of a public blockchain is determined primarily by the way in which it is developed. Developers can use various techniques to guarantee the blockchain’s safety.

Generally, there are four features that guarantee a public blockchain’s safety:

  • Cryptography
  • Irreversibility
  • Decentralization
  • Consensus algorithm

These four features lead to the blockchain being regarded as one of the safest technologies of the moment. This applies to both private and public blockchains.

Cryptography

All transactions that are performed on the blockchain are signed with a digital signature. This is a digital signature that can be executed when a user holds a public and private key that belong together.

When a user wants to carry out a transaction, the user needs the wallet address of the recipient. He will then indicate how many cryptocurrencies he wants to send. He signs this transaction using his public and private key. Signing means that the transaction is converted to digit text, the so-called digital signature, with the help of an encryption mechanism, 

This digit text can be compared to a secret language. The digit text doesn’t mean anything unless you hold the correct public and private key. The recipient of this digit text is able to decrypt it, because he holds the keys that belong to the rightful recipient of the transaction.

The blockchain’s network checks whether the public and private keys are correct. This then also decides whether a transaction can be executed.

However, the network nodes aren’t able to look into the transaction. After all, they don’t hold the private keys of the sender or recipient of the transaction.

Cryptography ensures that nobody other than the persons entitled to it can access the content of a transaction. This is one of the most important components making public blockchains safe.

However, things can go wrong when someone has come into unjustified possession of someone else’s private keys. These, as the name implies, should be kept secret from everyone except the rightful owner of them. It is therefore important to never share your private keys with others.

Irreversibility

Once a transaction is approved, it is added to the blockchain in a block. It then becomes impossible to change the transaction. Everything stored on a blockchain will forever remain on it. This is because the blockchain is irreversible.

When the block is being prepared, the block is converted to a hash. This is often compared to encryption, although the two are not the same. With a hash, data is converted to a digit text, but this only happens in one direction. The data can therefore be encrypted, but not decrypted.

What a block’s hash may look like entirely depends on the block’s content. Even if just one bit of the block is changed, the hash for the block will look completely different.

Every block contains the hash of the previous block. As a result, the blocks are all connected to each other in a chain, explaining the term “blockchain”. If someone were to change the content of a block, this will also change the hash of the block. This then results in the hash in the next block being incorrect, creating a breach. The network will therefore immediately notice when someone tries to alter the blockchain’s history. This version is then declared invalid.

An attacker may have the option to change all subsequent blocks, so that all hashes are still correct and avoiding a breach. However, most blockchains consist of a large number of blocks, making this practically impossible.

For example, approximately 144 blocks are added to Bitcoin’s blockchain every day. If an attacker were to change a block added to the blockchain 7 days ago, the 1008 blocks that were subsequently added then also need to be updated. The energy required for this makes it almost impossible to achieve this.

Decentralization

The public blockchain’s network is decentralized. This means that the network comprises multiple computers that are connected to each other. Such a network sometimes consists of thousands of devices.

Due to the decentralization, there is no single-point-of-failure such as that sometimes experienced by central servers. If a web server is attacked by a group of hackers, no one can access the website stored on that server. The web server therefore has a single-point-of-failure. Hackers only need to disable the web server to remove a website from the Internet.

Every computer in the network has a copy of the blockchain stored. A hacker therefore can try to attack one of these nodes to disable it. However, thousands of other nodes will remain that can keep the blockchain running. The hacker would have to disable all nodes in order to disable the blockchain. In the case of a large blockchain network comprises thousands of nodes, doing so is practically impossible.

Consensus mechanism

The consensus mechanism ensures that the blockchain’s network is self-sufficient. All nodes in the network know the consensus mechanism, and check that these rules are complied with by other nodes.

If a node deliberately approves invalid transaction, other nodes will quickly notice this. The nodes check each other’s work. If this is noticed, the network will vote to determine what should happen next. Byzantine Fault Tolerance (BFT) is used for this.

Byzantine Fault Tolerance means that at least 51% of the network needs to agree with a certain decision in order to execute it. If a node believes another node is approving an invalid transaction, 51% of the network will need to agree with this. Where that is the case, a node can be punished.

What that penalty may look like depends on the blockchain. Every blockchain has different rules for this. It can be decided to ban the node from the network, or the node can be fined.

Vulnerabilities of blockchains

It is impossible to develop a system without vulnerabilities. This is because various design decisions need to be made that determine the security of the blockchain.

For example, developers can develop the world’s fastest blockchain by using a specific technique. This technique could then create a vulnerability for the blockchain in another area. The developer will then need to consider what is more important: the speed or the safety of the blockchain.

A properly functioning blockchain generally needs to meet three requirements: speed, scalability and decentralization. In practice, often only two of these requirements can be met. When developers choose to pursue speed and decentralization, the blockchain will lag in terms of security. This problem is also called the blockchain trilemma.

This is of course only an example, but it indicates how blockchain developers themselves are able to decide how safe the blockchain is. Making certain design choices can solve problems, but also create other problems.

In the past, various possible vulnerabilities of blockchains have revealed themselves. Not all vulnerabilities have yet been exposed, although theoretically they are possible.

51% attack

The 51% attack is the best-known vulnerability of blockchains. The Byzantine Fault Tolerance determines that no less than 51% of the network must support a decision before it can be executed.

A hacker could ensure that he controls 51% of the network. A hacker can achieve this by adding enough devices to the network so that he controls 51% of all devices. The blockchain could then be completely controlled by the hacker.

However, implementing a 51% attack is easier said than done. It costs an enormous amount of money and energy to successfully carry out such an attack.

Most blockchains have large networks that protect them against a 51% attack. It is almost impossible to hold more than 51% of the network when the network consists of thousands of computers.

Finney attack

The Finney attack allows a hacker to spend his cryptocurrencies multiple times. He does this by creating a transaction and then validating it himself.

He then recreates the same transactions and sends them towards the blockchain’s network. If the network approves the transaction again, the attacker will have spent the same amount of cryptocurrencies twice.

Sybil attack

In a Sybil attack, a hacker creates a large number of transactions that he sends to the network in a short span of time. The number is so large that the network can no longer handle the transactions, forcing the entire network to crash.

The nature of the Sybil attack resembles that of a DDoS (distributed denial of service) attack that can be carried out on centralized systems.

Theft of keys

In case of theft of private and public keys it is not the entire network, but rather an individual user that becomes the victim. When a hacker gains possession of the public and private keys, he can pretend to be the victim. In this way, all of the victim’s cryptocurrencies can be sent to the hacker’s wallet.

Theft of private and public keys happens more frequently than is often thought. In most cases, hackers gain access to the victim’s keys through phishing.

It is therefore important never to click on a link or download a file that you do not trust. There have been multiple instances in the past of malware being installed in this manner, that then steals the private and public keys as soon as the victim uses the wallet.

Summary

A public blockchain, unlike a private blockchain, is accessible to everyone.

This means that anyone can add a computer to the network and perform a transaction. This creates many opportunities, but can also raise questions about the security of the blockchain.

The security of public blockchains is determined by the design of the blockchain. Certain choices made during the design can provide various benefits, but they can also potentially compromise security.

There are four features that cause the blockchain to be considered one of the most secure technologies today: cryptography, immutability, decentralization and a consensus mechanism. 

Still, there are several known vulnerabilities that blockchains can potentially suffer from. 

One example is the 51% attack, where a hacker gains control of more than 51% of the entire blockchain network. This gives the hacker the ability to control what the network does, such as intentionally approving invalid transactions.

To prevent these types of attacks, blockchains have many security measures in place.