{"id":23196994,"url":"https://github.com/brakmic/coin-platform-2","last_synced_at":"2025-08-29T13:16:22.008Z","repository":{"id":262465026,"uuid":"887184428","full_name":"brakmic/Coin-Platform-2","owner":"brakmic","description":"A minimalist cryptocurrency platform designed to explore and demonstrate the core concepts of blockchain technology","archived":false,"fork":false,"pushed_at":"2024-11-12T15:23:44.000Z","size":10147,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-23T12:10:02.944Z","etag":null,"topics":["blockchain","blockchain-technology"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brakmic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-12T10:07:09.000Z","updated_at":"2025-03-03T11:45:10.000Z","dependencies_parsed_at":"2024-11-12T15:50:45.310Z","dependency_job_id":null,"html_url":"https://github.com/brakmic/Coin-Platform-2","commit_stats":null,"previous_names":["brakmic/coin-platform-2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brakmic/Coin-Platform-2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brakmic%2FCoin-Platform-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brakmic%2FCoin-Platform-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brakmic%2FCoin-Platform-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brakmic%2FCoin-Platform-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brakmic","download_url":"https://codeload.github.com/brakmic/Coin-Platform-2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brakmic%2FCoin-Platform-2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272690621,"owners_count":24977012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","blockchain-technology"],"created_at":"2024-12-18T14:27:30.947Z","updated_at":"2025-08-29T13:16:21.976Z","avatar_url":"https://github.com/brakmic.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coin Platform 2\n\nWelcome to **Coin Platform 2**, a minimalist cryptocurrency platform designed to explore and demonstrate the core concepts of blockchain technology. This project aims to provide a simplified yet functional implementation of a blockchain network, including consensus mechanisms, networking, cryptography, and storage systems.\n\n![coin_platform_2](./gifs/coin_platform_2.gif)\n\n## Table of Contents\n\n- [Coin Platform 2](#coin-platform-2)\n  - [Table of Contents](#table-of-contents)\n  - [Introduction](#introduction)\n  - [Motivation](#motivation)\n  - [Project Structure](#project-structure)\n    - [Overview](#overview)\n    - [Components](#components)\n  - [Building the Project](#building-the-project)\n    - [Prerequisites](#prerequisites)\n    - [Setup Instructions](#setup-instructions)\n  - [Detailed Component Descriptions](#detailed-component-descriptions)\n    - [Common Utilities](#common-utilities)\n    - [Cryptography Module](#cryptography-module)\n    - [Networking Module](#networking-module)\n    - [Storage Module](#storage-module)\n    - [Time Chain](#time-chain)\n    - [Value Chain](#value-chain)\n    - [Consensus Mechanisms](#consensus-mechanisms)\n    - [Node Implementation](#node-implementation)\n    - [Configuration](#configuration)\n    - [Tools](#tools)\n  - [Running the Node](#running-the-node)\n  - [Contributing](#contributing)\n  - [License](#license)\n\n## Introduction\n\nCoin Platform 2 is a simplified blockchain platform that implements a dual-chain architecture:\n\n- **Time Chain**: A chain that keeps track of time and provides a global time reference for the network.\n- **Value Chain**: A chain that handles transactions and maintains the ledger of account balances.\n\nBy separating time tracking from transaction processing, the platform aims to simplify consensus mechanisms and improve scalability.\n\n## Motivation\n\nThe primary motivation behind Coin Platform 2 is educational. It serves as a learning tool for developers interested in understanding how blockchain systems work under the hood. By providing a clean and straightforward codebase, the project allows developers to:\n\n- Explore the implementation of consensus algorithms.\n- Understand networking between nodes in a decentralized network.\n- Learn about cryptographic operations essential to blockchain technology.\n- Experiment with storage solutions for blockchain data.\n- Build and run their own minimal cryptocurrency network.\n\n## Project Structure\n\n### Overview\n\nThe project is organized into several modules, each responsible for a specific aspect of the platform's functionality. Here's a high-level view of the directory structure:\n\n```\ncoin_platform2/\n├── CMakeLists.txt\n├── build/\n├── cmake/\n├── config/\n├── src/\n│   ├── CMakeLists.txt\n│   ├── common/\n│   ├── config/\n│   ├── consensus/\n│   ├── cryptography/\n│   ├── main.cpp\n│   ├── networking/\n│   ├── node/\n│   ├── storage/\n│   ├── time_chain/\n│   └── value_chain/\n├── tests/\n├── third_party/\n└── tools/\n```\n\n### Components\n\n- **common**: Contains utility functions and type definitions used throughout the project.\n- **config**: Handles configuration parsing and management.\n- **consensus**: Implements consensus mechanisms for both Time Chain and Value Chain.\n- **cryptography**: Provides cryptographic functionalities like key generation, hashing, and signing.\n- **networking**: Manages peer-to-peer networking, including connection handling and data transmission.\n- **node**: Represents the node implementation that ties all components together.\n- **storage**: Deals with data persistence for blockchain data.\n- **time_chain**: Implements the Time Chain, which tracks time blocks.\n- **value_chain**: Implements the Value Chain, which processes transactions.\n- **tools**: Contains utility tools like key generators and genesis block creators.\n\n## Building the Project\n\n### Prerequisites\n\nEnsure you have the following installed on your system:\n\n- **C++17 Compiler**: GCC or Clang with C++17 support.\n- **CMake (\u003e=3.10)**: For building the project.\n- **OpenSSL**: Required for cryptographic functions.\n- **Git**: To clone the repository and manage submodules.\n\n### Setup Instructions\n\n1. **Clone the Repository**\n\n   ```bash\n   git clone https://github.com/brakmic/coin-platform-2.git\n   cd coin-platform-2\n   ```\n\n2. **Initialize and Update Submodules**\n\n   The project relies on some third-party libraries included as submodules.\n\n   ```bash\n   git submodule update --init --recursive\n   ```\n\n3. **Build the Project**\n\n   Create a `build` directory and compile the source code using CMake.\n\n   ```bash\n   mkdir build\n   cd build\n   cmake ..\n   make\n   ```\n\n   This will compile the main executable `coin_platform2` along with necessary libraries.\n\n4. **Generate Genesis Blocks**\n\n   Before running the node, you need to generate the genesis blocks.\n\n   - **Generate a Private Key**\n\n     ```bash\n     ./tools/keygen/keygen\n     ```\n\n     Save the generated private key securely; you'll need it in the next step.\n\n   - **Generate Genesis Blocks**\n\n     ```bash\n     ./tools/genesis_generator/genesis_generator \u003cprivate_key_hex\u003e\n     ```\n\n     Replace `\u003cprivate_key_hex\u003e` with the private key obtained from the previous step. This will create `genesis_blocks.hpp` in `src/common/`.\n\n5. **Rebuild with Genesis Blocks**\n\n   After generating the genesis blocks, recompile the project to include them.\n\n   ```bash\n   cd build\n   make clean\n   make\n   ```\n\n## Detailed Component Descriptions\n\n### Common Utilities\n\nLocated in `src/common/`, this module includes:\n\n- **types.hpp**: Defines common types like `Hash`, `PublicKey`, `PrivateKey`, etc.\n- **utilities.hpp/cpp**: Provides utility functions for logging, time retrieval, and byte manipulation.\n- **genesis_blocks.hpp**: Contains the serialized genesis blocks and their hashes.\n\n### Cryptography Module\n\nLocated in `src/cryptography/`, this module handles cryptographic operations:\n\n- **cryptography.hpp/cpp**: Implements hashing functions and key derivation.\n- **schnorr_signature.hpp/cpp**: Provides functions for Schnorr signature creation and verification.\n\nThe module uses `secp256k1` library for elliptic curve operations.\n\n### Networking Module\n\nLocated in `src/networking/`, this module manages network communications:\n\n- **network_manager.hpp/cpp**: Handles peer connections, data transmission, and message handling.\n- Uses [Asio](https://think-async.com/Asio/) for asynchronous networking.\n\n### Storage Module\n\nLocated in `src/storage/`, this module is responsible for data persistence:\n\n- **storage_interface.hpp**: Defines the interface for storage operations.\n- **file_storage.hpp/cpp**: Implements file-based storage for blockchain data.\n\nBlocks are stored on disk in a simple format, making it easy to inspect and debug.\n\n### Time Chain\n\nLocated in `src/time_chain/`, this module implements the Time Chain:\n\n- **time_block.hpp/cpp**: Defines the structure and serialization of a time block.\n- **time_chain.hpp/cpp**: Manages the chain of time blocks.\n\nThe Time Chain provides a global time reference, which is essential for synchronizing events across the network.\n\n### Value Chain\n\nLocated in `src/value_chain/`, this module implements the Value Chain:\n\n- **transaction.hpp/cpp**: Defines the structure and verification of transactions.\n- **value_block.hpp/cpp**: Defines the structure and serialization of a value block.\n- **value_chain.hpp/cpp**: Manages the chain of value blocks.\n\nThe Value Chain handles transaction processing and maintains the ledger of account balances.\n\n### Consensus Mechanisms\n\nLocated in `src/consensus/`, this module implements consensus algorithms for both chains:\n\n- **consensus_interface.hpp**: Defines a generic interface for consensus mechanisms.\n- **time_chain_consensus.hpp/cpp**: Implements consensus logic for the Time Chain.\n- **value_chain_consensus.hpp/cpp**: Implements consensus logic for the Value Chain.\n\nConsensus is achieved through a simplified stochastic process, determining which node is eligible to produce the next block.\n\n### Node Implementation\n\nLocated in `src/node/`, this module brings all components together:\n\n- **node.hpp/cpp**: Implements the node logic, including initialization, event handling, and main loops.\n\nThe node manages both the Time Chain and Value Chain, handling incoming messages, producing blocks, and broadcasting transactions.\n\n### Configuration\n\nLocated in `src/config/`, this module handles application configuration:\n\n- **config.hpp/cpp**: Parses command-line arguments and provides configuration settings to other components.\n\n### Tools\n\nLocated in `tools/`, this directory contains utility programs:\n\n- **keygen**: Generates a new private key.\n- **genesis_generator**: Creates the genesis blocks using a provided private key.\n\n## Running the Node\n\nAfter building the project and generating the genesis blocks, you can run the node:\n\n```bash\n./coin_platform2 --port 8001 --role dual\n```\n\nCommand-line options:\n\n- `--port \u003cport_number\u003e`: Specifies the port on which the node listens.\n- `--role \u003ctime|value|dual\u003e`: Specifies the node's role in the network.\n\nExample of running two nodes on the same machine for testing:\n\n```bash\n# Terminal 1\n./coin_platform2 --port 8001 --role dual\n\n# Terminal 2\n./coin_platform2 --port 8002 --role dual\n```\n\nThe nodes will attempt to connect to each other based on predefined logic in the `main.cpp` file.\n\n## Contributing\n\nContributions are welcome! Feel free to submit issues or pull requests to improve the project.\n\nWhen contributing, please:\n\n- Follow the existing code style.\n- Write clear commit messages.\n- Ensure that the project builds without errors.\n\n## License\n\nThis project is open-source and available under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrakmic%2Fcoin-platform-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrakmic%2Fcoin-platform-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrakmic%2Fcoin-platform-2/lists"}