Blockchain Interview Question
Blockchain Interview Question
Blockchain Interview Question
&
One Pager Cheat Sheet
Interview Questions
BY – VIKAS MAURYA
YOUTUBE
1. CODE WITH VIKAS
2. VIKAS MAURYA ACADEMY
1. Discuss the transparency offered by blockchain in the context of intermediaries.
The blockchain is a specific implementation of a distributed ledger that inherits transparency by design. With
centralized registers, we typically have to go through one or more intermediaries to ensure the transparency of a
transaction and build a consensus on the current owner of an asset. However, the distributed ledger
system stores all information on a distributed network that is accessible by anyone in the network.
You wouldn’t have to go to banks to transfer money or involve Uber to hail a ride service. Similarly, you don't
need to involve brokers in your real-estate businesses because blockchain is a trust protocol and it'll ensure the
transparency necessary to verify the ownership of the asset by the seller.
As an example, suppose a company is selling its digital tokens on the Ethereum blockchain. Etherscan is a tool
that enables you to explore and search the Ethereum blockchain for transactions, addresses, tokens, prices, and
other activities taking place on Ethereum.
2. What is Encryption?
In a historical context, encryption is the act of codifying a message before sending it to the receiver. This
ensures that third parties may never get their hands on our private messages.
You might recall the notorious Enigma Machine, from World War II, largely used by the rivals of Democratic
States to encrypt sensitive messages. And you may have seen the Imitation Game-- which starred Benedict
Cumberbatch as Alan Turing-- who helped British in decrypting the Enigma code. In simple terms, encryption
means to systematically convert your message into code before sending it to the receiver.
3. What is asymmetric key encryption and how it is different from the symmetric key
encryption?
To understand asymmetric key encryption, let's first take a look at what symmetric key encryption is.
With symmetric key encryption, the big idea is that you use the same key for encrypting and decrypting your
code. Consider the following example where I've written an encrypted message:
I have encrypted it by shifting the original alphabet three times in the forward direction (using ‘c’ for ‘a’ and ‘z’
for ‘w’). In this case, 3 is my encryption key. Therefore, this message can be decrypted by using the same key
(i.e. 3), but in the backward direction. Do that and you will get my original message:
This is the symmetric key encryption where a single key is being used for encryption and decryption. However,
nowadays, cracking symmetric key encryption is rather easy. Therefore, blockchain incorporates public key
cryptography via asymmetric key encryption.
Suppose that participant A from the United States wants to do a transaction on a blockchain network with a
participant Z who is in Asia. A will send the transaction data to Z, by first encrypting it with its own private key
and then encrypting it again with the public key of the Z. Following that, Z can decrypt it using their own
private key and then decrypt it again using the public key of the A. This double encryption and decryption will
ensure that only Z can read the data and only A could have sent this data.
4. What is Hashing?
Hashing is the process of taking an input of arbitrary length and converting it into a hash (a modified, outputted
value) of a unique and fixed length. Hash functions are used to generate the encrypted output. This process
plays a vital role in maintaining the integrity of transactions and confidentiality of data in the blockchain
environment.
A hashing algorithm is selected based on a certain number of features. The most important one is that a hashing
function must either be collision-free, or allow for an extremely low probability of collision. Theoretically, it is
rather impossible for a hashing algorithm to be absolutely collision-free. However, practically speaking, this is
generally achieved by using a very large number of bits in the hash value. This is done in order to make sure
that no one can derive the secret items from the hash value, and also to make sure that one hash value uniquely
reprints a single data set. SHA-3, SHA-256, and Keccak-256 are some of the hashing algorithms used for this
purpose.
The probability of generating a single hash value for two different transactions for a 256-bit code would
be 2^256 (which is an extremely low chance).
To ensure the integrity of a transaction in the blockchain environment, first-- the participants must be correctly
identified in the distributed environment. This is done by getting the right identifying addresses of the
participants. Second, it must be verified that the sender is authorized to proceed with the transaction. Finally, we
need to check that the content of the transaction has not been manipulated or distorted.
Let’s see how a clever combination of public-key cryptography and hashing is used to ensure the integrity of a
transaction.
Using a public key/private key pair, addresses are generated. A random number of 256 bits is generated as a
private key, secured by a passphrase. This private key is typically run through an elliptic-curve
cryptography (ECC) algorithm to generate a public key. This is what we refer to as the public-private key pair.
Following that, the hashing function is finally applied to the public key in order to obtain the address.
Now that we have the address, a transaction can be initiated. The transaction data is hashed and encrypted. This
is our digital signature. The receiver gets both the original data and a digitally signed, secured hash. The
receiver can then decrypt and get the hash of original data to compare it with the received hash ensuring the
integrity of the document. To recap:
• Hash of the data fields in the transactions is identified.
• After that, the hash is encrypted by the private key of the participant who initiated the transaction.
Essentially, this will be the digital signature authorizing the transaction.
• This hash will then be verified by others on the distributed network. A complex process is followed
where the sender’s public key is used to recompute the hash of transaction in order to compare it with
the hash received through digital signature. A match means the transaction is verified. Other
verifications, including but not limited to the verification of account balance, timestamp and nonce are
also done for a complete transaction.
Since we know that in a blockchain-based protocol, blocks are chained together. Each block contains the
transaction details and the hash of the previous block. A genesis block is the very first block of a blockchain-
based protocol. Therefore, it doesn’t contain the hash of the previous block and every blockchain has its own
genesis block.
Blockchain has been categorized into public, private, and consortium blockchains. The primary point of
distinction between these blockchains is the freedom of joining the network, verifying the transaction, initiate
the transaction and availability of the ledgers for a review.
Public Blockchain allows public access. Anyone can join the network, verify the transaction, and initiate a new
transaction. The ledgers are available for public view and anyone can track the blockchain to the genesis
blockchain. Bitcoin is an example of a public blockchain.
Private Blockchain restricts the public from joining the network by creating certain entry criteria and to make
sure that only authorized people can initiate and verify the transaction. Although the ledgers are available for
everyone with internet access, people controlling the flow of information on the blockchain are pre-determined.
This is usually employed within a single organization.
Consortium Blockchain is a hybrid of public and private blockchains. A Public blockchain is considered to be
the least trustful while the private blockchain is considered to be highly trusted owing to the limited number of
people involved. The consortium blockchain is implemented for a wider group of participants having predefined
nodes. You may consider employing it for transactions between multiple organizations.
Just like the traditional contracts that we use in our daily lives (from purchasing a car to selling a property),
smart contracts are a digital contract in the form of a computer program that is stored inside a blockchain. In the
distributed environment of blockchain, smart contracts make sure that the participants comply with the agreed-
upon terms and conditions.
Traditional Intermediaries
Though it’s not a very ethical example, consider a betting website that allows the fans to place a bet on the
football match. It requires people to fund their bets beforehand.
People tend to bet through a betting website because they do not know each other, and they do not trust each
other. Thus, the website works as an intermediary and ensures that the people get their money if they win the
bet. The trust that people put in the betting website is owing to the fact that the website charges service fees.
Therefore, win or lose, the website always wins. But iff the website isn’t well established, those who manage
the website may run away at any time. So, this threat always remains.
Blockchain enables people to place a bet without an intermediary. People do not trust each other! Do not worry.
They don’t need to. They will trust the Blockchain Protocol. This is where the smart contract comes into action.
Once the bet is funded, the smart contract will automatically release the funds to the right person as soon as the
conditions get fulfilled. So, if a person placed a bet in favor of team X, then the blockchain network will verify
the outcome of that match from various sources and release the amount immediately.
For starters, because the funds aren’t stored in one single place. They are distributed over the network and
cannot be manipulated by anyone. Moreover, they are immutable in the sense that an agreed-upon can never be
changed. There are no chances of anyone tampering with your smart contract. Since the smart contract is
distributed, it will be verified by everyone involved in the network. So, a single-sided attempt of releasing the
funds will be labeled as invalid and will be discarded.
All blockchain protocols rely on digital, decentralized, and distributed ledger models where the trust comes
from the network itself. The designing principles of a blockchain include:
• Network integrity
• Distributed power
• Value as an incentive
• Security
• Privacy
• Inclusion
Blockchain incorporates all of the above-mentioned principles by design. You wouldn’t need to emphasize
improving the privacy or security of the blockchain, as it would have these properties innately. The trust
protocol depends on the mass collaboration of people. This collaboration comes from the individual interest
derived by the incentives that blockchain offers to the miners.
Miners are the people who own the systems that are nodes of the distributed environment of blockchain.
Essentially, miners do nothing but own the system, and the system does the work for them. They verify the
transaction and compete to find the right nonce for the new block. A nonce, a number only used once, is the
number miners are racing to find. The miner who wins the race gets rewarded with the cryptocurrency.
Although blockchain is a revolutionary technology, it's critical that it be understood and employed carefully.
The following are some of the limitations of blockchain.
1. It is a very technically involved and potentially confusing concept. Even developing a good grip on the
basics of blockchain can be difficult. Therefore, a high level of expertise is required to correctly
understand what's occuring during a transaction.
2. Even the slightest error while structuring the smart contract may lead to catastrophic outcomes.
3. It requires a huge network of users to work effectively. Furthermore, the strength of the blockchain
network depends on the strengths of its nodes, incentivized by the network itself. The networks that
don’t provide high incentives are not as strong as the bitcoin network.
4. Sometimes, immutability of transactions can be a problem.
5. The scalability of the network is yet another issue in the blockchain. A single transaction
involving bitcoin takes around at least 10 minutes.
One Pager Cheat Sheet
• The blockchain provides transparency and trust by eliminating the need for intermediaries, ensuring a
consensus on the ownership of an asset.
• Encryption is the process of using codes to securely protect messages from unauthorized access.
• Asymmetric key encryption is a more secure method of encryption than symmetric key encryption, as it
uses a pair of two keys - a public and a private key - instead of a single key for both encryption and
decryption.
• By using large numbers of bits and selecting hashing algorithms with a low collision
probability, hashing works to ensure that a unique hash value is generated for each data set, thereby
protecting the integrity and confidentiality of the transactions stored on the blockchain.
• The integrity of a transaction in the blockchain environment is ensured by combining public-key
cryptography with hashing functions to generate addresses, produce a digital signature, and verify the
hash of the transaction.
• The Genesis Block is the first block of a blockchain-based protocol, and doesn't contain the hash of the
previous block.
• A public, private and consortium blockchain are distinguished by the freedom of joining the network,
verifying and initiating the transaction, and the level of availability of the ledgers for review.
• Private blockchains are the most suitable type of blockchain for supply chain management as they allow
for entry criteria, provide predetermined flow of information and provide access to the ledgers,
increasing trust across multiple organizations.
• Smart contracts are computer programs stored in a blockchain that ensures participants comply with
agreed-upon terms and conditions, eliminating the need for intermediaries and providing an immutable,
secure system that cannot be manipulated by anyone.
• Smart contracts can only verify that payments have been made through the blockchain, and so there is a
potential for fraud as the contractual terms regarding the transfer of ownership of physical assets cannot
be enforced or verified.
• Blockchain is a trust protocol based on mass collaboration with the aim of providing digital,
decentralized, distributed ledger models, while incorporating principles such as Network integrity,
Distributed power, Value as an incentive, Security, Privacy and Inclusion by design.
• Miners are rewarded with cryptocurrency for successfully finding the unique nonce, a number only
used once, by competing to solve a puzzle in the distributed blockchain environment.
• No, hashing and mining are two different processes used for different purposes on the blockchain.
• While blockchain offers a lot of advantages, its technical complexity and issues such as scalability,
immutability, and network strength can make it difficult to implement and exploit.
• Blockchain transactions are verified using a process of asymmetric cryptography that involves a public
key and private key in order to securely validate transactions.