Hi! In this video, we’re going to do a blockchain demo. We’ll be using a website we’ve seen before. Before we start, I’d like to thank Andrew Brownwood for making this website public so that everyone can benefit from it.
Understanding SHA-256
We’ve previously discussed the SHA-256 algorithm. Since it’s a cryptographic hash algorithm, it has certain key properties:
Introducing the Block and Nonce
Let’s dive into the concept of a block. Here, we introduce the nonce value. A nonce is a number that miners manipulate to find a hash that satisfies certain conditions.
Miners use powerful computers to mine blocks and earn block rewards. To ensure fairness and security, the system sets a difficulty level—defined by the number of leading zeros required in a hash.
For example, if the difficulty is 4 leading zeros, a valid hash might look like "0000..." and the system adjusts this difficulty dynamically based on how many miners are participating.
Difficulty and Probability
To better understand difficulty, consider flipping a coin:
Similarly, increasing the number of required leading zeros decreases the chance of randomly finding a valid hash, making it more difficult.
If mining becomes too easy or too hard, the blockchain system adjusts the difficulty accordingly to maintain balance.
The Role of Miners
Miners collect transactions from the transaction pool, then use their hardware to find a valid nonce value. Once a miner finds it, they broadcast the solution to the network. The new block is added to the blockchain, and others adopt this new block.
If two miners are competing to find the same nonce, the one with the better hardware will likely succeed first. The other miner, despite their effort and energy usage, won’t be rewarded.
Real-Time Example
Let’s look at a practical example on the website:
The longer it takes, the higher the nonce value that’s being tried. This also reflects the computational effort required.
Summary
We’ve explored how SHA-256, nonces, hash functions, and difficulty levels work together to secure blockchain networks. In the next lecture, we’ll continue exploring more aspects of blockchain technology.
Swap insights and ask questions about “Build on BNB Chain - Course 1 | BNB Chain Fundamentals”.
Ask a question or share your thoughts about this lesson.