Signing transactions - Blockchain in Javascript (part 4)

  Рет қаралды 123,044

Simply Explained

Simply Explained

Күн бұрын

Пікірлер: 175
@simplyexplained
@simplyexplained 6 жыл бұрын
If you were in the live stream and asked some questions -> ask them again here in the comments. KZbin closed the chat :(
@maximebeaudoin4013
@maximebeaudoin4013 6 жыл бұрын
#1: why did it have to be JS, i'm kinda new to programming but the syntax differs to c# in some areas and i find it less intuitive. #2 why visual studio code and not visual studio? #3 would you consider creating a simple ui to implement the functionalities created here while at the same time addressing the subjet of p2p?
@andresm9051
@andresm9051 5 жыл бұрын
Really good content, keep going! I would like to ask, how to create ,sign and transaction using web3 and ethererum blockchain
@senteria
@senteria 5 жыл бұрын
Hello there, great video, however I get result that my chain is not valid and balance is -10
@nevcheart
@nevcheart 5 жыл бұрын
@@senteria I got this as well, my error was in minePendingTransactions()..missing a couple of lines
@peopleyoumustknow1325
@peopleyoumustknow1325 3 жыл бұрын
Very helpful
@fluffymaverick
@fluffymaverick 3 жыл бұрын
For anyone having -10 balance in the first run, see 8:05, he added a rewardTx object in the minePendingTransactions method and push in the pendingTransactions array. I guess he forgot to discuss about it in the video. Anyways thanks Xavier.
@TamunutonyeHart
@TamunutonyeHart 2 жыл бұрын
Thanks!
@daa82
@daa82 2 жыл бұрын
Yup, couldn’t figure out how he got $90 since the $100 should have been a pending reward that should become part of his balance after a 2nd mining occurs. Should have been -10.
@gregorystevens5173
@gregorystevens5173 2 жыл бұрын
Gr8 catch. Thanks Alvin!
@shin4ko131
@shin4ko131 2 жыл бұрын
thank you
@vsemsimpa4507
@vsemsimpa4507 2 жыл бұрын
It still incorrect, as he performs the transaction first and only then he receives 100 as a reward for mining the block with the transaction that makes his balance -10. So, ideally, his addTransaction call on line 13 gets rejected, as there are not enough funds. Only after he mines the block and receives the reward, he should be able to transfer some coins.
@davidwhite4258
@davidwhite4258 5 жыл бұрын
P2P Bro we dying for that to be implemented
@AAA-bo1uo
@AAA-bo1uo 6 жыл бұрын
Been watching youtube for YEARS now, you are literally the *_FIRST_* I *_EVER_* subscribe to! I was able to take everything from first episode in this series to this one in 1 sitting :D Short, precise and on point with an actual clean and clear code, that is scarce! I'm still having problems with signatures but that's because I never dealt with them before.. I never interacted with public and private keys directly before. I'll probably understand it as soon as I code it in myself. Most appreciated mate! Keep up the good work!
@simplyexplained
@simplyexplained 6 жыл бұрын
Wow thanks a lot man! I feel honored to be the first creator you subscribed to. Keep coding & keep learning!
@Boggothefroggo32123
@Boggothefroggo32123 2 жыл бұрын
@@simplyexplained I keep getting the error TypeError: Transaction is not a constructor, how do I fix this?
@rfmemarian8550
@rfmemarian8550 8 ай бұрын
I loved the video. That was the best way to describe block chain to a developer. Thank you for such an effort!
@pdhakeph
@pdhakeph 6 жыл бұрын
I thoroughly enjoyed this learning block chain through implementation. Thank you
@JamesFrederickstech
@JamesFrederickstech 6 жыл бұрын
this video is pure gold! thanks for doing this. im going to go back and watch all the previous videos now.
@asmrtist9058
@asmrtist9058 4 жыл бұрын
Love your Blockchain in Javascript series. Indeed, I learned Angular JS only so I could continue with part 5 of your series.
@alonsourena_
@alonsourena_ 6 жыл бұрын
Excellent video, I really learned a lot, keep going bro. Hope you can keep going with this series
@v85216192
@v85216192 3 жыл бұрын
One of the best tutorials I have seen in CS learnings!
@desertfox9613
@desertfox9613 5 жыл бұрын
By far the best explanation of cryptocurrency technology.
@zeerobug
@zeerobug 6 жыл бұрын
Great video. Now every time you mine, you get a reward, even though there are no txs! Can't wait for chapter 5
@simplyexplained
@simplyexplained 6 жыл бұрын
Hmm, this is also the case in Bitcoin I guess. Blocks are added on a steady interval and they don't have to include transactions.
@killianpinier5074
@killianpinier5074 3 жыл бұрын
Thank you so much !! I really liked the way you organised your videos. I learned a lot thanks to you ! Keep going 😍
@Leoninmiami
@Leoninmiami 6 жыл бұрын
You are a stud my friend! thanks for taking the time to put this together!
@filipstamcar6553
@filipstamcar6553 6 жыл бұрын
You make transaction hash from from address, to address and amount. What is they are same in multiple transactions? Fox example if I send same amount of coins to same address multiple times?
@simplyexplained
@simplyexplained 6 жыл бұрын
Aha! You're right, how silly of me! I will include a timestamp to make it unique. Thanks!
@GS-xg7sl
@GS-xg7sl 5 жыл бұрын
Great tutorials for beginners who want to learn about this new exciting technology. Can you also do a video on Smart Contracts in this series.
@mydentalscaler3462
@mydentalscaler3462 3 жыл бұрын
Thank you a lot brother! You made it easy and simple to understand! Thanks again
@vijayantpawar3137
@vijayantpawar3137 5 жыл бұрын
When I run it, I got -10 and valid? False . How to fix this please reply.
@fluffymaverick
@fluffymaverick 3 жыл бұрын
For anyone having 90 balance but chain is false please check your minePendingTransaction method. let block = new Block(Date.now(), this.pendingTransactions, this.getLatestBlock().hash); make sure to add this.getLatestBlock().hash.
@EliteJLad
@EliteJLad 2 жыл бұрын
bro thank you sooooo much
@oguzhanyesilpinar
@oguzhanyesilpinar 2 жыл бұрын
thank you so much
@mual77
@mual77 6 жыл бұрын
Another excellent video!! Keep up the good work.
@Plrang
@Plrang 6 жыл бұрын
Simply Fantastic Explained you mean
@javedahmed1276
@javedahmed1276 6 жыл бұрын
Great stuff man. Please create videos on creating a smart contract
@tomoya0650
@tomoya0650 6 жыл бұрын
An interesting blockchain 101. Like it.
@applicable_simplicity
@applicable_simplicity 5 жыл бұрын
One of the important validation is to check if the transaction is send out an amount larger than the current balance. In blockchain, how to check this validation, could you please advise?
6 жыл бұрын
Great video, the signing of transactions was a missing part in the chain. Thanks! By the way, you forgot to re-hash the second block after you changed the amount of the transaction. Hopefully it still wouldn’t be valid due to the incorrect signature at that point.
@TJ80ify
@TJ80ify 5 жыл бұрын
yeah mine came out isValid == false
@GodSavetheWest
@GodSavetheWest 5 жыл бұрын
How can that error be fixed??
@emarciobdirector
@emarciobdirector 2 жыл бұрын
@@GodSavetheWest I also would like to know.
@TamunutonyeHart
@TamunutonyeHart 2 жыл бұрын
yeah, i noticed it the same result, invalid
@alphansomurray6535
@alphansomurray6535 3 жыл бұрын
Good Morning, do you have a tutorial that shows how you would facilitate the block chain code to manage IoT devices like a camera?
@EduardsSilins
@EduardsSilins 5 жыл бұрын
You are the best! Thanx for this tuttorial...
@dinudin7133
@dinudin7133 3 жыл бұрын
Great explanantion, but at 17:03 i got chain false. though the balance show 90. any idea on this?
@vlaming6818
@vlaming6818 3 жыл бұрын
You need to add this.getLatestBlock().hash to the block variable in the minePendingTransaction function.
@sohaibsoussi9042
@sohaibsoussi9042 2 жыл бұрын
let block = new Block(Date.now(),this.pendingTransactions,this.getLatestBlock().hash)
@mauriciowkjhef
@mauriciowkjhef 5 жыл бұрын
Should 'fromWallet' balance be checked before pushing into pending transaction?
@simplyexplained
@simplyexplained 5 жыл бұрын
Yes it should be!
@ipungdevacademy
@ipungdevacademy 4 жыл бұрын
Thanks you are my hero
@marekczyz3483
@marekczyz3483 5 жыл бұрын
Wow! It is really valuable content!
@miscellaneous9932
@miscellaneous9932 4 жыл бұрын
You are the best mate! Cheers!
@x0r1k
@x0r1k 3 жыл бұрын
You've left a big issue: anyone can pretend that he get a transaction from null address. That's why reward transaction should go to the current block, no to the pending list
@simplyexplained
@simplyexplained 3 жыл бұрын
Yes, this was fixed on GitHub. Can't update the video though.
@vivekjain010184
@vivekjain010184 5 жыл бұрын
fantastic explanation!
@amritkanoi8804
@amritkanoi8804 4 жыл бұрын
Dude you are legend !
@aliharmanansari7148
@aliharmanansari7148 3 жыл бұрын
Great Video, but I didn't understand that how can some Wallet send 10 coins when it has 0 balance. From where is the initial balance is coming form, and can a wallet have negative balance?
@anonymousnearseattle2788
@anonymousnearseattle2788 3 жыл бұрын
Maybe all of Bitcoin's starting coins were purchased by the Federal Reserve! 😁
@thenoizy
@thenoizy 6 жыл бұрын
Well explained! Thanks
@cristiang4774
@cristiang4774 6 жыл бұрын
What is the difference between a private key and a public key? If only the private key is unique does it mean that you can send coins to multiple wallets that share the same public key at once? And if they are both unique (the private and the public keys) why do we need both and not just the public one (considering it is longer)?
@simplyexplained
@simplyexplained 6 жыл бұрын
Private and public key are both unique. The public key is freely shareable with anyone. It's the address of your wallet. The private key on the other hand is used to sign transactions. It proves that the owner of the wallet is taking money out of it. It should be kept secret so only you can spend your coins.
@Sico10001
@Sico10001 3 жыл бұрын
outstanding
@kinahecate9168
@kinahecate9168 3 жыл бұрын
Thanks so much for this
@waqasiqbal3594
@waqasiqbal3594 3 жыл бұрын
Where do all the transactions are actually saved in the block chain?
@shaheermohammed2865
@shaheermohammed2865 6 жыл бұрын
Hello Savjee,You are really great.Your way of teaching is excellent.Still i have a doubt.I run your code and even if i don't have any balance in my wallet i am able to make a transaction and sometimes it shows negative values in balance.Can you do something to check the balance in our wallet before making transaction?
@simplyexplained
@simplyexplained 6 жыл бұрын
Absolutely! There are still a lot of checks you can implement to make it better as a cryptocurrency
@christopherequin
@christopherequin 6 жыл бұрын
thank you for this new video.
@asdeq2006
@asdeq2006 5 жыл бұрын
why don't we need to take account of the nonce in checking the validity of the blockchain in this example? Otherwise, someone may easily tamper the data in the blockchain and re-calculate the hash of every block in the blockchain rapidly.
@ethernetwink7230
@ethernetwink7230 2 жыл бұрын
is there a library like elliptic for python??
@IQ88612
@IQ88612 5 жыл бұрын
hi, thank you very much for your videos but, what is the peer library in python to that elliptic library in JS?
@janhim
@janhim 6 жыл бұрын
really nice ...
@jayantkhandelwal7326
@jayantkhandelwal7326 4 жыл бұрын
Hi, I have a doubt, as we have removed the reference to previous hash when we removed addblock method, then how are we implementing a blockchain without having previous hash value?
@JaneDoe-od4ep
@JaneDoe-od4ep 3 жыл бұрын
I cant get the trick with the public key and the wallet address. You say the transaction isnt valid if my wallet address != public key ... ??? Like I install electrum and create a wallet with address like 'ab1d'. Then I generate a pair of keys like public: '123f' and private: 'r45t'. So 'ab1d' != '123f'. No my transactions are ever valid? Dafak?
@ailton.duarte
@ailton.duarte 5 жыл бұрын
How to save transation, to not lose it when de program goes down, like when u run de program, how can i save de data from a blockchain? Or the p2p network is the database, if just one is online, we will have all data save!
@lukedavitt5357
@lukedavitt5357 5 жыл бұрын
at the end of the video, shouldn't the balance be -10, since the reward would still be a pending transaction and not processed yet? ( the same reason why about 5 minutes earlier you had to mine twice to see the reawrd in your balance )
@ElChe-Ko
@ElChe-Ko 3 жыл бұрын
Aren't you checking anywhere if the account has enough money to allow the transaction?
@alaaradwan7242
@alaaradwan7242 5 жыл бұрын
Is this package has a random function that may generate tow pairs of public and private keys with the same values ??!!
@gizemcelik6240
@gizemcelik6240 5 жыл бұрын
Hey there Savjee! i have a quick question. I am trying to understand the whole Bitcoin topic and your videos are super great. But when i am coding along i am getting an error msg that says that my block.transaction in the getBalanceOfAddress method is not iterable. i have double checked everything and its not different from your code. any ideas on where the issue is?
@simplyexplained
@simplyexplained 5 жыл бұрын
Is your version of nodejs up-to-date?
@gizemcelik6240
@gizemcelik6240 5 жыл бұрын
@@simplyexplained it actually wasnt, now everything is working. thank you!
@auroraiiit5765
@auroraiiit5765 4 жыл бұрын
Kind request. i am unable to figure out why there is an error ( No signature in this transaction) even when my code is the same as here and even matches source code. have checked it several times .... pls help
@stocksandblocks9661
@stocksandblocks9661 5 жыл бұрын
bitcoin is gonna change our lives. We help people to know it
@subhambanerjee6334
@subhambanerjee6334 5 жыл бұрын
hey when i am running the code it shows an error that it should have from and to adrees
@iBaldie
@iBaldie 6 жыл бұрын
How do you release your code so it’s decentralised and can be used? How is this done? Great tutorials!
@simplyexplained
@simplyexplained 6 жыл бұрын
Not sure I understand your question. You usually just put your code up on a website so everyone can download it. That's how all cryptocurrencies do it. They let anyone download their client from their site.
@Boggothefroggo32123
@Boggothefroggo32123 2 жыл бұрын
I get an error that says TypeError: Transaction is not a constructor how do I fix this?
@technologybanglavideo6696
@technologybanglavideo6696 5 жыл бұрын
Which IDE have you used for coding ?Please details
@kshitijvengurlekar1192
@kshitijvengurlekar1192 5 жыл бұрын
vscode
@technologybanglavideo6696
@technologybanglavideo6696 5 жыл бұрын
@@kshitijvengurlekar1192 if you create a video which is how to install.. Which IDE and basic running mechanism.. It will be very helpful...for windows operating system..
@kshitijvengurlekar1192
@kshitijvengurlekar1192 5 жыл бұрын
@@technologybanglavideo6696 1. I would highly recommend you to use Linux 2. There are already many videos about how to install VSCode on Windows/Linux.
@abigaildien3252
@abigaildien3252 5 жыл бұрын
I finally got the terminal working now my testing is way off....lol
@asmrtist9058
@asmrtist9058 4 жыл бұрын
9:39 "We want to verify that the hash of this block" - shouldn't it be "hash of this transaction"?
@SarthakGupta
@SarthakGupta 5 жыл бұрын
17:09 Balance: -10 Is Chain Valid: true Why???
@dillonstreator4159
@dillonstreator4159 4 жыл бұрын
I have this as well. It should be -10 because the 100 reward for mining is still in the pending transactions and will not be rewarded until the next block is successfully mined.
@victorgeorgiev4079
@victorgeorgiev4079 4 жыл бұрын
most likely you have an error with minePendingTransactions() and for the validation most likely you are not checking the correct lenght in isChainValid()
@incog4600
@incog4600 2 жыл бұрын
Hey when I check if the chain is valid normally it returns false. How can I fix this?
@aaryamangupta
@aaryamangupta 2 жыл бұрын
Yes
@sohaibsoussi9042
@sohaibsoussi9042 2 жыл бұрын
let block = new Block(Date.now(),this.pendingTransactions,this.getLatestBlock().hash)
@zephirusvideos
@zephirusvideos 3 жыл бұрын
Someone knows how can I implement the "signTransaction" method in java?
@whoamiwhoami1300
@whoamiwhoami1300 4 жыл бұрын
Min 4:42
@snaplu4683
@snaplu4683 4 жыл бұрын
forgot to add this.signature in Transaction class
@bibbidi_bobbidi_bacons
@bibbidi_bobbidi_bacons 11 ай бұрын
So the more pertinent danger at least with BTC are the thousands of “dormant” wallets which randomly become active when the price spikes …. lol you all know good damn well a rug pull is always ahead no matter what the asset is
@miQize
@miQize 3 жыл бұрын
If a null sender address is valid for a transaction, what stops users from just sending new transactions to themselves from a null address?
@fsra16
@fsra16 2 жыл бұрын
I have the same question
@ravard4336
@ravard4336 2 жыл бұрын
the solution could be to add a verification that allows ONLY-ONE transaction from a null address per block so the miner will take it for himself 🤔 (I don't know if it is implemented that way in real blockchains it's just an idea)
@ArnoneWilliam
@ArnoneWilliam 2 жыл бұрын
What if someone sends 1 coin to me, and i duplicate the message of that transaction? They have already signed that transaction, so i can steal all of their coins by duplicating that transaction over and over.
@ravard4336
@ravard4336 2 жыл бұрын
Like the balance of the sender some verifications seem to not be implemented to facilitate the understanding of the whole concept. a transaction is unique on the blockchain and it's defined by its hash, before adding a new transaction, miners have to go through the all ledger to ensure another transaction with the same hash does not already exist I presume
@florencebeukes287
@florencebeukes287 5 жыл бұрын
So “From wallet” can be anybody’s wallet?
@newsquest1169
@newsquest1169 5 жыл бұрын
You can build a blockchain on dpow block chain
@asmrtist9058
@asmrtist9058 4 жыл бұрын
16:42 How does the balance of 90 make sense? Doesn't the subsequent block have to be mined for the reward to be accounted for? At least that's how my blockchain works now and I have pretty much copied your code.
@brianjianzhao3238
@brianjianzhao3238 4 жыл бұрын
Hey, I am having the same issue here. I followed his implementation. Rewards transaction is not chained at the moment when it is created. It will only be push into the block and chained when next time the mining process completes. I think there is something wrong with here.
@pisanvs
@pisanvs 4 жыл бұрын
You can push the transaction to the pendingTransactions array before mining it.
@rockey9045
@rockey9045 2 жыл бұрын
Can anybody tell me where the source to this presentation are?
@elsilossos626
@elsilossos626 3 жыл бұрын
👏👏👏
@fungchan9216
@fungchan9216 2 жыл бұрын
It shows node:internal/modules/cjs/loader:936 throw err; ^ when I run in terminal, anyone know why?
@SirJul
@SirJul 2 жыл бұрын
Did you cd src?
@jessedampare1379
@jessedampare1379 3 жыл бұрын
I keep getting -10 when i run the code🤔
@algrinotop7340
@algrinotop7340 6 жыл бұрын
But how do we sign it on a website
@bspanda98
@bspanda98 6 жыл бұрын
Do you make a video how to fork neo.
@simplyexplained
@simplyexplained 6 жыл бұрын
Probably not
@bspanda98
@bspanda98 6 жыл бұрын
Simply Explained - Savjee why not it is legal and easy to held
@simplyexplained
@simplyexplained 6 жыл бұрын
I don't think people should randomly fork cryptocurrencies to start their own. There is a lot of knowledge needed to maintain your own cryptocurrency. I know it's legal, but I don't think a video would be a good idea.
@bspanda98
@bspanda98 6 жыл бұрын
but you need to make it one for knowledge purpose am I right
@cliffbartle3772
@cliffbartle3772 5 жыл бұрын
The same people that wrote these programs are the same or similar characters that wrote the MCAS program for the Boeing 737 Max, get my drift?? And the tax programs and all yje government programs, and we just swallow it.
@pisanvs
@pisanvs 4 жыл бұрын
And??
@lyferp
@lyferp 5 жыл бұрын
bro you made the same code in the start as in the 3 vid
@winniepooh2533
@winniepooh2533 2 жыл бұрын
@Simply Explained I created my own crypto from this video series, I did it for getting more into js, can I show and share it to my friends just to make them understand the working of crypto? I need your permission because I used your code to make my crypto, and I will offcourse give your channel a huge credit.
@primerib7377
@primerib7377 2 жыл бұрын
Does this really work?
@simplyexplained
@simplyexplained 2 жыл бұрын
It's a very basic implementation, but yes ;)
@TT-jq3kj
@TT-jq3kj 4 жыл бұрын
sir say ec is not const help me
@michaelthedriver242
@michaelthedriver242 4 жыл бұрын
Command Prompt: "cannot find module 'elliptic'.
@youssrakhattab5332
@youssrakhattab5332 4 жыл бұрын
me too, did you find any solution for that?????
@aofeizhang8735
@aofeizhang8735 2 жыл бұрын
Am I too stupid to understand this? Learned entry level java before...
@as269
@as269 2 жыл бұрын
still get balance is 0 ?!
@alendhassan6301
@alendhassan6301 6 жыл бұрын
amazing, but why you are ignoring (nonce)? in all your videos?
@simplyexplained
@simplyexplained 6 жыл бұрын
Nonce has been implemented in the first video.
@alendhassan6301
@alendhassan6301 6 жыл бұрын
@@simplyexplained actually in the second video you did by incrementing it in mining, thank you for that, but I mean, nonce is used so the other blocks in the chain can confirm the new mined block to be able to join them in the chain, right?, I don't see this part, hopefully you understand my saying ? thanks
@simplyexplained
@simplyexplained 6 жыл бұрын
Hmm I don't follow. Nonce is just used for mining and to calculate the hash of the block (AFAIK).
@mental_block
@mental_block 5 жыл бұрын
I had a doubt, if we can see public key of others, can we not create key object using ec.keyfrompublic and then extract the private key of that person?plz reply
@simplyexplained
@simplyexplained 5 жыл бұрын
No, the keyfrompublic method wont be able to extract the private key. It will just allow you to encrypt a message for the person who has the private key.
@mental_block
@mental_block 5 жыл бұрын
@@simplyexplained thanks for clearing my doubt
@florencebeukes287
@florencebeukes287 5 жыл бұрын
Can I run this code on BlockChain ?
Angular frontend - Blockchain in Javascript (part 5)
49:57
Simply Explained
Рет қаралды 91 М.
⚡️NEWS | RUBLE COLLAPSE | STRIKE ON CRIMEA | PUTIN IN KAZAKHSTAN
10:34
Ходорковский LIVE
Рет қаралды 189 М.
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 4,7 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 31 МЛН
This Game Is Wild...
00:19
MrBeast
Рет қаралды 186 МЛН
Building a Blockchain in Under 15 Minutes - Programmer explains
14:28
Mining rewards & transactions - Blockchain in Javascript (part 3)
12:11
Simply Explained
Рет қаралды 191 М.
But how does bitcoin actually work?
25:16
3Blue1Brown
Рет қаралды 16 МЛН
Blockchain 101 - A Visual Demo
17:50
Anders Brownworth
Рет қаралды 2,5 МЛН
Blockchain & Smart contracts: Digital Evolution Conference 2018
31:08
Simply Explained
Рет қаралды 75 М.
ASMR Programming - Weather App With Javascript - No Talking
20:30
AsmrProg
Рет қаралды 2,8 МЛН
Zero Knowledge Proof - ZKP
10:18
Simply Explained
Рет қаралды 189 М.
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33