Securing the future, one block at a time.
Table of Contents
The BlockchainX project implements a decentralized blockchain network with core functionalities encompassing secure transaction handling, mining operations, and blockchain integrity maintenance. Transaction classes ensure data integrity using hashing and signatures, while UTXO ledger management ensures accurate balance updates. Nodes manage peer connections, mempool transactions, and blockchain synchronization, enhancing network efficiency. Wallet generation and mining processes further strengthen blockchain security. This project's value lies in its robust architecture that facilitates secure, efficient, and decentralized transactions within a trustless network.
└── blockchain/
├── Blockchain
│ ├── Blockchain.py
│ ├── __pycache__
│ └── utxo_utils.py
├── Node
│ ├── BlockchainNode.py
│ ├── __init__.py
│ ├── __pycache__
│ ├── dataManager
│ └── utils.py
├── README.md
├── __pycache__
│ └── blockchain.cpython-311.pyc
├── block
│ ├── Block.py
│ └── __pycache__
├── mining
│ ├── __init__.py
│ ├── __pycache__
│ ├── mining.py
│ └── mining_test
├── tests
│ ├── __init__.py
│ ├── __pycache__
│ ├── integration
│ └── unit
├── transaction
│ ├── CoinbaseTransaction.py
│ ├── Transaction.py
│ ├── TransactionData.py
│ └── __pycache__
└── user
├── Wallet.py
└── __pycache__
transaction
File | Summary |
---|---|
Transaction.py | Implements transaction classes ensuring secure data transfer with hashes and signatures. Validates transaction integrity based on size, key matches, and signature verification. Maintains transaction timestamp and ID. |
CoinbaseTransaction.py | Defines and validates a coinbase transactions output, ensuring transaction integrity within the blockchain network by serializing and checking transaction validity against predefined rules and size limits. |
TransactionData.py | Defines and serializes transaction data including sender and receiver public keys, amount, timestamp, and a unique identifier. An essential component within the blockchain architecture for handling transaction information efficiently. |
user
File | Summary |
---|---|
Wallet.py | Generates wallet address through ECC-Signs transaction data with private key-Handles key pair generation-Essential for secure transaction signing in the blockchain architecture. |
mining
File | Summary |
---|---|
mining.py | Initiate blockchain server, connect to gateway node, prompt for miners public key generation or input, then commence mining process with validated blocks sent to all network nodes before stopping server. |
mining.mining_test
File | Summary |
---|---|
test_connection_network.py | Simulates network connections and interactions between blockchain nodes. Establishes communication with a gateway node, shares blocks, and prints chain details. Emulates start and stop operations to test network functionality. |
Blockchain
File | Summary |
---|---|
utxo_utils.py | Handles ledger management by updating receiver and sender balances based on transactions in a blockchain system. Ensures transaction validity before ledger updates. |
Blockchain.py | Manages blockchain integrity through mining, validation, and UTXO set construction. Verifies blocks, transactions, tree consistency, and inclusion, upholding blockchain integrity and security. Key methods include mining, validation checks, and UTXO set creation. |
Node
File | Summary |
---|---|
BlockchainNode.py | Defines a BlockchainNode in the network, managing peers, mempool, and blockchain. It handles node connections, messages, transactions, and data exchanges. Incorporates key functionalities like connecting to nodes, adding transactions to mempool, and managing node disconnections. |
utils.py | Implements peer removal logic for the Node component, enabling the removal of a specific peer from the list by matching its address and port. |
Node.dataManager
File | Summary |
---|---|
manageMempool.py | Manages mempool transactions for validation and storage, enhancing node functionality within the blockchain architecture. |
manageNewBlock.py | Manages addition of new blocks to the blockchain chain, ensuring integrity and syncing with peers. Automatically adds valid blocks from peers and updates the local blockchain. |
managePeers.py | Manages peer connections by connecting and adding new peers to the network. |
manageBlockchain.py | Manages blockchain synchronization by updating with a valid chain, removing confirmed transactions from the mempool. |
block
File | Summary |
---|---|
Block.py | Defines and manages the properties and methods of a blockchain block, facilitating hashing, mining, and verification. Required for the blockchains integrity and security. |
System Requirements:
- Python:
version x.y.z
- Clone the blockchain repository:
$ git clone https://github.com/neoff69/blockchain
- Change to the project directory:
$ cd blockchain
- Use the virtual environment:
$ source venv/bin/activate
- Start mining::
$ python -m mining.mining
Run the test suite using the command below:
$ python -m unittest discover -s tests -p 'test_*.py'
-
► Add multi threading for new block detection
-
► Fix the merkle tree for verification
-
► Add a graphic interface
Contributions are welcome! Here are several ways you can contribute:
- Report Issues: Submit bugs found or log feature requests for the
blockchain
project. - Submit Pull Requests: Review open PRs, and submit your own PRs.
- Join the Discussions: Share your insights, provide feedback, or ask questions.
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your github account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/neoff69/blockchain
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to github: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!