Creating a blockchain with Javascript (Blockchain, part 1)
HTML-код
- Опубликовано: 12 июн 2024
- Learn how to write your own Blockchain with JavaScript. In this video I'll show you what is behind a blockchain by using simple code. It's not a complete implementation, but enough to understand how blockchains work and how they guarantee that blocks can never be changed.
After creating our blockchain we'll try and tamper with it. This will demonstrate a blockchains ability to detect fraud.
Next video (implementing proof-of-work):
• Implementing Proof-of-...
💌 Sign up for Simply Explained Newsletter:
newsletter.simplyexplained.com
Monthly newsletter with cool stuff I found on the internet (related to science, technology, biology, and other nerdy things)! No spam. Ever. Promise!
💰 Want to buy Bitcoin or Ethereum?
Buy for $100 and get $10 free (through my affiliate link):
www.coinbase.com/join/5928452...
► Source code
Available on GitHub:
github.com/SavjeeTutorials/Sa...
🌍 Social
Twitter: / savjee
Facebook: / savjee
Blog: savjee.be
❤️ Become a Simply Explained member: / @simplyexplained
#blockchain #javascript #coding #crypto #nodejs #simplyexplained - Наука
I do not understand anything about coding, but the way this mysterious gentleman stated everything, I was completely hooked up seconds by seconds till the end. I guess some peoples do have some extraordinary quality of teaching. Thanks Savjee
Tauw heed it’s that you actually care about learning about blockchain. Trying watching a video on programming a microwave keypad. Much less interesting lol
Agreed!!
@@ViralVeediuh true
Same here
SAME.
Great video. I'm a programmer so this made a lot more sense to me than watching someone try to describe how the blockchain works in a spoken presentation!
After +1 year of courses, projects documentation and tutorials I could finally understand how Javascript classes work thanks to this video. Thanks!
Savjee, I have finally been compelled to subscribe to a youtube channel. As an 'old dog' programmer, you have got me moving on blockchains more than the dozens and dozens and dozens of articles I have read. For a 'show me' programmer, this is just what the doctor ordered and I thank you for taking to the time to share your knowledge and for doing such an easily understood walk-through. Well done young man...
Thanks a lot! Reading your comments made my day!
Demystified this for me, finally! Thank you so much for making these concepts so tangible.
My gosh, in terms of covering the basic fundamentals this is an amazing intro!
For my internship, I was recently requested to do a simple web3-based project. This is what I've decided to use. Thanks for this project and for being a great teacher😁
So much information fit in this 15 minutes and this finally made blockchain click in my head. Thank you for this!
Yes! Really helpful video! Thanks!
Especially the explanation of difficulty and nonce.
Exactly! Over all those explanations online which doesn't provide any example, I can finally understand the base concept of a blackchain after watching this video, thank you soooo much. Autosubs
How can i make zsh in terminal
Same here. I think we belong to developer world. Simple words can't make us understand until read the programing logic. Hehe.
Very well done video. Steady pace, clear code, and an engaging voice. The blockchain just became a whole lot less intimidating and mysterious, so thank you.
Oh man, after watching heaps of videos on bitcoin, etherium and block chain. This is the first time I really got my head around only because we think in terms of code. Love you for that.
yeah, seriously. All these explanation videos make no sense. But looking at how the code actually works make perfect sense haha.
Same here 👨🏽💻
@@joeysipos if(currentBlock.hash !== currentBlock.calculateHash()){} TypeError: currentBlock.calculateHash is not a function : thats the error I got, not sure why it is function
"Simply Explained" indeed ! Amazing, cleared a lot of concepts.
Love this! Thanks so much for making this tutorial, really helps a non-techie like me get under the hood of blockchain!
Damn bro, that light theme doesn't hurt your eyes?
😂😂😂😂
and the bracket on the same line with the parentheses and no space, ew
Try working in very light room...it's common to work with light theme in that case, and with dark theme in darker rooms...
@@slavento yeah using dark theme in bright light environment is not good. Dark theme is perfect for only dark environments. And light theme is good for brighter environments
Does anybody know which theme is he using?
great video. subscribed!
Wonder I didn't come across your page months ago. Not just for this particular video but the quality and the clarity in all your videos are amazing. Huge fan!!
Explaining it in code makes blockchain technology so much easier to understand. Thank you for this! Great job!
This looks similar to linked lists in Data Structure with added security!
Great observation!! It is similar to a Singular Linked List data structure With one massively important improvement namely: O(1) (i.e constant time access) to all blocks in the chain, via the top-level array.
May i nitpick? The focus is on integrity which make it inherintly secure 😁
i was thinking the same thing
@@cazino4 yup it's linked list but not singly linked list, it's doubly linked list as it stores the adress of the previous block too.
@@SatyamGupta-gc9sq Nope, you're INCORRECT!! Please revisit the source code - it is quite clear.
The presented Block Chain data structure has more commonalities with a SINGULARLY Linked List, NOT a doubly linked list as you have attempted to suggest.
Whilst I agree that the structure does indeed store reference to the previous node (i.e its parent) it DOES NOT *DIRECTLY* store reference to the NEXT node. Thus it's essentially a singularly linked list in reverse.... But STILL a singularly linked list nonetheless.
Source: myself lol. I've actually built these types of core data structures (i.e Singularly/Doubly linked lists, Binary Search Trees, Balanced Binary Search Trees,Tries,etc) from scratch in numerous languages and have a deep understanding of matters pertaining to their. respective implementations,trade-offs, time-space complexity,etc
First! Also great videos man, thank you so much!
+Anthony Dutra Glad you like them! (And wow that was fast!)
Great! I was learning blockchain but with a traditional school teaching for weeks and I didn’t understand nothing but with your videos I completely hooked up great and very simple way to learn thanks and appreciate to share your knowledge ❤
Just amazing how you have explained this topic in a really easy way. Congratulations!!!
Subbed , you brought tears to my eyes.
exactly. That's why dark theme *is better*
Really great, that sparked a great idea in my mind! :) (y)
I swear, this is the video finally where I really understood the concept of Blockchain. I have watched many videos but was getting just repetitive things time and time again.
Thank You very much.
I have like and subscribed to you channel.
Very clean explanation, and also very clean english for those who doesn't speak english natively. Thanks!
I'm not a native speaker myself, so I have to keep things simple ;)
Awesome intro, I think you should make this a series so that people can make their own full blockchain using your details. When is the next video coming??
+Amit Yadav Great idea! Next stop would be to discover smart contracts. Definitely will work on that in the future. But first I need to finish another course ;)
+Amit Yadav Great idea! Next stop would be to discover smart contracts. Definitely will work on that in the future. But first I need to finish another course ;)
Amit Yadav how can i make zsh in terminal?
Simply Explained - Savjee Heyy any luck with making those blockchain courses
Hey! Thanks for the great content! One question: why didn't you generate block's index and timestamp on a fly in the constructor? Is there any reason for passing them on instance initiation?
hello, has this improved your knowledge of java and blockchain? have you made any progress on creating a blockchain? i would like to talk with somebody who might be able to help me script a source of a new blockchain
Thanks, I had the theoretical understanding of what a blockchain was before, but seeing it explained this way makes everything much clearer.
You are a great teacher, Mr. X! Thankfully, I do not have to write this code but I needed to understand blockchain for my graduate class. This video finally made it all click! (I watched your other one before this too and that was helpful as well.) Keep up the great work and thank you for sharing it for free!
would implementing some of those other features such as "proof of work/ stake", check of funds, ability to prevent tampering of data / rollback function be possible to demonstrate in another video? It would be greatly appreciated.
Not to mention P2P network consensus and transaction broadcasting. I sometimes think writing your own blockchain is just as ambitions as writing your own OS. Maybe it is just easier to take to bitcoin code and adapt it to your needs.
@Sophie, do you want a complete implementation? Just read the source code for Bitcoin or Ethereum...
Yeah the actual source code is the best option when you want to understand the more complicated aspects of merkle trees, nonces, unconfirmed transactions, and memory pools. But this is an extremely good generic intro on the fundamentals !!!
13:02 Blockchain is like "Mr.Stark...I dont feel so good..."
Thanks man. This really helps understand the concept without going into too much or too little details. Exactly what I was looking for.
I know nothing about coding, but this example really made me understand what's happening with blockchains - thank you!
it's will be great if you create a. video about smart contracts
That's a nice idea! I'll definitely consider that!
yeah pls do that and can u include dates in smart contracts for tokens to be distributed only during that time?
+Python_Tutorials Great idea! I'll think about how to implement that :)
great,thanks a lot and we would love to wait for that video
WORD!
How can I download the library on Windows? Because on windows the terminal is working with powershell
same problem here
did u solved ?
@@AbdulAhad-ni4hq same probleme :(
use bash instead :)
You need npm installed.
If you're really serious, I would switch your desktop from Windows to Ubuntu Desktop (free) or run Ubuntu in VirtualBox (free). Windows and Node/Javascript don't play well yet, there are still lots of problems with file names and stuff. The windows guys I work with are always having problems, the people on the *Nix/Mac system dont have these problems ever.
I'm not saying Linux/Mac is better than Windows, just saying that for now JavaScript is better on Linux/Mac. They my fix it soon.
Great tutorial, thank you.
I was "playing" with your code and i've just discovered that changing the "Genesis block" (block 0) attributes is possible (the chain stays valid). This is due to the "isChainValid()" method; as you can see, the method has a "for(var i = 1; i < this.chain.length; i++){ [...]" which starts from "i = 1". This means that no controls are applied to the first block (data can be changed without any problem).
A simple work-around is to change the "for([..])" loop (make it starts from "i=0" and check the previous block only "if(i>0)").
Thanks for your time and knowledge
You simply explained and I simply subscribed. This is what I was searching for as I don't knew any implementation of blockchain. thankyou
Great video. Congratulations.
I have a question though, in the example, I tried to tamper data and did recalculation of current hash and assigned to existing hash. I got output as true. We are not tampering anything with previous block hash. Basically I have not understand the check on current block hash with the previous block hash as for me it always return true.
Also if I carefully watch video , when you do a tampering and set current hash. It gives output as false. However if I examine your console which is on this video, both previous hash and current hash seems to be identical. Then how does it return false?
Thanks Matty
Did you put the return true statement in the body of the for loop?
I am having the same exact problem now. Did you manage to solve it?
when isChainValid loops and checks the block that is right after the one you changed, its previous hash will not match that preceding block's new hash that you had calculated
It's a great explanation video of Blockchain.
Can you tell what IDE you are using 0.0 Cuz i really like the UI , thanks
Hafrn The Grey white edition ;)
Press ctrl k + ctrl t, and select the quiet light theme :)
Watching this in 2020 and its broadens my programming knowledge. Thanks!
Fantastic!!! What an explanation! it just makes you understand the whole thing in one video!
Clear coding style makes a complex concept to be so easy that everyone can understand! Amazing...!
BRUH thank you so much!! I needed a simple implementable example with the core concepts intact!! Thanks again dude you are the best!! :D
I've watched too many videos to understand what a blockchain is and none of them seemed to help, but this video clears things up in my head about blockchain,
Thanks
This is amazing. I dont even do Javascript (just php) and i understand what you're saying. Great vid.
Thank you for sharing this. Today I decided to learn about blockchain. I hope I can learn enough to produce something to help make our world a better place.
Greatly explained the concept in a short video, great job!!
there were a few genious on algorithm n coding, but i think you one the best amid them....simple n clear
Thank you so much, Sir. You just make the whole concept of blockchain sys clear for me in just under 15 mins.
Great, you understand concepts through building them. Thanks, man.
Noticed this video on my recommendation and in 15mins understood the basics of blockchain… most importantly the simple and powerful sample you showed👍🏻👍🏻👍🏻
Excellent 11/10. Detailed, concise and easy to understand.
This is great. Simple and crisp. Thanks!
Thanks for the great tutorial. There are lots of videos describing how blockchain works, but only a few that give some technical example(s). Among those few, this video stands out really well. For those who are new to blockchain (e.g. me), this video is really enlightening.
Very intuitive way to explain about blockchain. Thumbs up!
Wow! This explanation demystified the whole concept of blockchain . Thanks 😊👍
This video was simple and informative. thank you.
Wow very simple explained ! thanks sir you are save my life!
Very nice introduction. Perfectly explained concepts in a compressed timespan.
Amazingly explained! I really didn't know anything about Blockchain. After watching this video, I was like "wow, this guy is amazing!". You did it so nice Savjee! Thanks a lot!
This is so easy. For all the noise this "technology" has made. I am impressed how fundamentally basic is the idea itself.
he explained in a simple matter , thank you
simply explained a complex code. Love this video
Thank you for clearly and efficiently explaining the concept of block chain. Now it makes sense :)
Finally understood how magic internet money works. Awesome video!
The best beginner level blockchain tutorial.
This explanation is so solid! Like others said in the comments, this is what made me get it. I sortoff knew but this made the click and will make it much easier for me to explain it myself in the future. Thanks!
Best 14 min of the year!! tks a lot!
Absolutely love this video. Only regret is why I just found you now. Subscribed!
Thanks for the series. This has helped me understand blockchain.
simple, objective and complete ! Thanks :)
Best block chain explanation video so far I've seen
Extremely simple and well explained amazing.
Very well explained blockchain in simple javascript code! Thanks a loooot!
Clarity by far the best tutorial i have ever seen
thanks man...I was wondering how this works in code & thats what you explained so clearly.
Clutch video. Excellent explanation of block chain. So much simpler of a concept than when you just hear it explained.
So much info in just under 15minutes. Thanks
Easy explained and good to follow. Thanks!
The first video about Blockchain that I actually understood
Best and simple way to understand the core concept of blockchain . Nice job ...
Thanks , such a clean code and clear speech. Benefited a lot !
This is a great video. Concise and easy to understand.
so so helpful, I can't believe all that happened in 15min. Love it. Please keep it up
Very easy to follow and succinct. Well done!
Thanks bro. I imagine blockchain works like magic until i watched your video.
This videos is just awesome, everything makes sense now, thank you!
amazing, now I understand something about blockChain
Loved the explanation. You got a nice way of teaching.......Thanks :)
Wow.. Thanks, Sanjeev for this video. I`ve been searching for something to enlighten my brain with what`s actually Blockchain is. Finally, you did it... Thanks man
This is a top notch video mate. Tomorrow I’ll get started.
clean example, clean explanation. hearty thanks enclosed in my subscription
Excellent!!!! Thanks a lot for such a clear explanation.
I don't even know how to code but this video made so much sense, great job!
Thank you Savjee for free and *high quality* knowledge
i watched the whole thing ,didnt understand anything but it was fascinating
ure a genius
for the first time in life i have watched the whole info stuffed youtube video in one go. keep it up man!!
wow! great video... I'm a low level dev and by watching the last 2 videos, really got the concept and quick application. Cool!
I liked this very much! Thanks for the demo.
Love the way you explain things for a noob like me
Thank you so much for giving detail information that is germane to the subject at hand. I’ve watched tons of video on this topic and walked away clueless