Safeguarding Transactions in Blockchain: Exploring Public-Key Cryptography, Hashing, Forking, and Trust

by Daniel Pham

Let’s delve into the technical aspects of blockchain and examine the fundamental elements of Trust in more detail.

Public-Key Cryptography & Hashing

1. Symmetric key

Symmetric key encryption, also known as a shared key, uses the same key for both encryption and decryption processes.

In a decentralized blockchain network, symmetric key encryption faces two significant issues:

  • It is vulnerable to key derivation, where the secret key can be obtained from the encrypted data.
  • Key distribution becomes a challenge, as securely passing the key to participating entities is not straightforward.

2. Public-key cryptography

To address these issues, public-key cryptography (asymmetric cryptography) is employed. It utilizes two distinct keys: a public key, which is openly shared, and a private key, which is kept secure.

In both Bitcoin and Ethereum blockchains, the Elliptic Curve Cryptography (ECC) family of algorithms is used to generate key pairs. ECC is considered stronger than RSA for a given number of bits. Interestingly, a 256-bit ECC key pair is equivalent in strength to approximately a 3072-bit RSA key pair.

3. Hashing

A hash function, or hashing, transforms an input data value of arbitrary length into a unique fixed-length value.

Two fundamental requirements of a hash function are as follows:

  • The chosen algorithm should be a one-way function, meaning it is computationally infeasible to reverse-engineer the original input from the hash output.
  • It should demonstrate a minimal probability of collision, ensuring that two different inputs do not produce the same hash value.

In Ethereum, various hashing functions play essential roles in generating account addresses, digital signatures, transaction hashes, state hashes, receipt hashes, and block header hashes. Popular algorithms like SHA-3SHA-256, and Keccak-256 are commonly employed for hash generation in blockchains.

When hashing a fixed number of items, such as those found in a block header, and verifying the overall integrity of the block, a simple hash function is used.

However, when the number of items varies between blocks, such as the number of transactions, states, or receipts, a tree structure, specifically a Merkle tree, is employed to compute the hash efficiently.

Transaction Integrity & Securing blockchain

Transaction integrity

To ensure the integrity of transactions within a decentralized network, several measures are needed:

  • Establishing a unique account address: A standardized method is employed to uniquely identify participants in the decentralized network.
  • Authorization through digital signing: The sender of a transaction provides authorization by digitally signing it.
  • Content verification: To ensure that the content of a transaction remains unaltered, a combination of hashing and public key cryptography is utilized.

Securing blockchain

In the Ethereum blockchain, Merkle tree hash is employed for computing the state root hash. This is particularly useful as it only requires recomputing the hash of chained states when transitioning from one block to another.

Each state change triggers the re-computation of the state root hash, ensuring the accuracy and consistency of the blockchain’s state.

The block hash in Ethereum is calculated by first computing the state root hash, followed by the transaction root hash, and finally the receipt root hash. These three components are essential for forming the block hash, which is located at the bottom of the block header.

The block hash serves two crucial purposes:

  • Verification of block and transaction integrity: By comparing the calculated block hash with the stored block hash, the integrity of the entire block, including its transactions, can be confirmed.
  • Formation of chain links: The previous block’s hash is embedded in the current block header, creating a chain of blocks.

Decentrialized system & Consensus protocol

Trust in decentrialized system

In a decentralized blockchain, establishing trust involves ensuring the security, validation, verification, and availability of resources necessary for executing transactions.

These trust-building processes can be categorized as the Trust Trail, which encompasses several key operations. These operations include:

  1. Validating transactions.
  2. Verifying the availability of gas and resources.
  3. Gathering transactions.
  4. Executing transactions to generate a new state.
  5. Forming blocks.
  6. Working towards consensus.
  7. Finalizing the block by the chosen bidder.
  8. Having all participants add the block to their chain and confirm the transactions.

By following this Trust Trail, blockchain networks establish a reliable and transparent framework for conducting secure and trustworthy transactions.

Consensus protocol

1. Proof-of-work (PoW)

Proof of Work (PoW) is a consensus algorithm widely employed in blockchain networks to authenticate and validate transactions.

Proof of Work serves as a consensus mechanism utilized by both the Bitcoin and Ethereum blockchains, albeit with distinct implementations tailored to each network’s specifications.

2. How PoW works?

In this process, miners undertake the computation of the block header’s hash, which involves fixed elements, alongside a variable known as the nonce.

The objective is to achieve a hash value below a certain threshold, such as 2¹²⁸ for Bitcoin and a difficulty-dependent function for Ethereum. If the computed hash falls below the threshold, the puzzle is considered solved. Otherwise, the nonce is modified, and the process is repeated.

Once a miner successfully solves the puzzle, the winning block is broadcasted to the network and subsequently verified by other miners. Non-winning miner nodes incorporate the new block into their local chain copies and proceed to work on the next block in the sequence.

Exception handling & Forking

Handling exceptions in Bitcoin and Ethereum securechain

1. Bitcoin securechain

In rare cases, there is a slight possibility of the main chain splitting in Bitcoin. However, the bitcoin protocol includes mechanisms to reconcile and consolidate it into a single chain within a cycle, minimizing any potential disruptions.

To handle transactions and prevent double spending in Bitcoin, a policy is implemented to accept only the first transaction that references a specific digital asset, while rejecting subsequent transactions referencing the same asset.

2. Ethereum securechain

In Ethereum, the presence of Omar or Runner-Up blocks allows for multiple participants. These Runner-Up blocks are incentivized, ensuring the security and stability of the chains.

A combination of an account number and a global nonce is employed to address the issue of double spending, providing an effective solution to maintain transaction integrity.


Soft forks and hard forks in the blockchain world can be compared to software patches and new operating system versions, respectively.

1. Soft forks

A soft fork involves minor adjustments to the existing processes, often accomplished by introducing a new software while the current processes continue to run.

2. Hard forks

On the other hand, a hard fork signifies a significant change in the protocol, requiring a more substantial transition.

One notable example is the Ethereum hard fork that was planned and executed on October 17, 2017. This fork included several Ethereum Improvement Proposals (EIPs) such as:

  • Introducing parallel processing of transactions.
  • Maintaining the Proof of Work consensus, with the exception that every hundredth block utilizes the Proof of Stake consensus protocol.
  • Reducing the minor incentive for block creation from 5 ethers to 3 ethers.


Understanding the technical aspects of blockchain and the elements of trust, such as public-key cryptography, hashing, forking, and consensus protocols, is essential for secure and reliable transactions. These measures ensure data integrity, transaction authentication, and the stability of blockchain networks. By implementing these techniques, blockchain systems can provide a trustworthy framework for conducting decentralized transactions.