Blockchains: What Are They, And Do We Give Them Too Much Credit?

Blockchains: What Are They, And Do We Give Them Too Much Credit?

Blockchains are incredibly awesome.

Sometimes I think even I, don't fully understand what my last statement truly means.

Blockchains are inherently powerful data ledgers, with data fields that are unchangeable, unbendable, and almost impossible to manipulate or cheat.

stubborn.gif

Blaming Superman For Having Powers

With great power, comes great vulnerability - or isn't that how the saying goes?

Blockchains have kryptonite! Only that... get this... a blockchain's 'kryptonite' is also its sunlight.

superman.gif

Perhaps one of the most important aspects that make a blockchain - well, a blockchain, is that they are completely disconnected from the outside world.

This means that as much as a blockchain is a data-storage ledger, they have no conventional connection to actual data in the real world.

A blockchain does not know what day of the week it is, how many eggs are in a dozen, or how much wood a woodchuck actually chucks. They are completely clueless!

Crazy right? I first ran into problems with this, last night.

I sat alone in my room at 3 am, writing a smart contract for a less-cool version of GoFundMe.

In my GoFundMe, I provided a form field and a 'fund' button... ...a form-field in which my Uncle Ayo in the US could type in an amount (in dollars), hit the 'fund' button, and have that value he specified converted into Ether, and transferred from his wallet into mine.

Funds I'd probably waste on something meaningless this weekend.

waste.gif

My contract had a problem though.

The Ethereum Virtual Machine (or EVM for short) has absolutely no idea how much one Ether is in terms of dollars.

So it had no way of knowing how much my Uncle Ayo was trying to send me, and how much Ether to deposit into my wallet.

disappointment.jpg

That was a real head-scratcher for me, and I'll tell you why.

If the EVM was an organism, then Ether is its blood. So how come something so powerful can't even figure out how much its native currency is worth in dollars?

I found out that blockchains are isolated from accessing real-world data for a reason.

A blockchain as many know, is made up of nodes. These nodes are little parts of the whole, that keep track of the entire network's current state.

At regular intervals, these nodes reach an agreement (called a consensus), about what the network's internals look like, and act accordingly.

tired.gif

Was that hard to digest?

I apologize... Here's an analogy. Pretend for a second that you're a machine, and your eyes, ears and nose are your nodes.

Pretend that this machine that you now are, is dropped in the middle of a meadow. One that is filled with sunflowers.

  • Your eyes tell your brain that you're in a beautiful yellow place with blue skies and beetles in the ground.
  • Your ears corroborate this story by sending the sounds of the birds and bees in the meadow to your brain
  • And your nose can smell the flowers.

At some point, your brain accepts that you actually ARE in a meadow, because all its nodes agree. This is consensus.

think.jpg

I'm a good illustrator, eh? Back to my story... I was in the process of explaining why blockchain nodes aren't allowed access to the outside world.

Suppose instead of standing in the meadow, you're in a car, passing by on a sunny afternoon. Your car zooms through, exactly at 4:00.

  • At 3:55, five minutes before you reach the meadow: Your eyes can see the flowers, your nose can smell them faintly, but your ears can't hear the bees or birds.
  • At 4:00, you're driving through: Your eyes can see, your ears can hear, and your nose can smell.
  • At 4:05, right after passing by: Your eyes can no longer see, but your ears can still hear the bees and you can still smell the flowers

If you've been following, you'll realize that the record of experiences from your eyes, ears and nose would differ greatly from 3:55, 4:00 and 4:05.

  • At 3:55, you're already in the meadow according to your eyes and nose, even before reaching it.
  • At 4:00, all nodes agree.
  • At 4:05, you're still in the meadow according to your nose and ears, even after leaving it.

Do you see how it might be hard to reach a consensus if all the nodes of a machine disagree on what its current state is? If a blockchain's nodes are allowed access to data in the outside world (through the internet or otherwise), a simple network delay of a few seconds can create vastly different accounts of events on each of them.

Making consensus impossible.

That's where Chanlink's Oracle Network comes in

Oracle Networks: What Are They?

It might be easier to first understand what an oracle is. Oracles are any mechanism or devise that interacts directly with the blockchain, providing real-world data or computation to them.

A valid question might be: "If blockchains are decentralized to prevent manipulation, couldn't someone attack an oracle and manipulate data before it had a chance to reach the blockchain?"

And that question would be an intelligent one.

centralized.jpeg

A single oracle is both insufficient and 'too centralized' to power and support a whole blockchain. Having a single point powering a blockchain, defeats the whole point of having a decentralized network in the first place. Anyone could indeed attack this central point and do serious damage.

That is why what is used, is a network of oracles, called a Decentralized Oracle Network or a DON for short. A great example of which is ChainLink

decentralized.png

A DON is just as decentralized as the blockchain it powers, containing nodes that collect data, reach a consensus about what real events are and supply that computation to the blockchain.

Relating to my plan to ask my uncle for some weekend weekend 'Mulla', I can

  • Reference Chainlink's Data Feed protocol in my smart contract
  • Fetch the current price of Ether
  • Have my contract deduct that amount from his wallet
  • Transfer to mine.

In Summary

Hearing about a decentralized network's inability to connect to the outside world confused me initially. I started to realize later on, that this wasn't an 'inability' in the slightest bit.

The true decentralization of any blockchain is one of the properties that make its invention one of my favourite things besides homemade Jollof rice.

Every day, I wake up and marvel at the pure awesomeness that is the blockchain. It truly is an honour to be on this train to becoming a master blockchain developer.

Do we, in fact, give blockchains too much credit?

Heck no!

Sources And References

chain.link/education/blockchain-oracles

youtube.com/watch?v=FyEohWAyC7Q