Chapter 10. Client-server communications using Node.js, TypeScript, and WebSockets

This chapter covers

  • Why a blockchain may need a server
  • The longest chain rule
  • How to create a Node.js WebSocket server in TypeScript
  • Practical use of TypeScript interfaces, abstract classes, access qualifiers, enums, and generics

In the previous chapter, you learned that each block miner can take a number of pending transactions, create a valid block that includes the proof of work, and add the new block to the blockchain. This workflow is easy to follow when there is only one miner creating the proof of work. Realistically, there could be thousands of miners around the world trying to find the valid hash for a block with the same transactions, which may cause ...

Get TypeScript Quickly now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.