Implementing Proof-of-Work in Javascript (Blockchain, part 2)

Поделиться
HTML-код
  • Опубликовано: 9 янв 2025

Комментарии • 330

  • @exo.master
    @exo.master 7 лет назад +135

    It is kinda funny how we, software developers with some knowledge about Object Oriented Programming, can understand the concepts very fast when classes are given in OOP. Between .. dear Savjee, your techniques show excellence on teaching, congratulations!!

    • @jgttech
      @jgttech 6 лет назад +11

      So true. I was just saying to a co-worker of mine that I wish everything was explained in OOP, then I could learn physics and anything at that point lol. OOP is how you communicate to a modern developer lol. So freaking true.

    • @fxstreamer238
      @fxstreamer238 3 года назад +2

      @@jgttech If you dont understand physics you probably wont understand oop

    • @_jko
      @_jko 3 года назад +3

      This is exactly I came to watch the video. I watched a bunch of other videos that tried to explain the concept, but it generated MORE questions, not less. It's easier to understand things in code, because there are no contingencies. All the ideas, advantages, disadvantages, potential for bug, etc., are all in the code, whereas spoken words are so malleable and leave a lot of room for interpretation.

    • @jordixboy
      @jordixboy 2 года назад +1

      @@fxstreamer238 what has physics to do with OOP lol. It's just a way to model data, another data structure, nothing more.

    • @fxstreamer238
      @fxstreamer238 2 года назад

      @@jordixboy ask the other guy. he wants to learn physics with oop. you thought you were smart but you just caught off guard didnt you

  • @jessss7792
    @jessss7792 7 лет назад +223

    Another solid video. Please continue this series, I'd love to see part 3!

    • @elgrimoriodelchamo1017
      @elgrimoriodelchamo1017 7 лет назад +5

      Same here. Amazing videos. Greetings from Venezuela, thank you very much Savjee!

    • @LeandrocBr
      @LeandrocBr 7 лет назад +1

      one more here!!

    • @BFFGamingHD
      @BFFGamingHD 7 лет назад +1

      YES, YES AND YEEEEES!

    • @austinkim1735
      @austinkim1735 7 лет назад +1

      one more!

    • @joaofrutinho
      @joaofrutinho 7 лет назад +2

      Epale chamo, yo también estoy en Venezuela, estoy interesado en hacer contacto con otros desarrolladores de aquí, si quieres nos contactamos, yo soy autodiacta. Así que sería genial poder ver en qué podemos ayudarnos.

  • @drbasavarajans
    @drbasavarajans 7 лет назад +52

    And finally I could comprehend what bitcoin is. Thanks for that crisp and neat threadbare tutorial. Thanks. Hats off to your skill of telling.

    • @fxstreamer238
      @fxstreamer238 3 года назад

      congrats now you are 0.0001 % closer to understand btc.

  • @xCoKeZx
    @xCoKeZx 3 года назад +6

    I never really understood how blockchains work until now. Apparently all I needed was an illustration in an OOP-way. Thanks a lot!

  • @rishabhsingal9423
    @rishabhsingal9423 3 года назад

    I've watched more than 6 hours worth of videos on blockchain but still never understood how it really works. But this 6-minute video quick explains how blockchain works in such an easy-to-understand way! Hats off, thank you!

  • @cameronm9968
    @cameronm9968 6 лет назад +8

    Seriously helpful video man! Seeing it implemented made blockchains so much easier to understand. I finally get why proof-of-work actually works and how it prevents and slows malicious modifications to the chain. Incredible work.

  • @JackSparrah
    @JackSparrah 3 года назад +2

    Just starting to learn about blockchain in 2021, and this was super helpful. Seeing it coded live made it so much more clear. Thank you!

  • @g_pazzini
    @g_pazzini 6 лет назад +10

    awesome.... i'm an OOP developer... and i can finally understand blockchain by watching your videos... thanks!

  • @_jko
    @_jko 3 года назад

    Thanks for the video. I watched a bunch of other videos that tried to explain block chain in plain English, but they utterly failed. You started with the basic idea, and improved it as you went on through the video to show how to address potential pitfalls. That was really helpful. None of the other videos do that. They just simply throw a definition at you and hope that you understand it from there.

  • @rum81
    @rum81 7 лет назад +1

    Thank you very much for these two videos, i have understood in 15-20 minutes what could not understand after months of blog and videos on block chain

  • @kkode001
    @kkode001 6 лет назад +1

    Very helpful series. Awesome!!! 10 mins of code is better than 10 hrs of talk. Thanks and keep it up.

  • @fredkilby5535
    @fredkilby5535 6 лет назад +2

    Great video in explaining the technical aspects of blockchain and how to parts fit together.

  • @therealguanzo
    @therealguanzo 3 года назад

    This is so informative for someone that knows nothing about blockchain tech. Thanks!

  • @نورمحمد-د7ك2ب
    @نورمحمد-د7ك2ب 2 года назад +1

    my English is not very well but i can understand what you say, this thing not often happened ,about blockchain you do amazing job mashallah 🤩

  • @kp8752
    @kp8752 7 лет назад +1

    These videos are fantastic honestly. Also the easiest to understand blockchain intro tutorial

  • @arsnakehert
    @arsnakehert 6 лет назад +6

    Damn, what a brilliant little series! This is so very illustrative! Thank you!

  • @vprnet
    @vprnet 6 лет назад +1

    Surah, you are a very talented instructor!

  • @yohan_aka_spof
    @yohan_aka_spof 5 лет назад +1

    Very interesting !
    There is just two small bugs:
    1) in the constructor of your block you call calculateHash before setting the nonce, which will be then undefined. Overall, I wouldn't call calculateHash in constructor as you will anyway overwrite it inserting it in the chain.
    2) in your mining function, you first increment nonce, then you calculate your hash so you will never test the case with nonce = 0

  • @jamallucas
    @jamallucas 7 лет назад +1

    I finally understood the logic behind blockchain. Great video buddy!!!!!

  • @lovebajpai5288
    @lovebajpai5288 7 лет назад +4

    Great work Savjee!! It simply explains the nonce, difficulty and mining in such an easily understandable way!!! Thank you!!Can you also do something around Valet and how it fits in all this?

  • @ayuthmang
    @ayuthmang 5 лет назад +4

    Thank you for explaining block chain and proof-of-work in the easiest way. Hope to see more videos. -)

    • @jimannothe
      @jimannothe 3 года назад +1

      In the easiest way. though that's subjective

  • @aeonreigh
    @aeonreigh 6 лет назад +1

    I love this! way better from the talks I've been to about block chain!!!

  • @Grkashani
    @Grkashani 4 года назад

    you are awsome man !!!!!!!!!!!!! , after many years looking for understanding blockchain I found my answer from you , thank you so much,

  • @DurgaPrasad3496
    @DurgaPrasad3496 7 лет назад +1

    This is Awesome. After watching this video i get into better perspective of blockchain. Thank You!

  • @chrisc9725
    @chrisc9725 3 года назад +1

    Wow man I've just come across your channel, its amazing, thank you.

  • @LucasAdSantos
    @LucasAdSantos Год назад

    I'm a professor watching the playlist from Brazil! Tranks!

  • @whysoseriouscooking
    @whysoseriouscooking 5 лет назад +1

    This channel has liberated my mind! I repeat 'LIBERATE'!

  • @freddie2153
    @freddie2153 7 лет назад +1

    Great series so far, easy listen but packed full of info!! Looking forward to more.

  • @cazino4
    @cazino4 4 года назад

    Fantastic video, great to see a practical examples of what a block chain implementation might look like. Thank you.

  • @nilvoidzero000
    @nilvoidzero000 3 года назад

    Thanks!

  • @vsowill
    @vsowill 2 года назад

    It’s wild how relevant this video is in 2022 and it’s 4 years old. 🔥🔥

  • @FreedomForKashmir
    @FreedomForKashmir 3 года назад

    I LOVE your videos on blockchain ..... you are the best teacher over the internet
    You cleared a lot of my concepts

  • @saumilkapadia88
    @saumilkapadia88 6 лет назад +1

    mind blowing brilliant video and explanation.

  • @jobsphil9553
    @jobsphil9553 7 лет назад +10

    Thanks for your sharing.. You are the great.. definitely .

  • @Saitama-ur3lq
    @Saitama-ur3lq 4 года назад +1

    curious question the nonce is an integer right? what happens if it overflows

  • @christopheverdot9075
    @christopheverdot9075 6 лет назад +3

    Very nice video, doing a POS instead of POW would also be possible on this javascript Blockchain demonstration ?

  • @BFFGamingHD
    @BFFGamingHD 7 лет назад +3

    Savjee, please continue this series! I love it and I love you

  • @artofchickens
    @artofchickens 6 лет назад +1

    I just recently found your channel. This and your previous video are awesome! I have yet to watch the rest. Thanks so much for such valuable information!

  • @adams1378
    @adams1378 7 лет назад +3

    Amazing video dude. Please continue along that path, really interesting !

  • @kejoe100
    @kejoe100 7 лет назад +2

    Your way of teaching is really good, very easy ro understand blockchain, its been 2 months u had not uploaded any video on this series, should we expect more videos???

    • @simplyexplained
      @simplyexplained  7 лет назад +1

      Sometime in the future yes. Been busy with the Simply Explained series. Been thinking where I can take this Javascript implementation next.

    • @kejoe100
      @kejoe100 7 лет назад

      Thanks Savjee!! Good to here, looking for next videos 😊

  • @RyanHooGeek
    @RyanHooGeek 6 лет назад +1

    Really nice video, it explains a lot! Words in the paper of bitcoin were so confusing before I watch this.

  • @fabiofreitas7760
    @fabiofreitas7760 5 лет назад +1

    In Bitcoin, do they define the difficulty by making the hex encoded hash of the block start with n zeros or the bits themselves?

  • @nandusuy
    @nandusuy 2 года назад

    Thank you. Learning with you is a comforable experience!

  • @jazztwk
    @jazztwk 7 лет назад +2

    Great video, really explain clearly in the technical prospective of proof of work, please make more example video

  • @RaceBook.
    @RaceBook. 7 лет назад +1

    Please upload the 3rd part also. great video lecture

  • @gilbueno5181
    @gilbueno5181 7 лет назад +11

    Make a Part 3 please :)

  • @nouhbelahcen4486
    @nouhbelahcen4486 4 года назад +1

    Really amazing explain, Thank you very much.

  • @klx450dude
    @klx450dude 7 лет назад

    greaaat greaaat video! Best explanation so far i found online about blockchain and mining, thank you! Please continue! :D

    • @simplyexplained
      @simplyexplained  7 лет назад

      Working on something right now. Will be published after next Explained video 🤐

  • @4by4rusjo44
    @4by4rusjo44 6 лет назад +1

    Great stuff mate. Thanks for sharing

  • @ssiroma
    @ssiroma 3 года назад

    Thanks

  • @danilosampaio6493
    @danilosampaio6493 2 года назад

    Someone gives an Oscar for this guy! This is simply awesome

  • @yousafhassan8655
    @yousafhassan8655 6 лет назад +1

    Thank you so much Sir. The mining concept was very well explained.

  • @kinershah464
    @kinershah464 2 года назад

    Wow that was simple and it seems to be quite effective solution.

  • @lapsedubstep
    @lapsedubstep 7 лет назад +1

    AMAZING video. thankyou! Hope to see part 3 ❤

  • @kejoe100
    @kejoe100 7 лет назад +1

    Thanks for the videos, I love this kind of series!!! Plz plz make next videos

  • @phnxbr
    @phnxbr 6 лет назад +1

    Hi! It was a pleasure to watch these videos, really simple comparing to others overсomplicating it. Just keep going.

  • @neethucheriyan1077
    @neethucheriyan1077 5 лет назад +1

    sir could you pls explain how can we update the previous hash of a particular block, when the data in the previous block is updated

  • @techtantrik
    @techtantrik 7 лет назад

    Well paced lab and very well explained. Thanks!

  • @awekeningbro1207
    @awekeningbro1207 5 лет назад +2

    what if we used settimeout function for proof-of-work instead?

  • @vectorfield
    @vectorfield 7 лет назад +4

    Thanks a bunch for this series, this has helped me tremendously in my quest to grasp how blockchains/cryptocurrencies work.
    One thing I don't understand though is how you would now allow others to make use of this blockchain.
    Coming from a web background my first instinct tells me that you need to host this somewhere in order for other people to make use of it.
    However, I've heard a lot about decentralization with regards to this technology so that can't be it. Is this where the Bitcoin protocol / P2P decentralized networks come into play?
    Also, a video on how to implement your own smart contracts would be awesome as well.

    • @simplyexplained
      @simplyexplained  7 лет назад +7

      Thanks for the kind words!
      Yes, in order for others to be able to use this blockchain, it would need a P2P network. Each node that has to announce itself on the network and find the longest valid chain available. Once that is found, the node needs to copy the entire chain and then he can start using it.
      It also needs a broadcast system for new blocks. As soon as a node mined a new block it should broadcast this to the entire network so others can add that block to their own chain and keep the consensus.
      I'm still thinking about extending this series with more video's (thanks for the smart contract suggestion).

    • @adldesigner
      @adldesigner 7 лет назад

      Hey Savjee, keep this series going. I'd love to know how to setup a simple P2P network like that.

    • @vectorfield
      @vectorfield 7 лет назад +1

      Thanks for clearing that up for me, I appreciate it tremendously.
      Here's another question: What happens when two random nodes successfully mine a block at the same time and then both broadcast it onto the network? How will this algorithm decide which block is the block they should continue the chain with in that situation? Does the losing block get destroyed?

    • @simplyexplained
      @simplyexplained  7 лет назад +2

      Chances of that happening are pretty low. But it can occur. In that case one of the blocks will go around the network faster than the other, and that one will win. The other one is then abandoned and becomes orphaned.

  • @rleevzlno
    @rleevzlno 7 лет назад +1

    Awesome content. Thanks for share it

  • @ivanche8051
    @ivanche8051 3 года назад

    You can also create a string of all zeros of an exact length by using repeat method
    ‘0’.repeat(difficulty)

  • @mikeigoe
    @mikeigoe 7 лет назад +1

    Brilliant tutorial, thanks.

  • @phet1574
    @phet1574 7 лет назад +1

    Great series! I would love to see the part3 :D

  • @PavonDunbar
    @PavonDunbar 7 лет назад +1

    Amazing video. Subscribed. Thank you!

  • @JChengZhang
    @JChengZhang 7 лет назад

    Explained so simple. Please continue with this!

  • @Mentaleak
    @Mentaleak 7 лет назад +1

    Great Video, Please do another one for Smart Contracts

  • @j8577798yt
    @j8577798yt 7 лет назад

    Best explanation on the net !!!

  • @gabrielmicko4771
    @gabrielmicko4771 4 года назад

    Very great, solid video. Thanks

  • @AnishSingh-st5yl
    @AnishSingh-st5yl 5 лет назад +1

    Merci beaucoup Xavier...

  • @maxbruhn8383
    @maxbruhn8383 7 лет назад +1

    Very good video. Keep em coming.

  • @juancarlosgonzalez9722
    @juancarlosgonzalez9722 3 года назад

    Solid explanation my dude. Thank you.

  • @shgazda
    @shgazda 7 лет назад +1

    Man, great video! Thanks!!

  • @trungkienle3714
    @trungkienle3714 6 лет назад +1

    thank you so much! It really helpful to me

  • @neerajkulkarni6506
    @neerajkulkarni6506 3 года назад

    This is so well explained!

  • @michaelthedriver242
    @michaelthedriver242 4 года назад +1

    What exactly does the "difficulty" do?

  • @SoubhikSenArts
    @SoubhikSenArts Год назад

    The only loophole is that the latest block can be tampered by changing its body and recalculating the hash since the correct hash of the latest block is stored nowhere as there is no successive block. How do you handle this?

  • @josephroney2014
    @josephroney2014 5 лет назад

    Why do you need to mine the block or calculate the hash twice? the first time at the constructor and then when adding new blocks to your chain.

  • @LeandrocBr
    @LeandrocBr 7 лет назад

    Fantastic!!! I would like see another videos about this...

  • @jaikant931
    @jaikant931 3 года назад

    Brilliant explanation. cheers

  • @allphredo
    @allphredo 6 лет назад +1

    Noob question: is it possible for the hash to never have the required number of zeros? could 'nonce' overflow?

  • @sankhatvijay
    @sankhatvijay 6 лет назад +1

    @Simply Explained - Savjee, First of thank you for the great video. I need help from you. we are planning to create new payment gateway, is it good to implement blockchain technology for our new payment gateway?

  • @FredChevitarese
    @FredChevitarese 7 лет назад

    Very nice videos. Keep doing this :) Thanks!

  • @Raayol
    @Raayol 7 лет назад +1

    Thank you!!! You are awesome!!

  • @erik-sandberg
    @erik-sandberg 6 лет назад

    If it takes a considerable amount of time to calculate a valid hash, how does one quickly verify the whole chain? In the last video, Savjee's isChainValid function calculated the hash for each block, but that would take way too much time, right?

    • @erik-sandberg
      @erik-sandberg 6 лет назад +1

      To make it quick to verify each hash in the chain of blocks, the 'nonce' value must be included in the block's data then, right? Then the none value doesn't need to be guessed when verifying a block that already exists

  • @john-blair
    @john-blair 3 года назад

    Great video. Simply Explained. Thanks.

  • @LeifDeJong
    @LeifDeJong 7 лет назад +1

    How would one conceivably implement the P2P part of this?

  • @SafalLamsal
    @SafalLamsal 7 лет назад +2

    great video!! part3 smart contracts?

  • @hadireg
    @hadireg 4 года назад

    excellent explanation!!!👍👍

  • @YogeshPadsala
    @YogeshPadsala 7 лет назад +1

    yes this is a great video. thank you

  • @pietromonsorno5390
    @pietromonsorno5390 4 года назад +2

    i'm having an issue with the substring function on vscode, i does not recognize it as a function. Any help?

    • @Foxlendor
      @Foxlendor 3 года назад

      same

    • @Foxlendor
      @Foxlendor 3 года назад

      How did you spell "constructor"

    • @pietromonsorno5390
      @pietromonsorno5390 3 года назад +1

      @@Foxlendor np mate, it was 1year ago, plus for what I recall, it definetly was a typo nothing more😂.
      Thanks anyway

  • @munezhans7735
    @munezhans7735 5 лет назад +1

    Well done. Thank you

  • @yandraalays9242
    @yandraalays9242 3 года назад

    Silly question about "proof-of-work"
    If transaction happen. Who will validate it or check it? or How validate it or check it?

  • @flamingwoodz
    @flamingwoodz 7 лет назад

    This video series is awesome

  • @jordixboy
    @jordixboy 2 года назад

    good job man! im curios how would proof of stake be implemented?

  • @saumilkapadia88
    @saumilkapadia88 6 лет назад +1

    Is there any next part of this??? Plz plz plz make it if not. With javascript only please

  • @potterprasant380
    @potterprasant380 3 года назад

    Osm... Thank You For This video ❤

  • @liotechtutorials7089
    @liotechtutorials7089 4 года назад

    Can you please do a tutorial on diffie hellman and rsa encryption in node js?

  • @dipanshunegi9805
    @dipanshunegi9805 3 года назад

    Thank you do much sir .. love you for this.

  • @buzonliao
    @buzonliao 7 лет назад +1

    Awesome video!