Web3 Tutorial Project | Build a web3js dApp for a smart contract

Поділитися
Вставка
  • Опубліковано 28 січ 2022
  • In this project-based web3 tutorial we build a completed dApp with a focus on how to build a UI for a smart contract, using the web3js library.
    Topics covered include: the web3.js library, application binary interface (abi), NextJS, Truffle, deploying a Solidity smart contract to Ethereum and more.
    Vending Machine smart contract tutorial:
    • Smart Contract Tutoria...
  • Наука та технологія

КОМЕНТАРІ • 101

  • @MrDuff158
    @MrDuff158 Рік тому +20

    This video is a rare gem hidden in the depths of the yt algorithm.. I wish I had found it sooner. Great video, very helpful. Way more helpful than a lot of stuff hidden behind a paywall. Thank you for your time!

    • @comosaycomosah
      @comosaycomosah Рік тому

      Just started it and this comment is lit hope it's good as it seems it will be shall report back lol

    • @cryptotoken768
      @cryptotoken768 Рік тому

      what do u mean ?

  • @ayencoscolfield3312
    @ayencoscolfield3312 8 днів тому

    fantastic am new to blockchain and have seen lots of videos that was so confusing but this my friend killed it for me awesome stuff and it's so clear, thanks so much for your time and may God bless you👍

  • @saurabhjaswal21
    @saurabhjaswal21 2 роки тому +9

    It really helps me alot, i have lot of confusion regarding the integration but this video solved all my doubts. Thanks man and great work. Keep doing 👏👏

  • @shivangsaini3940
    @shivangsaini3940 2 роки тому +1

    Really, this is Best tutorial i ever seen on UA-cam.

  • @PhillipWilliams
    @PhillipWilliams 2 роки тому +3

    Fantastic video, thank you. To get the fund as the owner, I would have a withdrawal function. I would set it to have an optional _amount to allow the owner to take a portion of the fund (as passed via the _amount parameter) or all the funds by default.

  • @yassinehzami1670
    @yassinehzami1670 Рік тому

    What a great video, helps A LOT in the beginning.

  • @khan_dev
    @khan_dev 2 роки тому +2

    awesome, thanks, it worked here on my side too, yeee! The only thing I changed I cleared the dependency array for useEffect and values updated after purchasing.

  • @KidannyBM
    @KidannyBM 11 місяців тому

    Amazing video bro! Great job! On explaining everything!

  • @RossPfeiffer
    @RossPfeiffer Рік тому

    great tutorial.
    solid tech stack. feels good to have my powers back

  • @TheThaiLife
    @TheThaiLife Рік тому

    Really well done! Thank you.

  • @user-zd6he3zd5j
    @user-zd6he3zd5j 2 роки тому

    Thank you very much. It's great job!

  • @AssFaceNFT
    @AssFaceNFT 2 роки тому +1

    Super duper helpful dude!!! 🔥💯🙏🌹

  • @AdamRubiks
    @AdamRubiks Рік тому

    Thanks man loved it!!

  • @sukiratwarring6219
    @sukiratwarring6219 2 роки тому +1

    what a video!!...thanks for the information!!!waiting for much more tutorials....and pls don't stop!

    • @BlockExplorerMedia
      @BlockExplorerMedia  2 роки тому

      thanks Sukirat!

    • @sukiratwarring6219
      @sukiratwarring6219 2 роки тому

      @@BlockExplorerMedia when is the new video coming out…gassed up for it..lacking patience!!😁😁

    • @BlockExplorerMedia
      @BlockExplorerMedia  2 роки тому +1

      hey Sukirat, I am doing a bit of traveling and taking a little time off so it might be another week or so. thanks for the support my friend!

    • @sukiratwarring6219
      @sukiratwarring6219 2 роки тому

      @@BlockExplorerMedia ohk no worries!!

  • @Dre-man100
    @Dre-man100 4 місяці тому

    Great vid fam!

  • @triviapartypatel845
    @triviapartypatel845 2 роки тому

    Very nice tutorial.... Need more tutorial.....

  • @syedmuhammaddanish8511
    @syedmuhammaddanish8511 2 роки тому

    Bruh... Amazing. Loved it

  • @Fep_Aguilar
    @Fep_Aguilar Рік тому

    loved this video! Kudos for the old school alert btw! :D kudos

  • @gokuljagannath2481
    @gokuljagannath2481 Рік тому +2

    Great tutorial, Thank you.
    And the reason the purchase count was not increasing is because you were doing post increment(++). It can be solved by doing setPurchases(purchases+1) instead of setPurchases(purchases++).
    Anyway thanks a lot for the tutorial, learnt a lot.😀

    • @cryptotoken768
      @cryptotoken768 Рік тому

      No bro, if you do in your way it will end up with assign value the to a constant error. This is the workaround `
      useEffect(() => {
      if (vmContract) getInventoryHandler();
      if (vmContract && address) getMyDonutCountHndler();
      }, [vmContract, address, purchases])
      const buyDonutsHandler = async () => {
      try {
      await vmContract.methods.purchase(buyCount).send({
      from: address,
      value: web3.utils.toWei('2', 'ether') * buyCount
      });
      let _purchases = purchases + 1;
      setPurchases(_purchases);
      setSuccessMessage(`${buyCount} donuts purchased!`);
      } catch (error) {
      setError(error.message);
      }
      }`

  • @Techcetera377
    @Techcetera377 Рік тому

    ITS REALLY WORKED LOL THANK YOU DUDE

  • @ivanlagade
    @ivanlagade Рік тому

    great job!

  • @cpetrozza21
    @cpetrozza21 2 роки тому

    thank you for this!

  • @LOVEFACT360
    @LOVEFACT360 2 роки тому +4

    Hello boss, I finally fixed the error. I love your channel so much. It is filled with so much knowledge and I look forward to following all the tutorials here to become a blockchain expert like you. Please I will need tips on how to send the ethers to my metamask account as the owner of the vending machine. Your reply will be greatly appreciated, thanks in advance

  • @0xccd
    @0xccd 2 роки тому

    Love it!!
    new sub

  • @zakstev786
    @zakstev786 2 роки тому

    Excellent

  • @Baddack8
    @Baddack8 2 роки тому

    Great video, this helped me a lot. When I try to do a write to the blockchain, I get estimated gas can't be determined. I think because I need to do a APPROVE first? How were you able to write without approving the dapp to use your funds first?

  • @david-patton
    @david-patton 2 роки тому

    So in my contract I keep getting stack too deep. Im not sure where its too deep at.

  • @fomodog2698
    @fomodog2698 2 роки тому

    Great, thank you!

  • @toureibrahiman5435
    @toureibrahiman5435 Рік тому

    so sweet of you

  • @codewithxohii4987
    @codewithxohii4987 7 місяців тому

    hi mentor appreciate your way of simplfying the huge complex stuff to an easy way. i had a tiny problem when we creating the getinventoryhandler and the setting the value inside the state i am not getting my vlaue on the page while in the console its showing 100n any possible soultion ?

  • @vicentemunoz9157
    @vicentemunoz9157 Рік тому +1

    Awesome tutorial !! Thank you!
    Is there a github repo ??

  • @RobertCraig12
    @RobertCraig12 2 роки тому

    I am using the rospten test network via infura and get this error whenever I try to send a transaction using the contract.
    Error: Returned error: The method eth_sendTransaction does not exist/is not available
    Is it only rinkby that allows the eth_sendTransaction method on infura or do I need to do something else. I note that this video was made in Jan 2022 so I am unsure if there has been a change at infura since?

  • @arghavan9325
    @arghavan9325 2 роки тому

    In 46:30 how can we add a central database to this architecture? For example, to send email to the wallet owners when their favorite donut is restocked?

  • @ronaldsena9078
    @ronaldsena9078 2 роки тому

    I would be grateful for a video explaining INFURA and why export METAMASK private key

  • @Buggedmind6
    @Buggedmind6 Місяць тому

    Amazing stuff. But i have an issue im trying to code along with you but when i create a next app i dont ger the pages folder

  • @hristohristov4047
    @hristohristov4047 9 місяців тому

    How did you resolve this - "
    Property 'ethereum' does not exist on type 'Window & typeof globalThis'."?

  • @seydayoncac294
    @seydayoncac294 2 роки тому

    thank you so much but please help, I can't install truffle on my computer.

  • @johanwahab
    @johanwahab Рік тому

    Hello, I have followed your video tutorial smoothly. But at 39:30 minutes I can't find the ENDPOINTS : Rinkeby option.
    Is there any other solution?
    Thank you.

  • @ykd3529
    @ykd3529 Рік тому

    When I tried "truffle migrate --network rinkeby" I get the following error:
    "Error: PollingBlockTracker - encountered an error while attempting to update latest block:"
    I did some searching and even after changing https to wss, I get a different error:
    "Error: Unexpected server response: 404"

  • @jo-mengo9756
    @jo-mengo9756 Рік тому

    new update, when you deploy the contract on rinkeby the HDWalletprovider format is not the same anymore as shown on the video that is why it may not deploy, follow the commented part in the file exactly to deploy the contract

  • @BobRobinson
    @BobRobinson 2 роки тому +1

    I'm having trouble with the truffle install if I copy your files for vending-machine file direct into my folder would that work or is there another solution ty very much I'd be lost without your video

  • @C00K1E-dev
    @C00K1E-dev Рік тому +1

    This video is great! However Rinkeby is deprecated... I have used instead of rinkeby the goerli network and changed the chain id also but when i use truffle migrate i get like 5 errors including some npm_modules not working ... any fix for that?

  • @TheCosmicThrust
    @TheCosmicThrust Рік тому

    ethers.js didn't work for me, but now I know the basics so Im watching this as 2x speed xD

  • @lequent1682
    @lequent1682 Рік тому +2

    Hello, thank you for your video ! Great inspiration !
    I've got an issue to call the get method. In my javascript page I have created the {inventory} variable but nothing is displayed on the front page. ABI / ADDRESS and URL Infenora are well created and configured.
    Even If I download your github project (by changing address and url) , I've got nothing ... :/

    • @codewithxohii4987
      @codewithxohii4987 7 місяців тому

      same here did u got any solution for this inventory variable issue ?

    • @lequent1682
      @lequent1682 7 місяців тому

      @@codewithxohii4987 No really sorry, I abandoned the project ahaha

    • @HenKPvP
      @HenKPvP 7 місяців тому

      @@codewithxohii4987 @lequent1682 any solution guys?

    • @HenKPvP
      @HenKPvP 7 місяців тому

      hey buddy did you got how to fix this issue?

  • @VinaySharma-ed6fy
    @VinaySharma-ed6fy Рік тому

    From where did you restocked the wallet to get more ethers?

  • @namanmanjkhola3419
    @namanmanjkhola3419 Рік тому

    Hey! anyone knows when we purchase a donut where is the spend amount going?

  • @s-wind2398
    @s-wind2398 Рік тому

    Awesome content, mate! Subscribed! Pleasee add timestamps, to make the video even easier to track...I can help you with stamps if you want. Let me know. Kudos to you!

    • @BlockExplorerMedia
      @BlockExplorerMedia  Рік тому

      Thanks and welcome! You're right I should start adding timestamps. I'll figure out how to do it and implement going fwd. Sure, any help on the existing videos would be awesome!

  • @sinakheiri
    @sinakheiri 2 місяці тому

    I was following along until i realized rinkeby is not available anymore and truffle is basically deprecated and not maintained anymore. this was a bummer
    good info anyway

  • @LOVEFACT360
    @LOVEFACT360 2 роки тому

    Great video, thank you so much for the content. I am having issues deploying my smart contract please can I get your assistance

    • @BlockExplorerMedia
      @BlockExplorerMedia  2 роки тому +1

      sure - please let me know what specific errors or problems you're facing.

    • @LOVEFACT360
      @LOVEFACT360 2 роки тому

      @@BlockExplorerMedia I am using windows and I cant install truffle on my computer. it is giving me errors

    • @LOVEFACT360
      @LOVEFACT360 2 роки тому

      @@BlockExplorerMedia I have fixed the error. Will really appreciate it if you can give me a guide to receive the ethers as the owner in the smart contract. Thank you so much for this precious knowledge you have shared

  • @manojnavinjamuri5867
    @manojnavinjamuri5867 2 роки тому +1

    I am unable to run the rinkeby command

  • @syedowaisahmed4347
    @syedowaisahmed4347 2 роки тому +1

    can u share github link if u have uploaded it there?

  • @holiday-smith
    @holiday-smith 2 роки тому

    for whatever reason I wasn't able to get the .env variables working for me, but I was able to proceed by just putting them in there directly (this is only for testing and private use)

    • @cody_code
      @cody_code 2 роки тому

      Seems like I'm having the same issue, I'll have to try that

    • @cody_code
      @cody_code 2 роки тому +1

      I think I may have had the same issue, did you omit the quotation marks around the strings in your .env variables?

    • @holiday-smith
      @holiday-smith 2 роки тому +1

      @@cody_code I did not try that lol thank you

  • @malikforz9490
    @malikforz9490 Рік тому

    thanks for the video but can you please zoom more ? I couldnt code because that

  • @jasonriggs1227
    @jasonriggs1227 Рік тому

    Great video! but how do you do a restock button?

    • @BlockExplorerMedia
      @BlockExplorerMedia  Рік тому

      Thanks! The smart contract has a 'restock' method that is callable by the owner, so you could create a button with a click handler that calls it. Something like this:
      const restockHandler = async () => {
      const amount = 100;
      try {
      await vmContract.methods.restock(amount).send({
      from: address,
      })
      } catch(err) {
      setError(err.message)
      }
      }
      Or make the amount dynamic and pass in from a user input. Hope this helps.

    • @jasonriggs1227
      @jasonriggs1227 Рік тому

      @@BlockExplorerMedia Thanks so much for the response! I added the restock button and made it able to have user input. this is an amazing tutorial Thank You!

  • @originalbinaryhustler3876
    @originalbinaryhustler3876 Рік тому

    i install it but my directory does not get pages

  • @Ro_builds
    @Ro_builds Рік тому

    could I create this without nextjs and just use vanilla javascript?

    • @BlockExplorerMedia
      @BlockExplorerMedia  Рік тому +1

      Yes, you could even just use a single HTML file. The frontend framework (or lack of) is not important. I just usually use React or Next because it helps me quickly stand a simple site up.

  • @yecai8442
    @yecai8442 Рік тому

    The donuts are really pricey🤣

  • @maharajanp1320
    @maharajanp1320 2 роки тому +1

    can u pls share the github code url

  • @skirianov
    @skirianov 2 роки тому

    Bro, really important question...Who's Zhenya? :D

  • @mileycrypto
    @mileycrypto 2 роки тому +1

    Any github link?

  • @souravmajumder4630
    @souravmajumder4630 Рік тому +1

    If you provide the source code, it would be great for us.

  • @binhhoang333
    @binhhoang333 Рік тому

    greate job, pls share with me github repo

  • @ioanap3602
    @ioanap3602 Рік тому

    Hello, I have an error with deploying the contract : "Message: insufficient funds for gas * price + value " ; I am connected with an Ganash account with 100ETH. Please help, I am blocked

  • @bhok5228
    @bhok5228 2 роки тому

    Thank you very much, but still dont get why no one have created a visual smart contract interface creator

  • @bikechainapp2964
    @bikechainapp2964 2 роки тому

    Can we talk, would love to collaborate on you helping us build a web3 dapp :) ?

    • @BlockExplorerMedia
      @BlockExplorerMedia  2 роки тому +1

      Thanks BikeChainApp. I'm struggling to find time for side projects these days but if you wanna shoot me an email I'd be glad to take a look!

    • @bikechainapp2964
      @bikechainapp2964 2 роки тому

      @@BlockExplorerMedia Will do! Where can I find your email?

    • @bikechainapp2964
      @bikechainapp2964 2 роки тому

      @@BlockExplorerMedia email has been sent :)

  • @whatsgoingon4078
    @whatsgoingon4078 2 роки тому

    You lost me at... 2:36 Git Bash Here . How is this achieved ?

  • @ronaldsena9078
    @ronaldsena9078 2 роки тому

    Excellent content, too bad I'm Brazilian and I don't speak English and UA-cam subtitles don't translate your speech, I learned a lot, but without the audio or translation, some steps are hard to understand