Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abhijitsahoo99
Copy link

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

  • npm install
  • npm run dev

Copy link

@axatbhardwaj axatbhardwaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Difficulty related issue
  2. make sure blockchain runs even if no txns are there
  3. no signature verification for txns


mineBlock() {
if (this.pendingTransactions.length === 0) {
console.log('[MINER] No pending transactions to mine');

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;

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;

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants