This project is a simple implementation of a blockchain with basic wallet functionality. The blockchain contains blocks, where each block contains multiple transactions. Wallets can perform transactions, sending and receiving funds, which are then added to the blockchain.
-
Basic Blockchain: Create a blockchain and add blocks to it. Each block has a hash, a timestamp, and a list of transactions.
-
Mining: Blocks have a
mineBlock()
function that solves a proof-of-work problem. -
Wallets: Wallets with unique IDs can send and receive funds.
-
Transaction Validation: Transactions are only valid if the wallet has sufficient balance.
-
Blockchain Integrity Check: Check if the blockchain is valid based on previous and current block hashes.
-
Wallet Balance Notification: After mining a block, wallet balances can be updated based on the transactions in the blockchain.
This project uses a Makefile to automate the build process. Follow these steps to build and run the project:
- Make sure you have
g++
andmake
installed on your system. - OpenSSL library is required for cryptographic functions. Install it if you haven't done so already:
- Ubuntu/Debian:
sudo apt-get install libssl-dev
- macOS with Homebrew:
brew install openssl
- Windows: You may need to download and install it manually from OpenSSL's website.
- Ubuntu/Debian:
-
Clone the repository to your local machine:
git clone https://github.com/BlockchainProphet/SimpleBlockchainImplementation.git
-
Navigate to the project directory:
cd SimpleBlockchainImplementation
-
Run the Makefile:
make
This will compile all the necessary files and create an executable named
blockchain_app
.
After successful build, you can run the project by executing:
./blockchain_app
If you want to remove all the compiled files and the generated executable, run:
make clean
main.cpp
: The driver program that demonstrates blockchain and wallet functionalities.Blockchain.cpp
andBlockchain.h
: Contains theBlockchain
class that manages blocks and transactions.Block.cpp
andBlock.h
: Defines theBlock
class for individual blocks in the blockchain.Transaction.cpp
andTransaction.h
: Contains theTransaction
class that represents transactions between wallets.Wallet.cpp
andWallet.h
: Contains theWallet
class that can send funds and update balances.
- Added wallet functionality for sending and receiving funds.
- Wallets are notified and updated after each block is mined.
- Improved the integrity check for the blockchain.
- C++ Standard Library
- OpenSSL for SHA-256 Hashing