Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prakhar301101/mychain
Blockchain made in Java
https://github.com/prakhar301101/mychain
Last synced: about 5 hours ago
JSON representation
Blockchain made in Java
- Host: GitHub
- URL: https://github.com/prakhar301101/mychain
- Owner: Prakhar301101
- Created: 2024-07-05T10:46:02.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-11T15:54:33.000Z (4 months ago)
- Last Synced: 2024-07-11T18:19:24.503Z (4 months ago)
- Language: Java
- Size: 6.96 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
MyChain is a blockchain made with JAVA.
A blockchain is a chain/list of blocks.Each block in the blockchain will contain data, its own digital fingerprint, also the fingerprint of previous block so as to maintain integrity.The fingerprint is also known as the Hash Value.
A block contains 2 Hash values its own and the previous block's, the hash value is calculated with the data and cryptographic algorithms like SHA256, so any change in the value will lead to inconsistency in the hash values leading to the blockchain being invalid.How to create Blocks on MyChain
Just use the createBlock function, send your string data as parameter and call the createBlock function.
The createBlock function creates a Block object by using the data, the previous block's hash and the calculated hash value of the current block.To view the Blockchain
Use the view_Chain function to get the information of the blockchain in JSON format.
A library called gson is used to convert the output string into JSON data.To check integrity of the Blockchain
Use the isValid function.
It works by comparing the hash values between the current and previous blocks
All about blockchain mining!
Mining the blockchain refers to the process of validating and adding new transactions to the blockchain.
Here’s a simplified explanation of what it involves:
-
Collecting Transactions: Miners collect a group of pending transactions from the network into a block. -
Solving a Puzzle: Miners compete to solve a complex mathematical puzzle that is part of the Proof of Work (PoW) system. This puzzle involves finding a specific number (nonce) that, when combined with the block data and passed through a cryptographic hash function, produces a hash that meets certain criteria (usually starts with a specific number of zeros). -
Finding the Solution: The first miner to solve the puzzle finds the correct nonce and thus creates a valid block. -
Broadcasting the Block: The miner broadcasts the new block to the entire network. -
Verification: Other nodes in the network quickly verify the solution to ensure it is correct and that the block follows all the network rules. -
Adding the Block: Once verified, the block is added to the blockchain, making the transactions in that block permanent and secure. -
Reward: The successful miner is rewarded with newly created cryptocurrency (block reward) and any transaction fees included in the transactions within the block.
For mining Mychain, adjust the difficulty according to your pc's computational power.
Wallets, Transactions & Cryptocurrencies
In Progress!!!!!