2022-05-12
1648
#node#web3
Frank Joseph
107833
May 12, 2022 ⋅ 5 min read

Build a cryptocurrency with Node.js

Frank Joseph I'm an innovative software engineer and technical writer passionate about the developer community. I'm interested in building applications that run on the internet.

Recent posts:

Rxjs Adoption Guide: Overview, Examples, And Alternatives

RxJS adoption guide: Overview, examples, and alternatives

Get to know RxJS features, benefits, and more to help you understand what it is, how it works, and why you should use it.

Emmanuel Odioko
Jul 26, 2024 ⋅ 13 min read
Decoupling Monoliths Into Microservices With Feature Flags

Decoupling monoliths into microservices with feature flags

Explore how to effectively break down a monolithic application into microservices using feature flags and Flagsmith.

Kayode Adeniyi
Jul 25, 2024 ⋅ 10 min read
Lots of multi-colored blue and purplish rectangles.

Animating dialog and popover elements with CSS @starting-style

Native dialog and popover elements have their own well-defined roles in modern-day frontend web development. Dialog elements are known to […]

Rahul Chhodde
Jul 24, 2024 ⋅ 10 min read
Using Llama Index To Add Personal Data To Large Language Models

Using LlamaIndex to add personal data to LLMs

LlamaIndex provides tools for ingesting, processing, and implementing complex query workflows that combine data access with LLM prompting.

Ukeje Goodness
Jul 23, 2024 ⋅ 5 min read
View all posts

7 Replies to "Build a cryptocurrency with Node.js"

  1. Where is computeHash() that is used in addNewBlock method, coming from? It wasn’t a method of Block class!

    1. All instances of computeHash() have been replaced with generateHash(). Thanks for pointing out the typo!

  2. Thank you Joey for pointing this out. This skipped me. It is supposed to be generateHash() as found in the Block class. I was trying to get the best method name.

  3. There’s an error in the validity check. It will always only check the first two blocks of the chain. Move “return true” statement outside the for loop to fix it.

  4. Thank you Ahlstrand for your observation. I think everything is fine as it is. Try to add more blocks and confirm that the code still works fine with the ‘return true statement’ in the for loop.

  5. It is worth mentioning that the Blockchain class method `getTheLatestBlock` gets called in the `addNewBlock` method with the wrong name `getLatestBlock` so it won’t work.

Leave a Reply