created BE and FE for bitcoin blockchain simulator. #13
Open
abhijitsahoo99 wants to merge 1 commit intocode100x:mainfrom
Open
created BE and FE for bitcoin blockchain simulator. #13abhijitsahoo99 wants to merge 1 commit intocode100x:mainfrom
abhijitsahoo99 wants to merge 1 commit intocode100x:mainfrom
Conversation
axatbhardwaj
suggested changes
Aug 18, 2024
axatbhardwaj
left a comment
There was a problem hiding this comment.
- Difficulty related issue
- make sure blockchain runs even if no txns are there
- no signature verification for txns
|
|
||
| mineBlock() { | ||
| if (this.pendingTransactions.length === 0) { | ||
| console.log('[MINER] No pending transactions to mine'); |
There was a problem hiding this comment.
A blockchain always , mines a block even if there are no txns to mine
| constructor() { | ||
| this.blockchain = []; | ||
| this.pendingTransactions = []; | ||
| this.difficulty = 4; |
There was a problem hiding this comment.
keeping a fixed difficulty number will make managing average block-times impossible
| constructor() { | ||
| this.blockchain = []; | ||
| this.pendingTransactions = []; | ||
| this.difficulty = 4; |
There was a problem hiding this comment.
The difficulty should not be fixed
There was a problem hiding this comment.
Make sure to handle and verify signature while accepting TXNS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Created a simple Bitcoin simulator.
Central server:
✅ A central WebSocket server that all miners connect to exchange messages
Miner server:
✅ Code that miners can run to create blocks, do proof of work, and broadcast the block via the central server
✅ Code that verifies the signature, balances, and creates/adds a block
✅ Code should reject smaller blockchains/erroneous blocks
✅ Should be able to catch up to the blockchain when the server starts
Frontend:
✅ Lets the user create a BTC wallet
✅ Lets the user sign a transaction, send it over to one of the miner servers
Tech stack:
✅ Node.js for the servers
✅ React for the frontend
Demo -
https://drive.google.com/file/d/1LkFfTxJB8vStZzXOCRMhFJYoqmJqTfxp/view?usp=sharing
Project Setup