DEV Community

Cover image for Security in The Blockchain
Edem Agbenyo
Edem Agbenyo

Posted on • Updated on

Security in The Blockchain

We have all be fascinated by the way the Blockchain has gained so much attention in recent years, especially the number of applications that can be made possible through it. This success of the Blockchain is due to its ability to keeps the anonymity of its users while allowing people who do not trust or know each other to reach a consensus and work together, the transparency of the interactions and how data flowing through the network is protected. Most blockchain networks use cryptography to identify, verify and secure the core protocol of the networks. In this article we will explain what cryptography is and how it is used in the context of blockchain at the surface level.

Blockchain

A blockchain is a network of public infrastructures that collectively maintain a shared and distributed ledger where immutable and encrypted copies of the information are stored on every computer in the network. One of the reason why blockchain technologies are widely being adopted is its ability to share information, send tokens and maintain integrity of nodes participant data in a very secure manner. This is accomplished using a combination of cryptographic encryption and hashing.

Cryptography

Cryptography is simply the practice of securing communication and protect it against eavesdropping from third parties. In the context of blockchain, two types of cryptography are used, hash functions and public-key cryptography.

Hash Functions

Hash functions are a mathematical algorithms that transform/convert any type of data of arbitrary size to a fixed size data. The converted data known as the hash value or message digest is unique and it is nearly impossible to get the original message from it. Hash functions in the context of a blockchain are used to ensure the integrity and the privacy of data transferred.

Public-key cryptography

Public-key cryptography is a cryptography system that uses pairs of keys(Public/Private keys). In this system, the private key is kept private and the public is openly distributed. Anyone with the public key can send an encrypted message to the owner of the public key, who can in turn decrypt the message with the corresponding private key. In the same manner, a sender can combine a message with the private key to create a digital signature of the message, which can only be verified by anyone holding the public key.

Security in the Blockchain

How is cryptography blockchain networks and other distributed ledgers?
In order for anyone to talk to the bitcoin network, one will first need a blockchain/bitcoin wallet. A wallet is a piece of software that stores your private key, public key, blockchain address and is the way by which you communicate with the blockchain network. Though the wallet can run on a computer, mobile phone or can be in the form of a hardware device, it performs the same function, which is to allow a user to authenticate and manage tokens. The wallet is used to sign transactions with ones private key when sending token, thus proving the transaction is genuine and adjusted on all copies of the ledger across the network of computers.

This is how the cryptographic aspect comes into play; when launched for the first time, the wallet generates a key pair(private/public key); first the private key randomly generates a 256-bit integer, then the public key is mathematically derived, using elliptic-key cryptography, from the private key. In the second step, the blockchain address is derived from the public key using a cryptographic function adding a checksums and prefixes to it. A blockchain address behaves just like an email address used to send and receive e-mails.
In order for a node to send a token in a blockchain network, the wallet is used to authenticate the user, before the private key is used to sign the token transactions. The public key is then used by all validating nodes in the network to verify the signature, preventing another person from taking your identity and sending/receiving token on your behalf.

Final word

In conclusion, no blockchain network could exists without any form of cryptographic system, though different ledgers use different type of cryptography. Most networks use a hash function and a asymmetric cryptography to maintain a high level of security and prevent easy access to participants token and wallets.

Discussion (0)