A simple blockchain implementation built with Python and Flask. Kert-One aims to provide a fundamental understanding of blockchain concepts, including mining, transactions, and node communication, through a straightforward and accessible interface.
- Decentralized Ledger: A secure and immutable chain of blocks.
- Proof-of-Work: Implements a basic Proof-of-Work algorithm for mining new blocks.
- Transactions: Supports basic currency transfers between wallets.
- Wallet Generation: Easily create new cryptographic key pairs for managing funds.
- RESTful API: A Flask-based API for interacting with the blockchain.
- Network Discovery (Optional): Basic mechanisms for nodes to discover each other.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Before you begin, ensure you have the following installed:
- Python 3.x: (e.g., Python 3.8 or higher recommended)
- You can download it from python.org.
- pip: Python's package installer (usually comes with Python).
-
Clone the repository:
git clone [https://github.com/KertCoin/kert-one.git](https://github.com/KertCoin/kert-one.git) cd kert-one(Remember to replace
https://github.com/KertCoin/kert-onewith your actual repository URL!) -
Create a virtual environment (recommended):
python -m venv venv
-
Activate the virtual environment:
- Windows:
.\venv\Scripts\activate
- macOS/Linux:
source venv/bin/activate
- Windows:
-
Install the required dependencies:
pip install -r requirements.txt
(Important: Make sure you have a
requirements.txtfile in your project's root directory containingFlask,requests, etc. If not, runpip freeze > requirements.txtafter installing them manually.)
Open your terminal or command prompt and navigate to the kert-one project directory.
python Linux.server.Kert-One.py
(Adjust app.py if your main Flask application file has a different name, e.g., Linux.server.Kert-One.py.)
You should see output similar to:
[timestamp] Servidor Flask pronto em: [http://127.0.0.1:5000](http://127.0.0.1:5000)
This indicates your blockchain node is running on http://127.0.0.1:5000.
2. (Optional) Run the Client/Interface
If you have a separate client or graphical interface, open a new terminal window and navigate to the kert-one project directory.
Bash
python Linux-cliente.py
(Replace client.py with the actual name of your client script.)
π‘ Usage Examples
Once your node is running, you can interact with it via its API. Here are some common endpoints you can use with tools like curl or a web browser:
Get the full blockchain:
GET [http://127.0.0.1:5000/chain](http://127.0.0.1:5000/chain)
Mine a new block:
GET [http://127.0.0.1:5000/mine](http://127.0.0.1:5000/mine)
Add a new transaction:
POST [http://127.0.0.1:5000/transactions/new](http://127.0.0.1:5000/transactions/new)
Content-Type: application/json
{
"sender": "your_wallet_address",
"recipient": "another_wallet_address",
"amount": 10
}
Get a wallet balance:
GET [http://127.0.0.1:5000/balance/](http://127.0.0.1:5000/balance/)<your_wallet_address>
(Replace <your_wallet_address> with an actual wallet ID from your client_wallet.json or logs, e.g., 9fdd8fd19144e68a8e8afb25979b50108e8099e0.)
π οΈ Development
Project Structure
A brief overview of key files and directories:
kert-one/
βββ app.py # Main Flask application / Blockchain node
βββ blockchain.py # Core blockchain logic (blocks, hashing, validation)
βββ wallet.py # Wallet generation and transaction signing
βββ client.py # (Optional) Example client or interface
βββ requirements.txt# Python dependencies
βββ README.md # This file
(Adjust this based on your actual project file structure.)
π€ Contributing
Contributions are welcome! If you have suggestions or want to improve Kert-One, please:
Fork the repository.
Create a new branch (git checkout -b feature/AmazingFeature).
Commit your changes (git commit -m 'Add some AmazingFeature').
Push to the branch (git push origin feature/AmazingFeature).
Open a Pull Request.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Contact
Your Name/Nickname - https://kert-one.com/ (Optional)]
Project Link: https://github.com/KertCoin/kert-one
(Replace with your actual GitHub repository link)
π Acknowledgments
Inspiration from various blockchain tutorials and resources.
Thanks to Kert-One.