Code Your First Smart Contract on Ethereum | Beginner Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ส.ค. 2024

ความคิดเห็น • 125

  • @miguelestevez5765
    @miguelestevez5765 3 ปีที่แล้ว +15

    At line 18 there is an error, it should be "kid" instead of "msg.sender".

    • @teqexe
      @teqexe 3 ปีที่แล้ว

      ye right. awesome content anyways. julien best♥

  • @tamilcartoontv6829
    @tamilcartoontv6829 3 ปีที่แล้ว +13

    At line 18 it should be "kid" address not "msg.sender" since the person calling addKid function is a parent(ie. msg.sender) so we are checking parent address amount ==0 or not which will always will be 0 by default since we are sending amount to kid only not the parent who is adding kid...
    In the withdraw function msg.sender is a kid address so it works because the person calling that withdraw is a kid not parent..but in addkid function person calling the function is parent.
    so it is a bug in the code...

    • @tsipporahni
      @tsipporahni 2 ปีที่แล้ว +1

      INDEED! i was confused at it for quite a while !

    • @BraintemOrg
      @BraintemOrg 2 ปีที่แล้ว +1

      I was confused too after trying to understand the code, had to come to the comment section the following day looking for someone with this comment.

  • @chuatrum17
    @chuatrum17 2 ปีที่แล้ว +1

    22:15 no kid was added using the 3rd address which causes the error. Your code should also check if the kid's address is blank before performing the withdraw

  • @uncompromised-123
    @uncompromised-123 2 ปีที่แล้ว +1

    i love the chill of the bacground

  • @aviicenna8236
    @aviicenna8236 2 ปีที่แล้ว +2

    is there anybody got the full source code? I tried on my IDE but its unable to run. thank you

  • @alittlecoding
    @alittlecoding 3 ปีที่แล้ว +2

    this is perfect. thanks.
    to others: after the final step, the 18th line should be this.
    require(kids[kid].amount == 0, 'kid already exist');

  • @dreaugustus5761
    @dreaugustus5761 3 ปีที่แล้ว +1

    this intro will go down in the history of the blocks

  • @cryptosan9391
    @cryptosan9391 3 ปีที่แล้ว +2

    Thanks, I just write my first smart contract
    I'm going to learn about storage, memory, emit, payable....

  • @Sean-fs1sg
    @Sean-fs1sg 3 ปีที่แล้ว +10

    I just came from your video about setting up a development environment where you recommended this video as a follow up.... I setup up VSCode as the IDE as per your recommendation in the previous video.... I love your videos man, but it would be great if there was some consistency in regard to the IDE you use in each video so people can follow along building on each video. Just a suggestion, love your work!

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว +1

      Sure, I use vim in 99.99pct of my videos

  • @SeaniFool
    @SeaniFool 3 ปีที่แล้ว +1

    Will people stop building contracts on the Ethereum blockchain when BSC is so much cheaper to use?

  • @Simon-xi8tb
    @Simon-xi8tb 3 ปีที่แล้ว +2

    You made a mistake in your addKid function. It' should be require(amounts[kid] == 0, 'kid already exists')

  • @sacenolaza
    @sacenolaza 3 ปีที่แล้ว +4

    Do we really need the paid variable in the struct? Wouldn't it be the same to set the amount variable to 0 for msg.sender before the transfer? Thanks for sharing!

  • @bitpilot79
    @bitpilot79 3 ปีที่แล้ว +6

    Thank you! I would like to watch more of these types of videos.

  • @KL13923j
    @KL13923j 3 ปีที่แล้ว +1

    The struct is so useful for data management when developing smart contract , I would use that in my future project thanks !

  • @princeanik_4202
    @princeanik_4202 3 ปีที่แล้ว +1

    a simple solidity smart contract that i can use as in interface to quickswap dex on Polygon (basically pancakeswap v2) .I want the smart contract to have the following functions for me Swap MATIC for USDC Swap USDC for MATIC Create MATIC USDC LP Tokens Check MATIC Balance Check USDC Balance Check MATIC/USDC LP Balance Sell MATIC/USDC LP Balance (specific quantity) Transfer MATIC This contract must be easy to read, well documented and can work with my other smart contract.
    please reply urgent

  • @MarKac9090
    @MarKac9090 2 ปีที่แล้ว +3

    great video, could you share the contract code? on github or pastebin?

  • @sushmitaganguly190
    @sushmitaganguly190 2 ปีที่แล้ว +1

    can to tell me how to store date of blockchain in ethereum

  • @chriscollier4837
    @chriscollier4837 3 ปีที่แล้ว +1

    How come it says there's an unsecure connection on the remix website?

  • @michaelpacheco7421
    @michaelpacheco7421 2 ปีที่แล้ว +1

    Great tutorial! Thank you!

  • @crazegamez290
    @crazegamez290 3 ปีที่แล้ว +1

    im gettin a declation error for unit amount in struct

  • @Nawras672
    @Nawras672 3 ปีที่แล้ว +1

    Followed it step by step and letter by letter but I'm only getting 1 error:
    ParseError: Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition. --> trust.sol:36:1: | 36 | } | ^
    why is that ? any idea?

  • @mhecrypto392
    @mhecrypto392 3 ปีที่แล้ว +1

    anyone know what this mean
    ParserError: Expected a state variable declaration. If you intended this as a fallback function or a function to handle plain ether transactions, use the "fallback" keyword or the "receive" keyword instead. --> contracts/Mhetoken.sol:88:17: | 88 | function () { | ^

  • @kyuubi4714
    @kyuubi4714 2 ปีที่แล้ว +1

    can you do a code for new token include the Slippage Tolerance 15% goes for LP?

  • @arohirathore9197
    @arohirathore9197 3 ปีที่แล้ว +1

    Hi, is there anyway to create blockchain project dapp without using ganache

  • @pankajjoshi8292
    @pankajjoshi8292 2 ปีที่แล้ว +1

    Sir pls show us frontend on react js for this. Thank you

  • @sufyanabbasi2479
    @sufyanabbasi2479 2 ปีที่แล้ว +1

    my script is saying that in line 5: it is a parser error, expected type name. how do i fix that

  • @RHQIncorparations
    @RHQIncorparations 3 ปีที่แล้ว +2

    How to implement a fixed dollar price when holding different rounds like pre/private and public?

  • @jimm2215
    @jimm2215 3 ปีที่แล้ว +2

    Awesome! Only problem is if you want to disown one of the kids, lol!

  • @Glow0110
    @Glow0110 2 ปีที่แล้ว +1

    Shouldn't line 16 read be require(amounts[kid] == 0, 'kid already exists'); ? At least before you added the struct I mean.

  • @adespade119
    @adespade119 3 ปีที่แล้ว +1

    require (maturities [msg.sender]

    • @shashvatpandey6633
      @shashvatpandey6633 3 ปีที่แล้ว

      No, maturity means minimum required time before which you cannot withdraw. For example, if my funds are maturing on 31st December 2022, then I should not be able to withdraw before that. So, anyone who tries to withdraw before 31st December 2022 would be 'Too early'.
      So yes, the maturity of the caller needs to be 'less than now', otherwise the funds would be immature and therefore non-withdrawable.

  • @diographyprod
    @diographyprod 2 ปีที่แล้ว +1

    can you use this on polygon as well??

  • @MarKac9090
    @MarKac9090 2 ปีที่แล้ว +1

    could you pls write the same code for Solana blockchain?

  • @jamesh4129
    @jamesh4129 2 ปีที่แล้ว +1

    Amazing!

  • @uncompromised-123
    @uncompromised-123 2 ปีที่แล้ว +1

    Can u code a staking smart contrac?
    Where can i contac u?

  • @tankstechtutorials5721
    @tankstechtutorials5721 3 ปีที่แล้ว +2

    hey, I thought that you had to use the 'payable' keyword on the function as well? But you only have it being used inside the function. So it's not needed as a function modifier anymore?

  • @colkbassad
    @colkbassad 3 ปีที่แล้ว +2

    Is there a looming issue with the Year 2038 Problem and Unix timestamps?

    • @PopcornColonelx
      @PopcornColonelx 3 ปีที่แล้ว +1

      Just depends on if you use 32 bit ints vs 64 bit ints to represent the time.

  • @chrisssliii
    @chrisssliii 3 ปีที่แล้ว +1

    I think your code is wrong? line 18 should be kids[kid] instead of kids[msg.sender], ...... i think?

  • @shashvatpandey6633
    @shashvatpandey6633 3 ปีที่แล้ว +1

    Thank you.

  • @talhafarooq5622
    @talhafarooq5622 3 ปีที่แล้ว +1

    I do not have this code running Plzz Guide Me

  • @swaggcam412
    @swaggcam412 3 ปีที่แล้ว +2

    This was so useful! Hitting the Subscribe for sure!

  • @CorporalPoon
    @CorporalPoon 3 ปีที่แล้ว +1

    Can you put the source code somewhere?

  • @damonwu9658
    @damonwu9658 2 ปีที่แล้ว +2

    Thanks for sharing, good stuff. I just came up with a question: which version value is recommended? 0.8.1 or >= 0.7.0 < 0.9.0? And may I get some explanations if you don't mind. 🙏

  • @stormsurge1850
    @stormsurge1850 3 ปีที่แล้ว +3

    Please report the account spamming a scam in the comments please. They don't even try to hide it lmao, he/she has more likes than the video!

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว

      I hide them from the channel when I see them

  • @telamont2477
    @telamont2477 3 ปีที่แล้ว +2

    Thank you very much for the tutorial! Question: why do I get gas deducted if I call withdraw even if it fails? Thank you!

  • @mjsmjs4975
    @mjsmjs4975 3 ปีที่แล้ว +1

    Yo...Julian thanks for always posting new vids.

  • @dinudelafuente7657
    @dinudelafuente7657 3 ปีที่แล้ว +1

    Merci beaucoup monsieur. J'apprécie vraiment ces exemples de remix car ils fonctionnent très bien sur l'ubuntu Raspberry 4 :)

  • @MatteoToma
    @MatteoToma 3 ปีที่แล้ว +1

    thank u! U look like Chris Martin lol

  • @liamayathan5943
    @liamayathan5943 3 ปีที่แล้ว +1

    awesome video my man

  • @transientsmartcontracts1390
    @transientsmartcontracts1390 2 ปีที่แล้ว +1

    Smart contracts will change the world. Just imagine being able to create them without coding 🤯

  • @2010zac1
    @2010zac1 3 ปีที่แล้ว +2

    Hello, when i click on deploy, i got an error: cannot convert undefined or null to object, any clue how to fix it pleaase

    • @bhilder
      @bhilder 3 ปีที่แล้ว

      I just fixed this error (as I got it too). I just refreshed my web page for Remix. If that doesn't work maybe try a different browser and past the code into remix there

  • @clidee1
    @clidee1 2 ปีที่แล้ว +1

    i know nothing about coding and this seems alien for beginners...my question is what books or videos can i study to help me memorize the actual language....or else these kinds of tutorial videos dont help people who know nothing about coding if they dont know the actual commands to type to code...

  • @tautologicalnickname
    @tautologicalnickname 2 ปีที่แล้ว +1

    Amazing video, thank you!

  • @nuccidesu
    @nuccidesu 3 ปีที่แล้ว +3

    Thank you for the video. What would be the prerequisites for learning this? I'm trying to follow along but there are a lot of things I don't understand.

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว +3

      If you don't have a coding background I would learn the basics of web development first (html, css, Javascript).

  • @Nick-ww7yu
    @Nick-ww7yu 3 ปีที่แล้ว +1

    Where did you get that ghost from??

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว

      haha I just bought it at some electronic shop

  • @cryptojedi2927
    @cryptojedi2927 3 ปีที่แล้ว +1

    Bro! Thanks for sharing! I have a better understanding of Solidity now.

  • @wint3rmute665
    @wint3rmute665 3 ปีที่แล้ว +1

    Since the timestamp of the block can be manipulated by the miner, are there any other alternatives? perhaps using block.number or similar...

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว +1

      There are limits to this, only a couple of hours of difference relative to the timestamp of last block

  • @fd4553
    @fd4553 3 ปีที่แล้ว +2

    Amazing video!!

  • @airbound1779
    @airbound1779 3 ปีที่แล้ว +2

    Could you do an updated tutorial on Flash Swaps on Infura?

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว +2

      There isnt't anything special about Flashswap on Infura. In your backend script to monitor arb opportunities you just have to connect to Ethereum with an Infura URL thats it.

  • @PopcornColonelx
    @PopcornColonelx 3 ปีที่แล้ว +2

    What happens if you found a bug in your code, or want to add a feature? Or does your code have to be literally perfect and complete when you send it out?

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว +2

      It's possible to have an updatable mechanism if you delegate part of the functionality to another contract, and you update this contract in the future. But it also raises the question of who can update this contract, and make it less decentralized.

    • @PopcornColonelx
      @PopcornColonelx 3 ปีที่แล้ว

      @@EatTheBlocks How do you update the contract in the future? or do you mean just change the pointer to an updated copy of the contract elsewhere on the blockchain?

    • @tamilcartoontv6829
      @tamilcartoontv6829 3 ปีที่แล้ว +2

      smart contract is immutable in nature so u cant update after its deployed on network... so if u found a bug after deployment u can't to anything unless u have a special access to that function by having onlyOwner modifier who can alter certain things... But if u do this then it will make ur contract less decentralized...
      and if u want to add new feature u will have to add owner only function on the network which makes ur smart contract completely centralized since it can be controlled by you right..

  • @gregorystevens5173
    @gregorystevens5173 3 ปีที่แล้ว +1

    Why a Constructor "kid = _kid"? Isn't state variable "kid" already initialized by default as written in the first declarations?

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว +1

      `_kid` is where the actual address is, the initial value of `kid` is empty.

  • @benjaminhall5217
    @benjaminhall5217 3 ปีที่แล้ว +1

    Great Tutorial! Thank You!

  • @jopadjr
    @jopadjr 3 ปีที่แล้ว +1

    Hi Julien, at 14:43 you said that the admin would be the address of the parent who deployed the smart contract. What do you mean by that? Isn't it the developer who is going to deploy the smart contract. How can a user set himself as parent ? Does he have to get the eth address of his kid (from his wallet) to run the addKid function?

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว +1

      If parents hire a dev to do it, they can just tell the dev to use their private key to deploy the smart contract. Of course they would need to find a secure way to handle the private key in this case.

  • @failuresofterribletonysdad7381
    @failuresofterribletonysdad7381 3 ปีที่แล้ว +1

    Very helpful and interesting. Thank you!

  • @Tx-do9fe
    @Tx-do9fe 3 ปีที่แล้ว +1

    Do you have a course for beginners?

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว +1

      Yes, this one (Jumpstarter package):
      eattheblocks.com/6-figure-blockchain-developer/

  • @user-wr4yl7tx3w
    @user-wr4yl7tx3w 2 ปีที่แล้ว +1

    Can you do a video on Brownie

  • @rad0f
    @rad0f 3 ปีที่แล้ว +1

    You're doing a great job..

  • @TechnoKid_
    @TechnoKid_ 2 ปีที่แล้ว +1

    I'm just wondering one thing about Remix - do they spy all the code used on their platform?

  • @crazegamez290
    @crazegamez290 3 ปีที่แล้ว +2

    can you tell me how one would add fee,s like smart coin a % of transaction

    • @obviouslymatt6452
      @obviouslymatt6452 3 ปีที่แล้ว

      something like burned = uint(value) * 0.03
      and then you can choose where to send that burned amount to.

  • @chidichuks2853
    @chidichuks2853 3 ปีที่แล้ว +1

    Thank you!

  • @dashrathsinghjhala5936
    @dashrathsinghjhala5936 3 ปีที่แล้ว +1

    Can we do in real? And earn eth

  • @abhinavkant
    @abhinavkant 2 ปีที่แล้ว +1

    wow. Thanks :)

  • @0GRANATE0
    @0GRANATE0 3 ปีที่แล้ว +5

    1:22 SOLOdilitiy hahahahahah puhahahahhahaha staaahp haha hehe just joking :P nice tutorial thank you verrryyy much!

  • @zenzen4397
    @zenzen4397 2 ปีที่แล้ว

    very simple but powerful one

  • @---zg7ex
    @---zg7ex 3 ปีที่แล้ว +2

    lolz bank do not exist anymore lolz bro you are teh man!

  • @jonp3674
    @jonp3674 3 ปีที่แล้ว +1

    Great video, thanks :)

  • @leosarrazin3937
    @leosarrazin3937 3 ปีที่แล้ว +1

    T'es français 100%

    • @EatTheBlocks
      @EatTheBlocks  3 ปีที่แล้ว +1

      yes sir!

    • @leosarrazin3937
      @leosarrazin3937 3 ปีที่แล้ว

      ​@@EatTheBlocks On est incapable d’émettre parfaitement l'accent américain ça me tue ptdr
      Contenu de qualité en tout cas, +1 sub

  • @SzTz100
    @SzTz100 3 ปีที่แล้ว +1

    It's the year 2043 and all those still engaged in crypto currencies and have been rounded up and imprisoned, a new sedition law was introduced to ban the technology.

  • @finessiano3656
    @finessiano3656 3 ปีที่แล้ว +8

    Sir, I’m gonna report your channel so that you get banned and no one else can get this extremely valueable information. Jokes aside, THANK YOU!

  • @rallokkcaz
    @rallokkcaz 3 ปีที่แล้ว +1

    Ethereum is dying unfortunately, I would suggest checking out other less overloaded and overvalued chains! This is just a single way to write SCs there's tons of other compilers. I would not advise learning Solidity in 2021z

    • @Lineside
      @Lineside 3 ปีที่แล้ว

      What other compilers would you recommend?