Git Product home page Git Product logo

javablockchainparallel's Introduction

JavaBlockChainParallel

This console application simulates a Product Database using Block Chain.
Users can interact by selecting an action with their input.
Each action is performed using parallelism.
Note: project requires java to be installed.
External jar gson-2.8.2 is provided

Usage

First we compile the project:

% javac -cp libs/gson-2.8.2.jar src/**/*.java -d bin

Then we can execute:

% java -cp libs/gson-2.8.2.jar:.:bin com.blockchain.Main

Execution example

❯ java -cp libs/gson-2.8.2.jar:.:bin com.blockchain.Main
Jan 22, 2023 4:43:34 PM com.blockchain.Main main
INFO: Product Block Chain application started.
Jan 22, 2023 4:43:34 PM com.blockchain.Main retrieveInputAction
INFO: Enter action:
statistics
Jan 22, 2023 4:43:43 PM com.blockchain.Main retrieveInputAction
INFO: User input: statistics
Jan 22, 2023 4:43:43 PM com.blockchain.Main retrieveProductBlockStatistics
INFO: Search for a Product Block to retrieve its Statistics.
Jan 22, 2023 4:43:43 PM com.blockchain.Main retrieveProductBlockStatistics
INFO: Provide Product Code to search:
001
Jan 22, 2023 4:44:00 PM com.blockchain.StopWatch start
INFO: Process displayProductStatistics started.
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: Product found:
{
  "hash": "00000022a1fdf528b5571951e846f64abd31cb02e91dab82db1cbccb56e40d00",
  "previousHash": "00000096714c61b4057b79eda9df5aa0bf1db428daadaf9fdd8aa59f166073ed",
  "blockId": 157,
  "productCode": "001",
  "productTitle": "First Product",
  "productPrice": 10.5,
  "productCategory": "001",
  "productDescription": "Testing Blockchain actions",
  "productPreviousRecordId": 154,
  "timestamp": 1575843735065,
  "nonce": 42181197
}
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: - Price changes:
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: 	2019/12/09 00:22:15 -> 10.5
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: 	2019/12/09 00:21:54 -> 10.5
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: 	2019/12/09 00:20:09 -> 10.5
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: 	2019/12/09 00:18:46 -> 10.5
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: Statistics:
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: - Price median: 10.5
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: - Max price: 10.5
Jan 22, 2023 4:44:00 PM com.blockchain.ProductBlockChain displayProductStatistics
INFO: - Min price: 10.5
Jan 22, 2023 4:44:00 PM com.blockchain.StopWatch stop
INFO: Process displayProductStatistics finished. Total time elapsed: 0.06678487 seconds
Jan 22, 2023 4:44:00 PM com.blockchain.Main retrieveInputAction
INFO: Enter action:
quit
Jan 22, 2023 4:44:04 PM com.blockchain.Main retrieveInputAction
INFO: User input: quit
Jan 22, 2023 4:44:04 PM com.blockchain.Main main
INFO: Product Block Chain application terminated.

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.