Blockchain Explained | FROM ZERO TO HERO

hey there the following you're about to
watch is a presentation that i gave at passionate people it's blockchain
from zero to hero and i will shut up now without further ado
Enjoy! all right uh let me have a quick sip of
water um welcome everybody let's talk about
blockchain or whatever i'm gonna try and explain it as simple as possible and
uh we'll see where we go so blockchain from zero to hero. All right so this is
me this slide was not really properly updated uh
yeah i don't know oh cursor there we go let's put myself
over here real quick um but this is me colors don't match but that's that's
fine whatever um i'm luc if you still haven't seen me around or at the office
you should drop by the office on friday's sometime i'm usually there um
i'm gonna try and explain blockchain uh from zero to hero and it's gonna be
fun hopefully i'll i'll try all right so
blockchain zero to hero whatever here's the agenda i'm gonna start off with git
um yes that's a weird one but hear me out we're gonna get there then
we're gonna actually talk about blockchain because why not i'm gonna ask
for your money because i'm broke just kidding um we're gonna talk about double
spending and then about smart contracts yes i'm gonna try and explain smart
contracts as well we're gonna get there
um bear with me here all right so as per usual quick disclaimer
i am gonna go very fast this is a bit of a shorter presentation surprisingly i
managed to fit it into like a solid 10 minutes so don't worry you'll still have
time to eat your lunch and not look at a weirdo on your screen trying to talk
about blocks that are chained to each other um
and yes believe me it's short because it's
very simple and obviously as per usual i'm going to plug my own website like 10
more times um so (luc.computer) finally now blockchain from zero to hero
let's let's do this i hope you all remember
git which i i hope you do if you don't use
git and you use mercurial or something else then um
i would recommend seeking professional help but uh git is what we mostly use
every day everybody hopefully does uh it's version control blah blah blah but
for for simplicity's sake just so i've
reiterated this is a git repo right this is our lovely little git repo
right here we've got all the all the cool things i've got a finger to point
this time i'm gonna but i'm still gonna drag myself around because it's funny um
or at least i think it is funny so this is a git repo it has multiple
commits um
cool or whatever this is one of those commits uh this is my friend svemat i
was making a blog post on on pull requests and merging strategies and
svemat came in there and i guess he stuck so he's in all of my examples i'm
sorry but here's my friend svemat here's the commit message and here's the
hash i hope we're all familiar with this at this point if you don't know the hash
is a bit more of an obscure feature but essentially every git commit has a hash
and a previous hash and the hash is just a combination of all the information so
the changes that were made the files that were edited all that fun stuff
the name the author and the previous hash so we
know where it is in the chain that all gets combined hashed together and then
we get the hash sweet so dissecting our git commit is going
to look like this we have our git commit again introduce login button the author
svemat up because you know he wrote this he didn't but whatever i said so the hash
which is our lovely hash here totally not a secret value if you want to spot
all the easter eggs i recommend you go through the presentation later again
link to slides is at the end uh the previous hash which should be
different but ignore whatever lazy presentation making and the message and
obviously also the changes and all this other stuff so we use the previous hash
like i just explained to see where in the timeline it fits and all this other
fun stuff right and this way we do branching we do um
all sorts of cool stuff tagging a bunch of extra things
obviously there's a lot more to this but this is the simple version so uh that
was git you're welcome that's the end of my presentation pretty self-explanatory
right now i'm i'm i'm kidding obviously this is a presentation about blockchain
and obviously there's there's pull requests there's CI/CD there's code review
i'm protected branches much much more you
get the the gist get git it okay uh the gist of it but
this presentation was about blockchain right so let's talk about the blockchain
this is the blockchain that why are those
square wait um
hold on there you go now they're round why is it hold on one second um
-coughs on purpose-  there we go that looks a lot better uh that that seems very familiar
doesn't it okay wait wait wait i i get it get it
that you see where this is heading get it because i changed the
the heading haha no okay um so the blockchain is
essentially like git um there we go um obviously you know we
have our little repository or chain if you will um this is a commit or block if
you will this is again my friend svemat um this is the message sending five of
whatever this is to me and
i mean you get the gist right does that does that ring a bell have we seen that
five seconds ago on git yeah so so let's dissect this thing
right i made it a block this time because it is the blockchain but the
same story goes we have the author svemat much the hash
that thing the previous hash which should be a different value but whatever
um and we have the message
send five to lucemans.eth okay block block/commit uh similar thing
um so so fine fine does this
do we get somewhere here it's the exact same to a certain extent
it's just that the blockchain is kind of like a very
weird peculiar git repository okay so instead of the blockchain being
hosted on a central authority like github or gitlab or bitbucket
oh i already cried pronouncing that name um
nightmares (joke) so
instead of it being stored on a centralized authority like one of those
websites i just mentioned it is stored decentralized the only real purpose of
github is to have the git repository on my
computer sync up with the git repository on your computer same way that
for blockchain we said you know what we don't need a central authority we can do
this decentralized so you know whatever libp2p magic computer's communicating
with each other we call it consensus i'm not going to get into it because it's a
huge rabbit hole and every blockchain decides to do it slightly differently
proof of work proof of state all these crazy things
i'm going to keep it super simple today um tldr is that computers across the
internet libp2p communicate p2p point- to-point and they together agree what
the current state of our git repository uh sorry blockchain is right
so fine
but luc why is this a weird git repository um because this repository
has some rules just like your project might have some rules like your sprint
duration is three weeks or you can only commit on sundays because
your you know boss hates you this one has some rules too okay so
let's let's start off with the first one what's history is history
essentially what i'm trying to say with that is that
anything that has happened in the past anything behind this little arrow right
not right now is immutable so no force no force pushes no
reverting pull requests no rollbacks no nothing if you want to change something
add another commit to the top this is how we end up with i'm not going to
throw any shades of specific names um but how we end up with 303 000 commits
right if we can never ever ever clean up our git repo
we add commits but for the blockchain magic scaling decentralized infinite
computing power it doesn't really matter we can we can be very long but
on github a 30 000 commit repo is already problematic
let alone 300 so whatever state's immutable rule number
two um every x seconds block time seconds minutes microseconds depending
on the blockchain we must approve a pr okay we must we must add a new commit to
our history um for bitcoin this is 10 minutes uh and
i think if i have it correctly for ethereum it's 14 seconds so every 14
seconds a new commit or block if you will gets added to the ethereum chain so
so fine fine fine last but not least rule number three the
genesis block the genesis block is like the the
initial commit it's that one commit nobody can touch
um for some reason gitkraken crashes if you don't have one and it's what makes
up the entire git repository i think in most git repositories probably none of
you have ever tried because why would you but you can't edit the initial
commit without completely making a new repository because every commit
afterwards remember has this previous hash thing and then has that hashed into
its hash which then has it's in the next and the next and the next and it just
continues on so if you change something in history
every block afterwards needs to be updated which again remember rule number
one we we can't do that so the genesis block the the original the one the first
transaction something had to happen in blockchain's case i was going to show a
slide with a picture of it here but whatever they embedded a message in it
of a news article uh satoshi nakamoto long story short it's a whole fun easter
egg thing and you know there's some bitcoin being burned uh and some other
weird stuff that's besides the point i i understand that a lot of you are here
trying to learn something and i understand that people in the world like
to make money so the real question here "is am i rich yet?" um
let's do the depressing calculations note the word depressing so
in the same way that our git repository stores files right um as a list of
modifications like the history of modifications out of this line remove
this line um
the blockchain stores our things uh data numbers
value our money um our assets as
a history of changes just like in git right so so let's let's have a look at
our ledger which is our fancy word for "luc put it in a table" okay don't worry
don't worry don't get scared it's still this thing but just in table format okay
so right here we still have the hash we still have the previous hash this time i
put the effort to make them line up -fake cough- easter eggs 
um and as you can tell this  previous hash is this block's hash this previous hash is this block's hash right
so these are all lovely connected in a chain and they're all in the same
order for purpose for the following purposes i've added a few more people in
here and i've added a few more messages so we can see all this fun stuff um
going down now let's say we wanted to figure out
how much money i have because you know why not um let's first go ahead and
highlight every transaction here if you will or every block that includes me
because i'm selfish so here's me right we have over here we have me getting
something here we have me spending something here we have me getting
something at me getting something cool i'm making money now let's go ahead and
put those numbers next to it so for the top one we see that svemat is sending me
one of whatever unit this is um so we can do plus one for the second
one we can see that right here i'm sending svemat seven so he's kind of
paying me back one but whatever um and then below that we have antony
sending me five and svemat sending me three
um um so let's put those numbers next to it
right there we have one seven oh i need to sync this one up there you go um
one, (negative) seven, five, three great cool we're nothing with that but
these are our changes you remember how we have like lines added lines removed
think of it like that right plus one negative seven plus five plus three add
it all up together summit whatever and we get two
now if this were two ethereum i would probably not be giving this talk
i would probably be in timbuktu having a vacation um however this is two
of whatever unit i made up in our hypothetical blockchain
so great take all transactions add the numbers together that's how much balance
you have it's literally the same way that we clone a git repository it looks
through all of the commits and then obviously github cache is it but that's
besides the point it looks through all of the commits adds them all up together
to get the final form and that's what ends up on your computer those are the
files your ide ends up opening fine so
now that we've established that i'm broke
let's see how we can spend this non-existent money right can i spend it
is the question and to be able to figure out if we can actually
make a transaction if the transaction is valid or not
um we're going to do a very simple formula
super easy first
we're going to figure out whether what i have
is more than what i want to spend that seems pretty easy right we just
figured out how to calculate what i have now we have the number of how much i
want to spend and if what i have is more or equal to what i want to spend but
transaction fees so whatever more than what i want to spend
right if i have 10 bucks and i want to spend five that is more so we can spend
it it seems like kindergarten math it is
kindergarten math is just that instead of us doing it the computer's going to
do it for us so
how does this work blockchain wise or git chain wise if you will well it's
just a CI/CD pipeline right here
um we we have a check if can afford that does what we just did looks through the
entire git history checks all of our lovely commits and goes okay luc was
given five luc was spending five luc was given five whatever and at the end
it's two he's currently trying to send one is the two sorry is one more than
two sorry it's two more than one i can't math
um yes so we can we can spend it great and then
it approves the pr if not it denies the pr so essentially
what happens if if any of the pipelines fail
it will it will crash and then we will just not be accepting the pr it will
never get merged into master (or main) and it's like it's never happened
right so we can propose a transaction and then the blockchain will tell us
great we just made it happen for you or they will tell you nope sorry
transaction failed um and obviously just like how it might
take hours sometimes depending on if you're using php or not (-joke-) um to deploy
your CI/CD pipeline to a server it can also take
hours depending on how busy the current blockchain is right the github actions
runner um to run these these pipelines okay fine fine we have a blockchain it's
party time we we've built a blockchain and git congratulations but
but i hear you thinking there were some other items on the agenda
what what about the what about the so so how about the NFT
right where does that come from well those are from smart contracts
don't worry about it non-fungible tokens is just a thing that we made another
asset a a thing that you can't combine so you know two bitcoin becomes two
bitcoin and it's a thing and you can't add two nfts that's kind of kind of
weird they're non-fungible you can't you know shove them together it's not a
value that goes up or down it's two things you have like a glass of water
and a button to change the colors in your room um
so what is this well let's take the most
popular example solidity and let's put it
in the perspective of another github action because if we go back a few
guess what right here i hid solidity whoa
spoilers okay so you know fine solidity where does that come in so essentially
solidity is just another git of action that say i wanted to buy the duck nft i
don't know crazy example say i wanted to run the the buy function on that what
would happen is i would put in my commit message
duck nft colon by colon one right easy-peasy lemon squeezy um
obviously there's a bit more to it but that's the simple version of it
the github action will look at the commit message see that we're talking
about the duck nft figure out the file that was added in
another commit for the duck nft that the duck nft
author wrote and then it will just run the buy function and then enough github
runners will do that well in this case not github but enough miners will run
that function and as long as the majority says "yup
this pipeline completed successfully this pr can be merged" the pr gets merged
obviously it's not called buy it's called mint but
you get the point right we make a thing um so it runs another github action and
then the github action does its thing and if the majority of you know the 50
times we ran that github action if at least 25 of them said yup we can approve
this pr then pr gets approved because democracy or whatever and decentralized
consensus wow i i hear you say distributed git
sounds like we're back in the year 2000.

-Insert existential crisis about age here- so voila that that is the entirety of
blockchain that is pull requests that is
issues that is that is CI/CD that is smart contracts whatever solidity a
little bit that was blockchain from zero to hero
by me i'm your host luc again hi um thank you for listening there will be a
section for questions don't forget to check out the redesigned luc.show
website because yay it's not a white page anymore slides can be found right
here luc.show slash blockchain or scanning the qr code
that was it are there any questions probably.

As found on YouTube

You May Also Like