Solidity by Example - Deploying a Voting Smart Contract

Sdílet
Vložit
  • čas přidán 28. 08. 2024
  • In this video we'll walk through and then deploy a smart contract for enabling electronic voting. The contract will also enable voting delegation. The vote counting is automatic and completely transparent at the same time.
    I'll walk through the entire codebase and explain how everything works, including showing how to create a bytes32 value from a string, and then how to transform a bytes32 back into a string.
    Well also change the contract so that it accepts different data types into the constructor and talk about the tradeoffs between each type of data type.

Komentáře • 60

  • @WysockiD
    @WysockiD Před 3 lety +22

    this channel is going 10x this year, thanks for your in depth and understandable walk throughs in a space where there is very little of it available. much love

  • @Jaxbulid
    @Jaxbulid Před 3 lety +5

    Nice! I want to switch my career as a web software engineer to blockchain and smart contracts developer, I'm studying a lot, and these kind of videos are super helpful, there is not much great material yet about these topics. Looking forward to your nexts videos!

    • @naderdabit
      @naderdabit  Před 3 lety +1

      Awesome to hear, glad you enjoyed it!

  • @maximdegeyter5258
    @maximdegeyter5258 Před 3 lety +1

    This is going to be such a good series! I'm thinking about changing from Full-Stack JS developer to a Blockchain developer and your content makes it a lot easier. Thanks Nader 👏

  • @doruktopcu
    @doruktopcu Před 2 lety

    Not only in financial martkets, but in writing the financial markets too. Lit!

  • @mayassalman
    @mayassalman Před 3 lety +1

    first channel where I hit 'like' before even video start loading :) ,thanks nadir

  • @Silvertestrun
    @Silvertestrun Před 10 měsíci +1

    Thank you!

  • @misterjaypeasmith
    @misterjaypeasmith Před 3 lety

    So so so pleased you are in the space. Your content on other topics is superb and this is no different!
    Q: in your opinion, what other languages best compliment Solidity from a syntactic/logic perspective? Typescript perhaps?

  • @wouterdeschuyter
    @wouterdeschuyter Před 3 lety

    Interesting but right away quite complex, would love to see some other Solidity tuts with more basic functionality too!

  • @razaqmalomo
    @razaqmalomo Před 2 lety

    Great vidoe , clear explanation. KINDLY SHARE YOUR VSCODE SETTING . i really love the contrast

  • @mayassalman
    @mayassalman Před 3 lety

    as a homework for all of us, winner must be an array of winners !!

  • @Yehia_Sayah
    @Yehia_Sayah Před 3 lety

    Welcome back Nader, I'm happy 😊

  • @Finebyymee
    @Finebyymee Před 2 lety

    this is how its Done! thanks man thank you so much for all the explanation. Its great keep it up

  • @lveiga
    @lveiga Před 3 lety

    Keep the amazing work Nader.

  • @tendies
    @tendies Před 3 lety +1

    Thank you for your work!

  • @jcloudofthrones
    @jcloudofthrones Před 3 lety

    The best! Thanks Nader.

  • @Tame.Nation
    @Tame.Nation Před 2 lety

    Fantastic video, Thanks so much..... You're awesome

  • @chauquyennguyen2434
    @chauquyennguyen2434 Před 2 lety

    Thanks a lot. This tutorial helps me so much 😀

  • @ICOReviewtoken
    @ICOReviewtoken Před 3 lety +3

    where can i get source code ?

  • @TechGalaxy292
    @TechGalaxy292 Před 3 lety +1

    Hell yeah! Nice job on 10K subs!

  • @adeleke5140
    @adeleke5140 Před 2 lety

    this is an amazing tutorial; thank you Nader.
    btw, what vscode is this? it looks really nice.

  • @marcosmolina9349
    @marcosmolina9349 Před rokem +1

    Is there a tutorial that shows how to call these functions on js?

  • @throxe
    @throxe Před 2 lety

    Thank you very much for this content. Can you make a video on building a CRYPTO EXCHANGE please. Thanking you in anticipation❤👌

  • @murat6018
    @murat6018 Před 2 lety +1

    Man, Solidity's logic is so different from what I'm used to, i.e. JS front end web development. Like, it's so weird. I'm trying to understand it as like, which part of solidity can be interpolated to JS? and most of the time I'm left with no answers. Like, mappings are a mysteryy to me. Are they like JS arrays or objects? If they're like objects, what are structs, they feel more like JS objects. But, it seems that you can define what type of items a damn array will get, and you can choose it to be structs. Gosh.
    Anyway, thanks for the tutorial. We need more courses on Solidity...

    • @user-pj8nl7zl2z
      @user-pj8nl7zl2z Před 2 lety

      Helpline 📲📩
      QUESTIONS CAN COME IN ⬆️…

  • @GoodGuadExplainer
    @GoodGuadExplainer Před 10 měsíci

    I know the code it for learning purpose, doesn't handle tie votes right?

  • @francoperez03
    @francoperez03 Před rokem

    CRACCCCKK!! thank you!

  • @esotomay21
    @esotomay21 Před 3 lety

    love this content. keep pumping more out!

  • @sureshkm
    @sureshkm Před 3 lety

    Thank you so much! By the way, what are the options for updating the existing contract?

  • @onlyfaas
    @onlyfaas Před 3 lety

    Thanks for this!

  • @freshcotech79
    @freshcotech79 Před 2 lety +1

    Would you write for a publication on medium for web3 developers. There wasn't one on medium so I made on called be "Web3". I though it would be use for the community to cut through all the crypo investing saturation. Other than your dev post and documenting it hard to find a variety of resource in one place.

  • @ehsankhorasani_
    @ehsankhorasani_ Před 3 lety

    Good job nader

  • @RockmanR
    @RockmanR Před 3 lety

    I still didn't get why we need a While Loop. And how come it won't be an infinite loop if the voter[to] have already delegated. Thank you Nader for the valuable content.

    • @advaith2188
      @advaith2188 Před 3 lety +1

      It won't be an infinite loop because it essentially stops when the delegation loops back to the sender(msg.sender). At that point, I suppose the transaction just reverts without saving state changes, with that error message("found loop in delegation")

    • @abhinav1025
      @abhinav1025 Před rokem

      Default address in delegate is 0.

  • @parbatikandel6900
    @parbatikandel6900 Před 2 lety

    How can we put a condition in solidity that person below 18 yrs cannot vote

  • @azamatturaev904
    @azamatturaev904 Před 2 lety

    thank you man

  • @codeWithBala
    @codeWithBala Před rokem

    What is the purpose of touch used in command prompt

    • @codeWithBala
      @codeWithBala Před rokem

      The same person after 7 months of BlockChain developer...I am going to answer myself
      Touch is used for creating files. Hope you understand!

  • @manlequang9576
    @manlequang9576 Před 2 lety

    thank you

  • @mariajanechan5906
    @mariajanechan5906 Před 2 lety

    Awesome!

  • @rahimihoussam4511
    @rahimihoussam4511 Před 2 lety

    thanks man
    that was helpfull

  • @chesster5981
    @chesster5981 Před 2 lety

    So easily explained wtf

  • @pokokichi5318
    @pokokichi5318 Před 2 lety

    Awesome

  • @mwaikul
    @mwaikul Před 2 lety +1

    github?

  • @mikekalapoth
    @mikekalapoth Před 3 lety

    How can I add weight in a voting system? For example the president 's vote is 2 and other people 1???

    • @robertshawnmitchell
      @robertshawnmitchell Před 2 lety

      in the constructor "voters[chairperson].weight = 2;"

    • @freshcotech79
      @freshcotech79 Před 2 lety

      @@robertshawnmitchell Do you need to create a separate constructor or can you make different weight to different titles in the same constructor?

  • @Mummie560
    @Mummie560 Před 3 lety

    what color theme do you use on vscode, Nader?

    • @Mummie560
      @Mummie560 Před 3 lety +1

      Its "Shades of Purple" for those curious :)

  • @newborn7850
    @newborn7850 Před 2 lety

    sir how to create react js front end for it

    • @hassanxelamin
      @hassanxelamin Před 2 lety +1

      npm install create-react-app or npm install vite@latest

    • @newborn7850
      @newborn7850 Před 2 lety

      @@hassanxelamin trying thanku

  • @MoxAIprofit
    @MoxAIprofit Před 3 lety

    guys I need someone to guide me how to become blockchain developer
    I have some experience but I still totally beginner

  • @kettenbach
    @kettenbach Před 3 lety +1

    First 🙏

  • @justkaz7104
    @justkaz7104 Před rokem

    736

  • @abhinav1025
    @abhinav1025 Před rokem

    if (delegate_.voted) {
    // If the delegate already voted,
    // directly add to the number of votes
    proposals[delegate_.vote].voteCount += sender.weight;
    } else {
    // If the delegate did not vote yet,
    // add to her weight.
    delegate_.weight += sender.weight;
    }
    the if statement won't run in any case, as the while loop above it will eventually point to the person with null delegation which means delegate_.voted will be false. Am i right?

  • @danielbusuttil7703
    @danielbusuttil7703 Před 3 lety

    Thank you!