{"id":24794131,"url":"https://github.com/chris-cozy/blockcraft","last_synced_at":"2025-10-17T10:10:25.704Z","repository":{"id":41990928,"uuid":"366526682","full_name":"chris-cozy/BlockCraft","owner":"chris-cozy","description":"BlockCraft is a simple blockchain simulator that emulates the behavior of a decentralized blockchain network. It provides basic functionalities for mining blocks, adding transactions, and saving/loading the blockchain data to/from files. The simulator is designed as an educational tool to understand the fundamental concepts of blockchain technology","archived":false,"fork":false,"pushed_at":"2023-08-04T19:21:29.000Z","size":92,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T17:53:53.045Z","etag":null,"topics":["blockchain","blockchain-technology","mining","python","simulation","simulator"],"latest_commit_sha":null,"homepage":"","language":"Python","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/chris-cozy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-05-11T22:20:50.000Z","updated_at":"2023-08-11T08:16:44.000Z","dependencies_parsed_at":"2025-01-29T22:43:33.287Z","dependency_job_id":null,"html_url":"https://github.com/chris-cozy/BlockCraft","commit_stats":null,"previous_names":["chris-cozy/blockcraft"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chris-cozy/BlockCraft","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-cozy%2FBlockCraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-cozy%2FBlockCraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-cozy%2FBlockCraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-cozy%2FBlockCraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chris-cozy","download_url":"https://codeload.github.com/chris-cozy/BlockCraft/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-cozy%2FBlockCraft/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273699721,"owners_count":25152285,"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-09-04T02:00:08.968Z","response_time":61,"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","mining","python","simulation","simulator"],"created_at":"2025-01-29T22:33:25.109Z","updated_at":"2025-10-17T10:10:20.648Z","avatar_url":"https://github.com/chris-cozy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **BlockCraft**\n\n![https://img.shields.io/badge/blockchain-simulator-brightgreen](https://img.shields.io/badge/blockchain-simulator-brightgreen)\n\nBlockCraft is a simple blockchain simulator that emulates the behavior of a decentralized blockchain network. It provides basic functionalities for mining blocks, adding transactions, and saving/loading the blockchain data to/from files. The simulator is designed as an educational tool to understand the fundamental concepts of blockchain technology.\n\n## **Features**\n\n- Create a decentralized blockchain network with multiple nodes.\n- Simulate mining of blocks with proof-of-work (PoW) consensus algorithm.\n- Execute simple smart contracts during block mining.\n- Achieve consensus among nodes to add blocks to the blockchain.\n- Mine blocks concurrently using threading.\n- Customize blockchain parameters like difficulty and max nonce.\n- View and explore the entire blockchain using a user-friendly web interface.\n- Simulate real-world scenarios with randomized mining times.\n- Handle mining failure and gracefully resolve forks.\n\n## **Requirements**\n\n- Python 3.7\n- Flask (for the web interface)\n\n## **Installation**\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/chris-cozy/BlockCraft.git\n   cd BlockCraft\n   ```\n\n2. Create a virtual environment (optional but recommended):\n\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate  # On Windows: venv\\Scripts\\activate\n   ```\n\n3. Install dependencies:\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n## **Usage**\n\n1. Run the blockchain simulator:\n\n   ```bash\n   python main.py\n   ```\n\nUpon running the simulator, a blockchain network with five nodes will be created.\n\nThe blockchain will run for ten rounds. During each round, every node will mine a block. The node which finishes first will call the other nodes for a consensus on the block’s validity.\n\nIf the block is valid, it will be added to the official blockchain and each node will update their version.\n\nThe contents of the official blockchain will be printed at the end of the simulation.\n\n## **Configuration**\n\nYou can configure various blockchain parameters by editing the main.py file:\n\n- **`difficulty`**: Set the difficulty level for mining (higher values make mining more challenging). (`blockchain.py`)\n- **`maxNonce`**: Set the maximum value for the nonce during mining. (`blockchain.py`)\n- **`rounds`**: Set the number of rounds for concurrent mining. (`main.py`)\n\n## **Smart Contracts**\n\nYou can experiment with simple smart contracts by adding Python expressions in the **`contract_script`** parameter while mining a block. The simulator will execute the script during mining and display the result.\n\n## **Contributing**\n\nContributions to BlockCraft are welcome! Whether it's bug fixes, new features, or improvements to the documentation, feel free to open a pull request.\n\n## **License**\n\nThis project is licensed under the MIT License - see the **[LICENSE](https://opensource.org/license/mit/)** file for details.\n\n## **Acknowledgments**\n\nBlockCraft is inspired by various blockchain tutorials and resources available online. The original implementation and improvements were made by [Chris Cozy](https://github.com/chris-cozy).\n\n## **Disclaimer**\n\nThis blockchain simulator is intended for educational purposes only and is not suitable for use in production environments. It does not fully implement the security measures required for a real-world blockchain system.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris-cozy%2Fblockcraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchris-cozy%2Fblockcraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris-cozy%2Fblockcraft/lists"}