# What is IAVL?
## Let’s start with ‘AVL’.
It’s short for AVL tree (named after inventors Adelson-Velsky and Landis). It’s as simple as that.
The “I” in IAVL stands for immutable, which simply means unchanging over time, or just simple unchangeable.
So we have an immutable tree, named after its’ inventors. Before we focus too much on what makes this unchangeable, let’s talk about how the tree works.
An AVL Tree is basically a mathematical formula which allows for the organization of little information bundles in an efficient way. It’s also very cool because it’s mathematically self-balancing and can move those bundles of data around to be more effecient, while still referencing that data correctly.
It sort of takes buckets of data... and spins them around to make space according to which buckets are smaller and which buckets are bigger.
## What makes it immutable (or unchangeable)?
So what makes it immutable? Well… when using Blockchain we want to make sure that this data tree system is useable (because it’s awesome) but we also want to make sure that everyone (the validators) agrees that the data is correct. If we don’t all check in with each other, talk about it and agree on the data this tree has, then the chain would halt. And the complicated part is we have to agree on *exactly what data is in this tree, to the exact 1 or 0 byte.*
So we employ something called ‘hashing’ which just simply means that we all agree to take that entire tree of data and run it through a super nifty algorithm AGAIN. This time the algorithm basically looks at all the data and does a series of cryptographic calculations to spit out a bunch of numbers and letters which represent the original data (in a smaller and more efficient way).
## Hashing Algorithms
So if I take the words “Hello Cosmos” and try to hash it with an algorithm, we might return something like this:
`60b32da9e6a0df5f2bbe871f1e6f26a3 (MD5 Hash)`
And if I write it lowercase and just take the words “hello cosmos” and try to hash it with that same algorithm, we might return something like this:
`a908114ff7bde4f1a4738d0788c17af3 (MD5 Hash)`
And if I take the **entire script** (150 pages long) for ***“Star Wars A New Hope”*** and run that through the *same algorithm*, I still get a very small result - just like with the little baby sentences up above:
`ee2a915018e249fe9b194dd6667fe587 (MD5 Hash)`
This cryptographic result is always going to be the same result if the data is exactly the same, but if we change just one letter in the entire script... it will change the resulting hash. The hash will look *totally different*. We now have a way to represent a really big amount of data with a really small amount of data (in a way we can prove mathematically). I don't need to read the whole script to you, while you verify each letter in real time - I can just tell you the hash and you can compare it to your hash.
## Consensus & The Star Wars Fanclub Meeting
So what’s cool about this? Well, the nice thing about this is that me and all my validator friends can get together in a room for our weekly ***“Star Wars: A New Hope"*** meeting and we can all sit around a table with our scripts and read them together. We can read the script from start to finish (which takes some work and time).
But after a little while, me and all my validator friends finish reading the script and we all want to talk about it. However... first we need to make sure that everyone *actually read the script…* And it’s also really important for us not to trust anyone, so we need to make sure that nobody was sneaky and changed the script to include Jar Jar Binks - so we want them to prove they read it too.
So… one way we could do this... all 149 of us to watch one person at a time turn their script around and start reading it AGAIN (and we watch them read it this time). All 149 of us make sure every single letter is exactly the same, and that nothing has been changed, as compared to the scripts we’re holding. This will take a lot of time, but it can be done. The problem is… we have to do that 149 more times (including our turn) letter by letter, byte by byte.
But luckily we have this super cool hash thing. So instead we say, “Hey! Everyone stand up and show me your HASH. Hold onto your script - keep that. But I just want to make sure we have the same hash. Because when I put my script through this super cool algorithm, it told me that my script HASH is: ee2a915018e249fe9b194dd6667fe587 (MD5 Hash)
So now every validator can verify that a piece of MATH correctly represents that correct data. Because if even one letter changed from “A” to “a”, the entire HASH would be different.
Go ahead and try it.
```
Copy the entire script of Star Wars here: https://imsdb.com/scripts/Star-Wars-A-New-Hope.html
Copy and paste it into this hasher here: https://www.md5hashgenerator.com/
Copy the resulting hash down in a note somewhere.
Now… change just one letter in the title from: STAR WARS to sTAR WARS.
Run the algorithm again, and look!
Your hash will be completely different.
```
This process is what makes the lovely AVL tree IMMUTABLE and turns it into > IAVL.
We use cryptographic processes like this to verify that all our friends in that same room are reading the same script, word for word and we can do it super efficiently using math. And if one of our friends tries to put Jar Jar Binks in the script… we kick him out the Star Wars Fanclub forever.
## Now... in Real Life Examples
In the case of Cosmos… This script isn't what we're reading, it's our **Blockchain Ledger** and the *Star Wars Fanclub* is the particular network we validate like **Juno Network** or **Cosmos Hub**.
If our friend tries to sneak *Jar Jar Binks* into the script, we call that a **"double-sign"** and getting kicked out of the club is called getting **"hard-slashed"** or **"tombstoned"**.
This AVL tree *(named annoyingly after inventors Adelson-Velsky and Landis)* make organizing data efficient and balanced - continuously. Cryptography like hashing makes it immutable or “unchanging” and turns it into IAVL.
This results in a really cool scenario where all 150 validators can sit in a room at their own laptops, watch George Lucas writing a script in real time and George Lucas can change around letters, numbers and characters all day - and every validator can do some magic-math using algorithms to compare their hash in real time as these changes are made.
This allows us to all be in agreement every time George decides to adds a new character into a scene - or every time George decides to capitalize a letter or even backspace a typo. We never forget what he wrote in the past - but we can record every minute data change and we can all agree on the perfect mathematical historical record of “George’s Writing History”.
And if anyone lies about what George wrote or tries to sneak in Jar Jar Binks... they don't get to be in the Star Wars Fanclub anymore and we only need to compare a little string of numbers and letters like `ee2a915018e249fe9b194dd6667fe587 (MD5 Hash)` to be certain.