Git Product home page Git Product logo

dumbcoin's Introduction

DumbCoin

npm snyk

DumbCoin

What is DumbCoin

It's a simple package that you can use to create your primitive blockchain or anything based on peer-to-peer connection and gossip protocol for data exchange. What's more, you can use the modules separately, or create your own Blockchain using them.

Features

  • Peer to peer comunication using own implementation of gossip protocol
  • Signaling server
  • Rewards by mining blocks (Proof of concept algorithm)
  • Secure transactions signed by crypto keys
  • Wallets
  • API for Blockchain

How to start

Instalation

  1. Install DumbCoin via packet manager npm/yarn
npm i dumbcoin
  1. Copy .env.example .env and complete it according to your needs
    Windows: copy .env.example .env
    Linux: cp .env.example .env

Usage

You can import modules from DumbCoin package as shown below:

const { Blockchain, Networker, Signal } = require('dumbcoin');
const signal = Signal().start(); // Start signaling server
const blockchain = Blockchain(); // Create Blockchain
const networker = Networker(
   blockchain, // Networker requires Blockchain instance, see documentation for more info
   //other params
);

//have fun with modules

If you want ready to use blockchain just import Cluster

const { Cluster } = require('dumbcoin');
const cluster = Cluster(); // now blockchain is ready to use

P2P and Data Exchange

How it works

Dumbcoin is built in peer-to-peer topology and data exchange/synchronization is handled by gossip protocol. Each peer is both a client and a server at the same time. The information about active nodes are transmited via Signaling server, that way all users have current list and can gossip with random Peer to keep blockchain well synchronized

Whole process can be ilustrated as following: Imgur

  1. Synchronize (SYN) packet - Peer A sends his current data to peer B.
  2. Acknowledge (ACK) packet - Peer B compares the received data's timestamps with it's own. For each documents, if it's timestamp is older, just place it in the ACK payload, if it's newer place it along with it's data. And if timestamps are the same, do nothing.
  3. Acknowledge 2 (ACK2) packet - Peer A updates it's document if ACK data is provided, then sends back the latest data to Peer B for those where no ACK data was provided.

More info

For more information how this works check Cassandra training video or Scylla explanation

Documentation

https://hubertlipinski.github.io/DumbCoin/

API

DubmbCoin provides an API for blockchain if you want to use it. You can download Postman collection here

Variables

{{address}} - Your address on which API server is running i.e localhost
{{port}} - Port on which API server is running i.e 6010

dumbcoin's People

Contributors

dependabot[bot] avatar hubertlipinski avatar

Stargazers

 avatar  avatar  avatar  avatar

Forkers

tyler151025

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.