DEV Community

CoinMonks
CoinMonks

Posted on • Originally published at Medium on

Ethereum under the hood- Part 5 ( Fortniting Ethereum).

Update: Grammer fix

This episode assumes that you have gone through Part-1, Part-2, Part -3, Part-4 of this series, if you have not done so please do. If you are coming in from Part-4 and expecting to read about Patricia Merkle Trie in this episode there some concepts to digest and in the later chapters we will be talking about Patricia Merkle Trie and some latest developments in the Ethereum world.

Disclaimer: I don’t work for Epic Games or have coded anything on Fortnite, and also I am not an expert gamer, love games.

Tip: if you have not read Part-1 through 4, I got a sweetener for you; scroll down to Appendix-Ato get a bite-size recap.

  1. Keys and Values.
  2. What Next?:

Before we get deeper into the weeds on what’s going on under the hood though I can express some of the concepts which I think will be useful as we cruise along. Some of these concepts can be abstract; I will try to explain with some real-life examples; we then will glue them all together into a sweet ethereum pie. The idea is not to master each one of these topics but to get a sense of a tiny bit of understanding.

Keys and Values :

We start with Keys(k), and Values(v). You will find this throughout the different papers of Ethereum. You can think of them as a Tup le, and they represented as {k, v}.

A key is like a secret treasure map which you have earned to get to the Loot. But wait you don’t have the whole route, you have just had a specific direction to which you can follow to get to the loot, ponder on that for a while.

I am going to one use a fortnite map below and in our all of the root to reach to Moisty Mire where my loot is going to be, and let’s imagine you are going to be dropped off at the Starting Point of your Treasure Map. One more thing to add, in our FortNiteUniverse we make our own rules, like the one below:

FortNiteUniverse: Rules

note: I am going to add these fortnite rules in the GitHub gist as we move along.

Source:http://fortnite.wikia.com/wiki/Moisty_Mire?file=Moisty_mire.png

Let’s list all of the Places on the map with some order. Now pause and think before ordering those places. I am going to list them as something like what you see below:

{Junk Junction, Anarchy Acres,Haunted Hills, Pleasant Park,....}

So I ordered them by the most challenging way of getting to “ MOISTY MIRE” and let us add now let’s create a new rule here and use the two digits of the places(k) in the Map, e.g., Haunted Hills is going to be “ HH

{ { RR,AA,HH,PP… } , “MOISTY MIRE” }, hence {Key, Value}

Now Imagine that there is much such hidden loot(s) like the one I call “IAMINA CULT” and you have another Map which you just earned.

{ {DD,RR,FF,… }, “IAMINA CULT” }

So let’s play another game, imagine adding all those Key(s) in one big bucket which we call FortNiteKeys and Value(s) and in another called FortNiteValues and the FortNiteUniverse is a collection of Keys and Values which we can represent the FortNiteUniverse, FortNiteKeys , FortNiteTreasures formally as:

FortNiteUniverse Data Structure

What Next?:

I laid In the next episode we will create a lot of rules and will add one specific law called for a short cut for all those pesky FortNiteKeys and FortNiteTreasures, and we will call this Hashing . Till then, keep on learning.

References:

(key,value) pair in account storage and corresponding modified Merkle patricia tree

APPENDIX- A

Source: recap-1.md


Top comments (0)