https://github.com/aggstam/javablockchainparallel
Console application simulating a Product Database using BlockChain and parallelism for actions execution.
https://github.com/aggstam/javablockchainparallel
blockchain java parallel
Last synced: 7 months ago
JSON representation
Console application simulating a Product Database using BlockChain and parallelism for actions execution.
- Host: GitHub
- URL: https://github.com/aggstam/javablockchainparallel
- Owner: aggstam
- License: apache-2.0
- Created: 2021-11-03T18:18:27.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T17:06:41.000Z (over 2 years ago)
- Last Synced: 2025-01-12T20:33:33.573Z (9 months ago)
- Topics: blockchain, java, parallel
- Language: Java
- Homepage:
- Size: 225 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
```