Skip to content

Latest commit

 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

abitCoin — Blockchain-Based Secure Transaction System

CI Release

abitCoin is a full-stack blockchain simulation for learning how secure digital transactions work. It combines a Node.js and Express API with an Angular dashboard to demonstrate wallet creation, encrypted and digitally signed transactions, proof-of-work mining, blockchain validation, tamper detection, block restoration, and simulated peer synchronization.

Educational use only: abitCoin is a learning project, not a production cryptocurrency or a system for protecting real funds and sensitive data.

Highlights

  • Digital wallets — generates secp256k1 public and private key pairs.
  • Secure transaction demonstrations — encrypts transaction payloads with AES and authenticates transfers with ECDSA signatures.
  • Proof-of-work blockchain — mines pending transactions into linked blocks and issues configurable mining rewards.
  • Ledger validation — checks transaction signatures, encrypted payloads, block hashes, previous-hash links, and timestamps.
  • Security evaluation — demonstrates transaction, signature, previous-hash, and timestamp tampering, then restores the original block.
  • Wallet explorer — calculates balances and displays confirmed transaction history for an address.
  • Network simulation — shows one miner and two full nodes synchronizing their in-memory ledgers.
  • Full-stack dashboard — provides pages for blocks, transactions, wallets, mining settings, security evaluation, and network status.
  • Automated verification — runs backend tests and builds the Angular application in GitHub Actions.

Architecture

Angular dashboard (localhost:4200)
              │
              │ /api through the development proxy
              ▼
Node.js and Express API (localhost:3000)
              │
              ▼
Blockchain core ──► Miner node ──► Two simulated full nodes

The Angular development server removes the /api prefix before forwarding requests to the Express API. The backend owns the main ledger and simulates delayed synchronization to the two follower nodes.

Repository layout

abitcoin/                   Node.js API and blockchain implementation
├── blockchain.js           Transactions, blocks, mining, validation, and tampering
├── network.js              Three-node network and synchronization simulation
├── server.js               Express API routes
├── keygenerator.js         Standalone wallet key-pair generator
├── test/                   Backend automated tests
└── .env.example            Safe local configuration template

abitcoinui/                 Angular browser application
├── src/app/pages/          Dashboard feature pages
├── src/app/components/     Reusable block and transaction views
├── src/app/services/       API and local blockchain services
├── src/app/config/         Browser demo cryptography configuration
└── proxy.conf.json         Local `/api` proxy configuration

.github/workflows/ci.yml    GitHub Actions verification workflow
package.json                Repository-level setup, run, and check commands

Requirements

  • Node.js 20.19+, 22.12+, or 24.x (recommended)
  • npm 10 or newer

Installation

Clone the repository and enter its directory:

git clone https://github.com/Lokezy/ABITCOIN.git
cd ABITCOIN

On macOS or Linux, create the local environment file and install both applications:

cp abitcoin/.env.example abitcoin/.env
npm run setup

On Windows PowerShell:

Copy-Item abitcoin/.env.example abitcoin/.env
npm run setup

npm run setup installs the locked backend and frontend dependencies with npm ci.

Configuration

The backend reads these values from abitcoin/.env:

Variable Default Purpose
AES_SECRET_KEY Public development key Encrypts and decrypts transaction payloads in the demonstration
PORT 3000 Express API port
CORS_ORIGIN http://localhost:4200 Comma-separated browser origins allowed to call the API

The local demo key must match DEMO_AES_KEY in abitcoinui/src/app/config/crypto.config.ts. The included value is intentionally public so a fresh clone works locally. Any key delivered in browser code can be inspected by users and must not be treated as confidential.

Running the system

Open two terminals in the repository root.

Terminal 1 — start the backend:

npm run start:backend

Terminal 2 — start the frontend:

npm run start:frontend

Open http://localhost:4200. The API is available directly at http://localhost:3000.

Demonstration workflow

  1. Open Create transaction. The browser creates a temporary wallet key pair when the application starts.
  2. Copy the public wallet address and create a signed transfer to another public address.
  3. Open Pending transactions and mine the transfer. The mining reward is sent to the selected reward address.
  4. Inspect the new block, its transactions, hashes, validation results, and wallet balances.
  5. Open the block's Security evaluation page and run a tampering scenario.
  6. Observe the failed security checks, then restore the block from its demonstration backup.
  7. Open Network to watch the miner and two full nodes synchronize.
  8. Use Settings to adjust mining difficulty and set a positive mining reward.

Refreshing the browser creates a new temporary UI wallet. To generate a standalone wallet key pair from the command line, run:

npm run keygen --prefix abitcoin

Keep every generated private key secret. Only the public key should be shared as a wallet address.

API overview

The Angular application calls these routes through /api. When calling the backend directly, omit that prefix.

Method Route Purpose
GET /blocks Return all confirmed blocks
GET /pendingTransactions Return transactions waiting to be mined
POST /transactions Validate and add a signed transaction
POST /mine Mine pending user transactions and start node synchronization
GET /wallet/:address Return an address balance and transaction history
GET, POST /settings Read or update mining difficulty and reward
GET /security-status/:index Return validation results for a block
POST /tamper/.../:index Run a transaction, signature, hash, or timestamp tampering scenario
POST /restore/block/:index Restore a modified block from its in-memory backup
GET /network Return the simulated nodes and synchronization state

Verification

From the repository root, run:

npm run check

This command runs the Node.js backend test suite and creates a production build of the Angular application. The same checks run automatically for pushes and pull requests through GitHub Actions.

Data persistence

Blockchain, pending transaction, wallet, backup, and simulated network data are stored in memory. Restarting the backend resets the ledger and all network state. Refreshing the frontend replaces its temporary browser wallet.

Security model and limitations

  • Transaction authenticity is demonstrated with ECDSA signatures on the secp256k1 curve.
  • AES payload encryption uses one shared demo key in both the API and browser application. Because browser-delivered keys are visible to users, this design does not provide real end-to-end confidentiality.
  • The peer network is simulated inside one Node.js process; it is not a decentralized peer-to-peer network.
  • The ledger has no database, durable wallet storage, distributed consensus, authentication, rate limiting, or production key management.
  • Tampering and restoration routes are intentionally exposed for classroom security demonstrations.
  • Do not use this project for real cryptocurrency, real funds, personal information, or other sensitive data.

Production notes

If adapting the project for a private deployment:

  • Forward /api/* from the web server to the Node API and remove the /api prefix.
  • Set AES_SECRET_KEY, PORT, and CORS_ORIGIN through the hosting environment.
  • Store backend secrets in the hosting provider's secret manager and never commit .env.
  • Replace the browser-visible shared-key design before handling confidential information.
  • Add persistent storage, authentication, authorization, request limits, monitoring, and an appropriate consensus model.

Release

The first public project snapshot is available as abitCoin v1.0.0. Release assets such as screenshots or a demonstration video are optional and can be added later.

About

A full-stack Blockchain-Based Secure Transaction System featuring AES-256 encryption, ECDSA signatures, SHA-256 hashing, Proof-of-Work mining, tamper detection, Angular dashboard and Node.js/Express API.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages