-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
created BE and FE for bitcoin blockchain simulator. #13
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difficulty should not be fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to handle and verify signature while accepting TXNS
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