Skip to content

Predjo/blockchain-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This repository implements simple blockchain using TypeScript. It is a rewrite of the original one created in Python from this article.

Usage

Run npm start -- -port <port-number> to start the blockchain node.

Develop

Run npm run tsc:watch to start TypeScript compiler and run npm run watch to start node in watch mode.

Proof of Work algorithm

Blockchain implements basic Proof of Work algorithm. Miners need to find a number that, when hashed with the previous block’s solution (proof), creates a hash with 4 leading 0s ('0000').
Blockchain class methods proofOfWork and validProof implements Proof of Work algorithm.

Consensus algorithm

Consensus algorithm ensures that all nodes in decentralized network reflect the same blockchain. Rule of Consensus algorithm is that the longest valid chain is authoritative. It is achieved by sending the whole chain to each of the nodes.

About

Simple blockchain made with TypeScript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published