NLKNguyen / simple-blockchain

Simple Private Blockchain | Project @ Udacity's Blockchain Developer Nanodegree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Blockchain

A simple private Blockchain implemented using Node.js -- project @ Udacity's Blockchain Developer Nanodegree

Blockchain has the potential to change the way that the world approaches data. Develop Blockchain skills by understanding the data model behind Blockchain by developing your own simplified private blockchain.

getty_847491206_20001000200092802_361305

                                                                                        (Getty Images)

Project Structure

  • simpleChain.js contains Simple Blockchain definition and persistent database connection. This must be loaded before any Blockchain activity. All functionalities are implemented using Promises in native Node.js (v7.5.0)

Due to the suggested development workflow in Node.js REPL (by the instructor), the following scripts are created for convenience in testing.

  • test_simpleChain.js simply provides blockchain context via blockchain variable.

  • repl_simpleChain.sh (UNIX shell) opens Node.js REPL and runs simpleChain.js then test_simpleChain.js.

  • test_populateChain.js populates sample data for the blockchain. simpleChain.js must be loaded first.

  • repl_populateChain.sh (UNIX shell) opens Node.js REPL and runs simpleChain.js then test_populateChain.js. Previous persistent chain data will be deleted.

screen shot 2018-09-29 at 4 58 31 pm

  • test_printChain.js print all blocks in the blockchain. simpleChain.js must be loaded first.
  • repl_printChain.sh (UNIX shell) opens Node.js REPL and runs simpleChain.js then test_printChain.js.

screen shot 2018-09-29 at 5 00 08 pm

  • test_validateChain.js checks which blocks are tampered. simpleChain.js must be loaded first.
  • repl_validateChain.sh (UNIX shell) opens Node.js REPL and runs simpleChain.js then test_validateChain.js.

screen shot 2018-09-29 at 5 00 47 pm

  • test_tamperChain.js tampers some blocks in the blockchain. simpleChain.js must be loaded first.
  • repl_tamperChain.sh (UNIX shell) opens Node.js REPL and runs simpleChain.js then test_tamperChain.js.

screen shot 2018-09-29 at 5 14 21 pm

screen shot 2018-09-29 at 5 14 58 pm

Setup

$ npm install

Sample Usage

$ ./repl_populateChain.sh

$ ./repl_printChain.sh

$ ./repl_validateChain.sh

$ ./repl_tamperChain.sh

$ ./repl_validateChain.sh

License MIT

Copyright © Nikyle Nguyen

About

Simple Private Blockchain | Project @ Udacity's Blockchain Developer Nanodegree

License:MIT License


Languages

Language:JavaScript 91.0%Language:Shell 9.0%