Programs

# What are Hashing, Signatures and Public-Private Keys

Once you know what is blockchain technology, you understand thatÂ the sealing mechanismÂ is the key to the successful and accurate maintenance of a blockchain. But how can these stringent requirements be fulfilled?
The conditions imposed on the sealing mechanism of a blockchain are satisfied using a hash function.

LearnÂ Online Software Development CoursesÂ from the Worldâ€™s top Universities. Earn Executive PG Programs, Advanced Certificate Programs or Masters Programs to fast-track your career.

The mathematical definition of a hash function is a function that takes a variable length numerical input and returns a number of fixed length as output. In order to work with strings of characters, ASCII codes can be used to convert characters into integers and vice versa. The output returned by the hash function is known as the hash value. Most popular hash functions have a fixed hash value size lying between 160 and 512 bits.
All blockchains impose target conditions on the output of the hash function when a block is an input to it. To fulfil these target conditions, a seal is computed and concatenated to the block being stored. This seal encrypts the contents of the block and preserves their integrity. This is because any change to the block would drastically change its corresponding hash value, and cause it to escape the target conditions. The computed seal is commonly known as a nonce. A common target condition that the nonce must satisfy is ensuring that the leading â€˜nâ€™ characters of the output hash be zero. The value of â€˜nâ€™ sets the level of difficulty in the blockchain, which may be adjusted periodically as per the requirements of the network.

## Explore Our Software Development Free Courses

 Fundamentals of Cloud Computing JavaScript Basics from the scratch Data Structures and Algorithms Blockchain Technology React for Beginners Core Java Basics Java Node.js for Beginners Advanced JavaScript

Check out ourÂ free courses to get an edge over the competitionÂ

There are three important properties that hash functions must satisfy in order to be used effectively in the blockchain. Given the hash value output by the function, it must be computationally difficult to find any input that, when hashed, returns the given output. This is known as pre-image resistance. In other words, the hash function should be computationally expensive to reverse. Similarly, given the input to the function, it must be difficult to compute any other input to the same function that outputs the same hash value as the original input. This is known as collision resistance. However, given any input to the hash function, it should be easy to compute the corresponding value output by the hash function. This is to ensure easy verification of the integrity of the contents of the blockchain.

## Explore our Popular Software Engineering Courses

 Master of Science in Computer Science from LJMU & IIITB Caltech CTME Cybersecurity Certificate Program Full Stack Development Bootcamp PG Program in Blockchain Executive PG Program in Full Stack Development View All our Courses Below Software Engineering Courses

The first two properties given above are critical because they slow down the rate of computation of the nonce, or proof of work. This causes the rate at which blocks are added to the chain to be limited by the rate of computation of the nonce, and not the rate at which transactions occur. This is absolutely crucial because it prevents dishonest individuals in the network from generating and adding blocks of false transactions to the chain at a quicker rate than the network itself. This is because a single individual cannot compete with the computing power of a large network, and thus the longest chain of blocks always belongs to the majority in the network itself.
This allows us to be able to safely accept the longest chain as the real blockchain under the assumption that the majority in the network is honest. The vulnerabilities of a blockchain in the case of a dishonest majority have already been discussed in a prior article.

## In-Demand Software Development Skills

 JavaScript Courses Core Java Courses Data Structures Courses Node.js Courses SQL Courses Full stack development Courses NFT Courses DevOps Courses Big Data Courses React.js Courses Cyber Security Courses Cloud Computing Courses Database Design Courses Python Courses Cryptocurrency Courses

There are many different forms of hash functions that are used in cryptography. MD5 is the most popular hash function of the Message Digest family, which also consists of MD2, MD4 and MD6. The SHA family, consisting of SHA-0, SHA-1, SHA-2 and SHA-3, is another popular set of algorithms used for hashing. RIPEMD and Whirlpool are other common hash functions. These functions all implement different techniques to obtain the properties of pre-image and collision resistance.
The sealing mechanism of the blockchain ensures that transactions cannot be falsified after the blocks have been added to the chain. But how are any imposters in the network prevented from faking a transaction between two members of the network? In other words, how can the identity of the members involved in the transaction be verified in an anonymous network distributed across the globe?

upGrad’s Exclusive Software Development Webinar for you –

SAAS Business – What is So Different?

Verification of any transaction conducted in a blockchain network requires a digital signature.
Each member of the blockchain network is assigned a public key and a private key. The public key of each member is known to all members of the network, but the private key remains secret and is known only to the individual it is assigned to. Any message encrypted using the private key of a member node can only be decrypted using the corresponding public key of the pair, and vice versa. This allows nodes to approve transactions by signing them with their private key. This can now only be decrypted by their corresponding public key, thus verifying them as the senders. The transaction can similarly be encrypted by the receiver as well in order to confirm their involvement in the transaction.

Check out upGradâ€™s Full Stack Development Bootcamp (JS/MERN)Â

This mechanism allows nodes to authenticate transactions by verifying the identities of the nodes involved while still maintaining their anonymity. The digital signature and the concept of public and private keys prevents other nodes from making false transactions on your behalf even in the event of aÂ 51% attack. Thus, it is an elegant way of ensuring the security as well as the anonymity of individual members of the network.

## Read our Popular Articles related to Software Development

 How to Implement Data Abstraction in Java? What is Inner Class in Java? Java Identifiers: Definition, Syntax, and Examples Understanding Encapsulation in OOPS with Examples Command Line Arguments in C Explained Top 10 Features & Characteristics of Cloud Computing in 2022 Polymorphism in Java: Concepts, Types, Characterisitics & Examples Packages in Java & How to Use Them? Git Tutorial For Beginners: Learn Git from Scratch

If you are interested to create blockchain applications from scratch, check out upGrad & IIIT-Bâ€™sÂ Executive Certification in Blockchain from IIITB.

## What will a tamper-proof ledger entail?

The importance of a transparent and tamper-proof ledger cannot be overstated. All transactions would be completely transparent and accountable as a result of this. It would also guard against tampering with the ledger, ensuring its accuracy. It will also make it easier for businesses to track their supply networks and detect fraudulent activity. It might also be used to keep track of voting records and other critical information. It will enable businesses to track and save their information digitally without fear of being hacked.

## What are some potential applications for blockchain in the area of supply chain management?

Blockchain has a wide range of possible uses in supply chain management. Tracking the flow of goods, minimizing the risk of counterfeit goods, reducing the risk of food fraud, and assuring the quality of commodities are some of the most significant applications. Businesses may increase the overall efficiency of their operations by employing blockchain technology to streamline supply chain activities. Furthermore, blockchain can assist firms in swiftly and simply identifying the cause of any supply chain issues.

## What are the security implications of a distributed ledger?

A distributed ledger has serious security considerations. A distributed ledger is a database distributed across several computers or servers. A hacker would have to enter many systems to obtain access to the data, making it difficult for them to attack the system. Furthermore, a distributed ledger is transparent and can be accessed by anyone with network access. Criminals will find it more challenging to conduct fraud or hide their activities as a result of this. Financial transactions will be easier to audit, and criminals will be easier to trace down. Individuals can also utilize a distributed ledger to build a digital identity that can be used to validate their identity online. The bottom line is that it will make most of the data that businesses handle more secure.