Skip to content

dadhichmohak/IITIBlock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪙IITIChain - My First Blockchain Project

Welcome to IITIChain, a simple blockchain implementation written in TypeScript/Node.js. This was my first blockchain project, built to understand the core concepts of decentralized ledgers, mining, transactions, and wallets.


🚀 Features

  • Simple blockchain structure with linked blocks
  • Basic Proof-of-Work (PoW) mining mechanism
  • Simulated wallets with RSA public/private keys
  • Secure transaction signing
  • Mining rewards for block creation
  • Chain validation to detect tampering

📂 Project Structure

IITIBlock/
├── node_modules/         # Installed dependencies
├── index.ts              # Main TypeScript source code
├── index.js              # Compiled JavaScript output
├── package.json          # Project metadata and dependencies
├── package-lock.json     # Exact dependency versions
├── tsconfig.json         # TypeScript configuration
└── .gitignore            # Files ignored by Git

🧠 How It Works (Simple Explanation)

  • Wallets: Everyone has a wallet with a public and private key.
  • Transactions: You send "money" by creating a transaction signed with your private key.
  • Transaction Pool: Transactions wait in a pool before being recorded.
  • Mining: A miner collects transactions and tries different numbers until they find a valid block hash (this is Proof-of-Work).
  • Blockchain: Blocks are added to a chain, secured by cryptographic hashes.

Getting Started

1. Clone the repo

git clone https://github.com/dadhichmohak/IITIBlock.git
cd IITIBlock

2. Install dependencies

npm install

3. Compile TypeScript

npx tsc

4. Run the project

node index.js

Example Usage

const wallet1 = new Wallet(); // user1
const wallet2 = new Wallet(); // user2
const wallet3 = new Wallet(); // user3

wallet1.sendMoney(50, wallet2.publicKey);
wallet2.sendMoney(23, wallet3.publicKey);
wallet3.sendMoney(5, wallet2.publicKey);

IITIChain.instance.mineTransactions(wallet1.publicKey);

Output: A new block is mined, rewards are distributed, and the blockchain is updated.

Workflow Blockchain Workflow

What I Learned

  • The structure and flow of blockchain networks
  • Public key cryptography for signing transactions
  • Proof-of-Work mining mechanics
  • Block validation and linking via hashes
  • How transactions are bundled into blocks

Future Improvements

  • Track wallet balances
  • Verify digital signatures before accepting transactions
  • Add a simple frontend to view the blockchain
  • Simulate peer-to-peer networks or nodes
  • Add transaction history lookup

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors