A Blockchain and Solidity Intro for Beginners

Urbe Campus ETHRome Edition 2024 · October 2024 · 25:34

Software engineer Fabrizio Gianni introduces blockchain and smart contract writing for beginners at Urbe Campus, ETHRome edition. He asks why blockchains exist, arguing that public chains are owned by their users instead of a few cloud companies, then moves into Solidity and Remix so participants write code and prepare for hackathon bounties.

Speakers

Topics

From Urbe Campus ETHRome Edition 2024, hosted by Urbe.eth.

Transcript

[Music] [Applause] [Music] cool so that said I think fa we we're ready ready to start right thank you hello

guys I'm yeah this is my name and I'm a software engineer I work in a I work in many crypto 3 projects I experienced as a as a solidity the developer as well and today I will try to explain why I do this job and how you write smart contracts so you can participate in in and then build something very cool which you will be PR forever and maybe win some money maybe $50 maybe I 7K no um so yeah this is my name I got

YouTube channel which I recently started uh so I would like you to subscribe thank you so who is going to participate to it WR all of you right right nice nice nice okay cool okay work yeah uh there is a channel in in the Discord mon confirm which is called like ampus you can scan this QR and you should get redirected to the um yeah to the Discord channel so if in the future you have any problem any doubt anything you want to share you can write right into into that

channel let me forget go all right I really recomend like to share this uh this um this Discord Channel and you know I really recommend you to collaborate right so today we are going to have um some part when I'm talking I'm explaining like what is the blockchain why the blockchain exists right and then about something aboutum something about what is and then

we going to write Cod so I have a question who never R the line of cod all right nice and who doesn't know who who doesn't know what isub okay all of you have yeah nice that's good who knows what is um remix okay um who knows what is a BL would you like to give your

explanation to participate are you shy don't be shy not going to eat you already had lunch so uh okay one other thing is that um this is not a frontal lesson I'm not a university Professor I'm not going to uh tell you what you need to repeat after me I want you to reason with your brain and yeah and you you know you have to participate otherwise you're not right uh okay so okay so now I have a question why do you think blockchain exists in first

place do you have any idea why for security for security right why I still don't know how works okay so why Blain exist is the first question I want to re uh and I think it's very interesting so I there is like I try to reason about that and I found out two reasons the first one is because internet is own by a few companies and Public public blockchains are owned by users essentially so if you

look at internet right now you have uh Amazon web services and Google Cloud which are basically owning your data and basically owning uh internet so if you need to deploy if you need to create an application let's say something for adventure you probably probably will host this application on this these service like AWS or Google Cloud right with the blockchain this kind of parad change a lot because you have some public infrastructure where you can

host uh application which will be decentralized which is an important concept of chain and so it will basically let's say not owned by anyone but own by the users which use these application so this is the first problem uh blockchain soles yeah and this is the second one it's very important so to allow people to have money without the use of a bank so blockchain is a bank without a why because you can basically send some Value store and S

some value in the blockchain securely uh trust because you need you don't need to trust any bank or any provider okay any intermediary to send this B okay so if you think about it this is interesting and if you think about it why money why the Euro or the dollar has value because we give this this piece of paper value right so you can use it Som how you can use hero to buy a sandwich to subscribe to Netflix whatever right so

somehow parenes started having a because people started using it right so cryptocurrencies are basically you know another way of storing and expressing and using that right and blockchain all allow cryptocurrencies to exist right so cryptocurrencies leave on the Block any question anything you want to so what happen we have these two problems we we talked about and in 20 29 2009 s Nako which is someone say

is mask I think it's this guy t-shir um yeah so basically he creates for day creates a Bitcoin which is a blockchain as well a cryptocurrency right so Bitcoin was b as appear to be electronic cash system so there a way to secure restore value and send this value to other friends okay so to the blockchain Sato was basically sending value to send sending some cryptocurrency to their friends and his friends he said okay they said okay this thing that are sending has value and we use the

blockchain to create and to set this B okay I'm talking about this because it's important to understand why things before doing it because otherwise I would have start okay this this is contract this is this is Sol do this this and this and you just do it but you don't know why so why we toity because we want to be independent from internet owners and we to be you know inment to from Banks maybe and and the reason for me is so the reason

Lear so okay so Bitcoin was the first blockchain this is great and then other blockchains started to grow so you have Bitcoin and then you have ethereum which the one we love in this room right then we have others okay um yeah because you're going to see real so what is a blockchain a blockchain is two things a data structure and a network of c network of

C okay so why chain what I mean when I say Blain is a data structure do you know what is a data structure what is you tell me what is a data [Music] structure so structure is some way to express and to collect dat right so why is a because blockchain is a a sension if we see blockchain as a structure this is essentially a Tre but upside down where we have the

root on the top uh which is also called the state of the blockchain so is the root of the blockchain uh is the part of the blockchain when where you can see what's inside the Block Chain in any good moment and then you have different so basically here you have all the actions performed by by users which are called transactions that are basically imagine collected by collected in the and then somehow they get summarized and they get

to the rules and they basically included in the Blain state so this is how actually looks like so I know you can see this but basically those are the transactions so let's say I create a transaction I I'm sending one de one e to okay so this included here then she sends money to him transaction and so on so this transaction basically the information transactions get transformed uh in a let's say a crypto

cryptographic stream through an ash function so you have this transaction which contains some information then you use a hash function which basically encrypt this information and basically uh put the the transaction in the in the in the tree mentioned that this tree is called tree okay so the transaction is hash and put in the tree and then couple of hashes here that get transferred to one hash again so hash one + two still get into the rules so this is a very general and uh fast say

example of how a looks like and I really recommend you to look into it better because it's something you need and you want to understand if you later on want to be a blockchain develop any question more than one what does it mean when you say that after being encrypted by the hash function it goes into the so basically you have a transaction so sending to you one and function okay so I pass I pass all this information to the hash function the hash function is a mathematical function that takes an

input and output atic out output so it outputs basically around a string uh which represents the content of the transaction okay right then I send this this transaction to the blockchain and then what happen next is that some group of servers basically um verify the transaction check if the transaction is valid and and include it in the in the Tre inclusion in the mean that's a good question it means that um I'm I'm going it to it later and then my other

question was regarding something you previously stated in another slide and it's about the fact that you personally love theum so what's the difference between ethereum or Bitcoin or another blockchain that's a good question and yeah like why there sorry like there plus yes because you have these two transtions that geted and then the hash get hashed again until getting hash 1 +

2 then hash 1 + 2 and hash 2 + 3 they get hased again forming the roots and so basically this is a metal tree and you have ways to verify the the Tre yeah I think it should be oh yes I just point that you want oh nice okay that's cool okay so this is uh okay going on I love the questions by the way thank you um okay so blockchain we say that

blockchain is a d structure but also a network that means that there are uh a lot of computers verifying the transaction hashes and updating the Ro of the so they not change state so to to come back to your question you have a lot of basically um yeah computers all around the world that are doing some verification of the three so you have for example blockchain you have um different blocks and the blocks are basically represented roots of a group of transactions that happen

sequentially in the blockchain and whenever a new block need to be added added to the blockchain there is this group this large group of computers that verify all the transaction and include in the next BL uh so you have these computers are called modes so they are be a common state okay so if we go back when I say State I say the latest uh root of the blockchain um so the state we check the of the

transaction and then um you have this node sample that checks the Val the transaction and then sh the the results of this computation computation to the and you have different kind of blockchains pro po p and p which means proof of work and proof of space State uh so Bitcoin for example is a proof of blockchain and that means that when they are verify when the nodes are verifying the state of the blockchain when they are creating a new block they do series

of computations mathematical computations and they basically need to get to the same result um and so they it's very expensive to to have a a Bitcoin node because you have to have you need to have big computers which cost a lot of electricity and so on and so forth we because these computers need to solve a complex algorith to create a new block right and when they create a new block they get some reward okay proof of state is very different because you don't really need to solve uh any algorithm but is a

different mechanism P money so you you basically you can create an own in your house and you need to stay which means deposit money cryptocurrencies in this note then you validate the transactions and then you propose this thing on the blockchain and then the other know they need to basically say yes or no if they accept or good you get a reward if they don't accept you lose part of your state that you Bo okay this is this is just to give you a broad

idea of all of this so I'm not going into much into more details because it's very complex and I can go time unun but is like the basic things you need to know you also need to do your own Research b y r is always this is this is this Val for the blockchain but is also Val if you want to be a program if you want to be a software engineer you need to do your own research you need to basically study all the time by yourself learn new stuff and blockchain is maybe the field where you study more because it's all new

right oh and there's another thing um whenever you send a transaction on the blockchain you need to pay for the transaction to be in the blockchain have you ever um work with something like AWS or Google Cloud aure aure as well yeah so if you go to one of these platforms then at some point you have B you have the Bing page you you need to pay say $200 per month or 200 VI per month why because you're saying to use the infrastructure of Google Amazon to

cost your application in a similar way in the blockchain you know that is not something centralized but is the centralized network of servers you need to somehow reward these servers okay so you need to BU something where you when you do any action on the Block so when you write on the blockchain we need to send maybe 0.1 or whatever because they doing all this job that I that I described to you before is somehow clear I know that it's not C because it's

very are we okay okay question so eum is a pro State and it's different from Bitcoin because it that machine nice I think someone work with Java here someone you know do you have ever heard about JM okay what is the machine in Jaa doing so

basically it takes your code compiles your code and it translate the your code to something that Java can you know can use same way we have the machine okay so the evm is a rtime environment for smart contracts can you an Applause for this because I really like [Applause] this thank you so what is environment is a software

infrastructure that provides tool to execute a program so it's something that translates your code to something that can be executed as a program you Cod an up and then and then this run time environment will translate your code to something that can be actually used on the okay so what is a smart contract a smart contract is some that goes from the e

right more or less so relax relax uh okay relax now we're going to just talking sh [Music]

Related talks