alexbyk / dummycoin

DummyCoin is a simple blockchain client-server implementation written in TypeScript

Home Page:http://dummycoin.alexbyk.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About DummyCoin

DummyCoin is my test task for the job interview. I made some changes to the original task. Because cutting-edge technologies require cutting-edge technologies πŸ˜ƒ

πŸ‘Š Api is based on GRPC protocol. Because it's way better than json and written once is ready for any language.

😍 Typescript instead of Javascript. Because it’s superior.

πŸ‘Œ RxJS for simple and convenient state management and as a communication layer of abstraction between frontend and grpc api

πŸ’₯ Proof-of-work improved. User should calculate a nounce that will lead to hash containing 0 in the beginning (constant complexity for simplicity). This is a way better (also original task has an intenger overflow problem)

😎 Blockchain itself is implemented as a separate library

πŸ‘€ Blockhain can use any db/file/memory storage that satisfies IStore interface. Simple InMemory storage ships with this package

πŸ’ͺ This application also is a simple but awesome GRPC microframework. Writing new methods is a pleasure

πŸ˜€ The blockchain libdummy librarry does support consensus (pick the longest valid chain), but for demonstration purposes nodejs methods are missing

πŸ”₯ Awesome Angular 6 as a frontend framework and awesome micro as nodejs microframework

Demo

http://dummycoin.alexbyk.com

Running on the local machine

Install docker and docker-compose. Download docker-compose file and run it

wget -O docker-compose.yml https://raw.githubusercontent.com/alexbyk/dummycoin/master/docker-compose.yml
docker-compose down && docker-compose pull  && docker-compose up -d

See the content of the docker-compose.yml to find docker-hub images

Development

./run should be your first command after git clone

  • ./run - install node modules, build protos and run development servers on http://localhost:4200
  • ./run start - just run development servers
  • ./run test - test all
  • ./run --help - see other commands, (docker, docs generation...)

Structure

  • Each subproject contains Dockerfiles to build an image using ./run build-docker
  • Each subproject contains unit and functional tests. Run npm run test:watch for test-driven development

Nodejs

  • libdummy - blockchain reuseble library
  • micro - awesome grpc microframework + grpc tester, written for this app
  • _proto - autogenerated api files

Autogenerated NodeJs docs

Frontend (angular)

  • api-grpc - grpc based api client, written for this app, that translates grpc calls into RxJs.
  • state - easy ready/error/data states with RxJs.

Autogenerated Front docs

GRPC(Protobuf 3) api

We provide support for browsers using grpcwebproxy proxy server

Autogenerated API docs

Docker

By default, docker images use these ports

  • 9090 - angular frontend
  • 9091 - grpcwebproxy
  • 9092 - node grpc server
  • 9093 - documentation server

Author

https://alexbyk.com

About

DummyCoin is a simple blockchain client-server implementation written in TypeScript

http://dummycoin.alexbyk.com


Languages

Language:JavaScript 69.4%Language:TypeScript 23.5%Language:HTML 3.5%Language:CSS 1.8%Language:Shell 1.8%