FAQ: Introductory Blockchain Concepts - Visualizing Blockchain

This community-built FAQ covers the “Visualizing Blockchain” exercise from the lesson “Introductory Blockchain Concepts”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Introduction to Blockchain

FAQs on the exercise Visualizing Blockchain

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

In the test that follows and I’ve already done, there is an answer in a question which mentions “There is another input that can also produce … (a specific hash)”.
How can it be true? We’ve learned, based on the deterministic property of blockchain, that “the same input will always produce the same output…”.
Moreover, following the hash definiton " A fixed-length string of a varying combination of letters and numbers produced from a specific input of arbitrary size".
So, from the previous two definitions, I conclude that each distinct input (which differs from any other), will produce a different hash.
Could you please explain?

The hash function produces outputs of a fixed size, lets say 10 characters, but takes inputs of arbitrary size.

Now lets imagine that we calculate the hash of all the possible inputs of 11 characters, since our hash function only produces hashes of size 10 characters, there will be 10 times more different inputs than the possible outcomes. This will lead to different inputs having the same output.

This seem like a problem but in practice the number of different outputs is so large that the possibility of different inputs having the same output (collision) is irrelevant.

I just finished the quiz and I have some questions,

  1. so if miner’s purpose is to verify a unconfirmed transaction, what’s in it for them to spend their computing power and electricity to verify other’s transaction?
  2. There’s a question that asks “How can a block become valid after being tampered with?”, and the answer was “The tampered block’s hash value changes while the next block still holds the tampered block’s previous hash value.” How does this make sense? I thought the whole point of hash is that it changes whenever any little detail is changed. So if the current block is tampered, thereby resulting in a different hash value, wouldn’t the next block have a different “previous hash” value than the invalid current one?
  3. If theoretically hash collisions are allowed to happen with different combinations of transaction data, previous has, and previous timestamp, would it be theoretically possible to produce a fake block with the same hash value and substitute that?
  4. If the network takes the longest chain and the 51% consensus as the basis of validity, what’s stopping DDoS style fraud on the blockchain where certain hackers put as many computers around the world as they can as a client with fraudulent blockchain, taking up 51% majority?

sorry for the overwhelming questions, I’m just excited and confused at the same time :frowning:

The possibility that two inputs gives the same output (hash collision) comes from the fact that at it’s core a hash function is still just a function that takes input and based on some complex calculation results in an output.
Let’s oversimplify this:
Imagine we took a two-digit password from users and stored the hash. If we assume that our hash function was based on multiplication. Then if a user used 34 , the hash would be 12.

If a hacker came along and used 12 or 26 or 34 the hash would also be 12.

Although hash functions are more complex than what i described above, as long as we have some sort of formula we use to calculate a hash, there’s a chance, no matter how small that two inputs can give the same output.

For your second question. If the data of the current block is tampered with, then yes the hash changes as that is the point of hashes; they produce different output with different input.
However the next block still has a reference to the old hash of the previous block as this is the whole point of block chain, to have an immutable record of data.

Just imagine you write an exam and you score 20%. Your teacher has this record on your script and hardcopy result sheet, then he uploads it to the school’s website.

If you hack into the site and change your score to 90%, the record on the site changes.
Now if before certificates are issued the teacher has to compare the online and hard copy results, he’ll find out yours has been tampered with.

This is the whole point of block chain , ensuring we have data integrity and you can’t just go around changing transactions data.

It involves using visual aids such as charts, diagrams, and flowcharts to make complex blockchain-related information more accessible and comprehensible to a broader audience.