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:

Implementing Infinite Scroll In Next Js With Server Actions

Implementing infinite scroll in Next.js with Server Actions

Infinite scrolling in Next.js no longer requires external libraries — Server Actions let us fetch initial data directly on the server.

Rahul Chhodde
Apr 19, 2024 ⋅ 10 min read
Integrating Django Templates With React For Dynamic Webpages

Integrating Django templates with React for dynamic webpages

Create a dynamic demo blog site using Django and React to demonstrate Django’s server-side functionalities and React’s interactive UI.

Kayode Adeniyi
Apr 18, 2024 ⋅ 7 min read
Using Aoi Js To Build A Bot For Discord

Using aoi.js to build a bot on Discord

Explore how the aoi.js library makes it easy to create Discord bots with useful functionalities for frontend applications.

Rahul Padalkar
Apr 17, 2024 ⋅ 9 min read
Web Components Adoption Guide: Overview, Examples, And Alternatives

Web Components adoption guide: Overview, examples, and alternatives

Evaluate Web Components, a set of standards that allow you to create custom HTML tags for more reusable, manageable code.

Elijah Asaolu
Apr 16, 2024 ⋅ 11 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