Skip to main content

Hashing, Cryptographic Keys, and Mining

The Role of Cryptography in Blockchain

Cryptography is the foundation of blockchain security. It is used to protect data, verify the authenticity of transactions, and ensure the immutability of the distributed ledger.

The key cryptographic tools used in blockchain are hash functions and asymmetric cryptography based on public and private keys.


Hash Functions and Their Properties

A hash function is a mathematical algorithm that transforms input data of arbitrary size into a fixed-length string known as a hash. When cryptographically secure hash functions are used, recovering the original data from the hash is computationally infeasible.

For use in blockchain, hash functions must possess the following properties:

  • Determinism — the same input data always produce the same output.
  • Collision resistance — it is computationally infeasible to find two different inputs that produce the same hash.
  • One-way property — deriving the original data from the hash is computationally impractical.
  • Sensitivity to input changes — even a minimal change in the input data results in a completely different hash.

These properties make hashing an effective tool for ensuring data integrity. In the Bitcoin blockchain, the cryptographic hash function SHA-256 is applied twice (SHA-256d).

A minimal change in the input data completely alters the resulting hash.
For example, the SHA-256 hash of the Russian phrase «онлайн-учебник» is
3f74125cae635a27408541bb29f20fec27f7889721d9dc9c9d53139eb9eed83e,
while replacing the hyphen with a space («онлайн учебник») produces a different hash:
eb62b8041d53badd206cee5cabf0a170be2d75619c97fd4153ef9c1a0b3a502d.


Public and Private Keys

Blockchain relies on asymmetric cryptography based on a pair of keys:

  • Private key — a secret cryptographic value known only to its owner.
  • Public key — a value mathematically derived from the private key and intended for public distribution.

The private key is used to create a digital signature, while the public key is used to verify it. This allows any network participant to confirm that a transaction was initiated by the holder of the corresponding private key.

A public key can be derived from a private key, but deriving the private key from the public key is not feasible.


Digital Signatures and Transaction Verification

When creating a transaction, the sender signs the transaction data using their private key. The digital signature is attached to the transaction and propagated across the network.

Network nodes verify the validity of the signature using the sender’s public key. If the signature is valid, the transaction is considered authentic and can be included in a block.


The Mining Process

Mining is the process of finding a cryptographic solution required to add a new block to blockchains that use the Proof-of-Work consensus mechanism.

There are various consensus mechanisms—rules by which network participants agree on the order and validity of new blocks. A participant involved in the mining process is called a miner. The miner’s incentive is to receive a reward for successfully adding a block.

Miners collect unconfirmed transactions into a block and perform computations aimed at finding a block hash that satisfies the predefined difficulty requirements. The structure of a block is discussed in more detail in Section 1.2.

Mining can be performed individually (solo mining), but the probability of successfully finding a block in this case is extremely low. As a result, miners often join mining pools, which allows blocks to be found more frequently and helps smooth income volatility.


Proof-of-Work and Proof-of-Stake

A consensus mechanism is a set of rules by which network participants agree on the state of the blockchain and the addition of new blocks.

One of the most widely used consensus mechanisms is Proof-of-Work (PoW), in which the right to add a block is determined by solving a computationally intensive problem. The main drawbacks of PoW are high hardware costs and significant energy consumption.

As an alternative to Proof-of-Work, many blockchains use the Proof-of-Stake (PoS) mechanism. Under PoS, the right to propose and validate blocks is granted to participants (validators) who lock a certain amount of crypto-assets in accordance with protocol rules. The probability of being selected depends on the size of the stake and the specific implementation parameters.

Compared to Proof-of-Work, Proof-of-Stake is significantly more energy-efficient, as it does not require resource-intensive computations. This is why Ethereum transitioned from PoW to PoS in 2022.

Other consensus mechanisms also exist and are typically variations or specialized forms of PoW and PoS (for example, delegated Proof-of-Stake). Some mechanisms, such as Proof-of-Capacity, are used in niche blockchains and have not gained widespread adoption.

Block difficulty is automatically adjusted to maintain a predefined block creation interval, regardless of the total resources available in the network.


Block Rewards

For successfully adding a new block, a network participant receives a reward, which may include:

  • the issuance of new units of crypto-assets,
  • transaction fees from the transactions included in the block.

In the Bitcoin blockchain, the total supply of coins is capped at 21 million. Once this limit is reached, block rewards will consist exclusively of transaction fees. This mechanism incentivizes participants to maintain network security; however, its long-term sustainability depends on the economic value of the crypto-asset and the level of transaction activity.


Summary

Hashing, cryptographic keys, and consensus mechanisms provide:

  • protection of data and transactions,
  • verification of transaction authenticity,
  • resilience of the blockchain against attacks.

Understanding these mechanisms is essential for analyzing blockchain security and evaluating its economic and technical characteristics.