{"id":24762045,"url":"https://github.com/pranavh-2004/gochain","last_synced_at":"2025-03-23T13:17:12.082Z","repository":{"id":270375884,"uuid":"910119349","full_name":"Pranavh-2004/GoChain","owner":"Pranavh-2004","description":"A simple and lightweight blockchain implementation in Go for learning and experimentation with block creation, proof-of-work, and persistent storage using BoltDB","archived":false,"fork":false,"pushed_at":"2024-12-30T16:58:43.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-28T19:21:16.556Z","etag":null,"topics":["blockchain","blockchain-experiment","boltdb","cli-app","cryptography","decentralization","go","golang","proof-of-work"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Pranavh-2004.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":"2024-12-30T14:40:53.000Z","updated_at":"2025-01-05T10:58:31.000Z","dependencies_parsed_at":"2024-12-30T17:38:33.280Z","dependency_job_id":"372349dd-9211-4a0a-81ba-8104fb8a0ebb","html_url":"https://github.com/Pranavh-2004/GoChain","commit_stats":null,"previous_names":["pranavh-2004/gochain"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pranavh-2004%2FGoChain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pranavh-2004%2FGoChain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pranavh-2004%2FGoChain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pranavh-2004%2FGoChain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pranavh-2004","download_url":"https://codeload.github.com/Pranavh-2004/GoChain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245104526,"owners_count":20561380,"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","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-experiment","boltdb","cli-app","cryptography","decentralization","go","golang","proof-of-work"],"created_at":"2025-01-28T19:20:17.535Z","updated_at":"2025-03-23T13:17:12.050Z","avatar_url":"https://github.com/Pranavh-2004.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoChain\n\n**GoChain** is a lightweight blockchain implementation written in Go, designed for learning and experimentation. This project demonstrates core blockchain concepts like block creation, proof-of-work, and data persistence using BoltDB.\n\n## Project Structure\n\nThe project is organized into the following directories and files:\n\n```plaintext\nGoChain/\n├── cmd/                    # Entry points for different applications\n│   ├── test_app/           # A test application for demonstrating blockchain features\n│   │   └── main.go         # Main entry point for the test application\n│   └── user_cli_app/       # A CLI application for interacting with the blockchain\n│       └── main.go         # Main entry point for the CLI application\n├── internal/               # Core logic and internal modules\n│   ├── blockchain/         # Blockchain implementation\n│   │   ├── block.go        # Block structure and block-related logic\n│   │   ├── blockchain.go   # Blockchain structure and management\n│   │   └── proof.go        # Proof-of-Work (PoW) implementation\n│   └── storage/            # Persistent storage for the blockchain\n│       └── storage.go      # Functions for saving and loading the blockchain from BoltDB\n├── .gitignore              # Git ignore file for unnecessary files\n├── blockchain.db           # BoltDB file for storing the blockchain (auto-generated)\n├── go.mod                  # Module file for dependency management\n├── go.sum                  # Checksum file for dependencies\n├── LICENSE                 # Project license\n└── Readme.md               # Project documentation\n```\n\n## Key Components\n\n### Blockchain (`internal/blockchain`)\n\n- **Block**: Defines the structure of a block, including `Data`, `Hash`, `PrevHash`, and `Nonce`. Includes methods for calculating the block hash.\n- **Blockchain**: A chain of blocks. Includes methods to add blocks and initialize the blockchain with a genesis block.\n- **Proof of Work (PoW)**: Implements a proof-of-work algorithm for block validation using adjustable difficulty.\n\n### Storage (`internal/storage`)\n\n- Handles persistent storage of the blockchain using **BoltDB**.\n- Supports saving the blockchain to a database and loading it back into memory.\n\n### Applications (`cmd`)\n\n- **Test App**: A sample application to demonstrate blockchain functionality.\n- **User CLI App**: A command-line interface for users to interact with the blockchain (e.g., adding blocks and viewing the chain).\n\n## Features\n\n1. **Block Creation**: Create new blocks with data and link them using hashes.\n2. **Proof of Work**: Ensures computational effort before adding blocks.\n3. **Persistence**: Save and load the blockchain using a database.\n4. **CLI Application**: Interact with the blockchain through a user-friendly CLI.\n\n## How to Run\n\n### Prerequisites\n\n- Go 1.19 or later\n- [BoltDB](https://github.com/boltdb/bolt)\n\n### Running the Test Application\n\n```bash\n    cd cmd/test_app\n    go run main.go\n```\n\n### Running the CLI Application\n\n```bash\n    cd cmd/user_cli_app\n    go run main.go\n```\n\nFollow the prompts to add data to the blockchain or view the chain.\n\n## Example Output\n\nWhen running the CLI app:\n\n```\nEnter data for the block (or type 'exit' to stop): First Block\nEnter data for the block (or type 'exit' to stop): Second Block\nEnter data for the block (or type 'exit' to stop): exit\n\nData: Genesis\nHash: 4bf4fc9181b5c6d...ff\nPrevHash:\nNonce: 17\n\nData: First Block\nHash: c5e4ac9189c8a8d...fd\nPrevHash: 4bf4fc9181b5c6d...ff\nNonce: 45\n\nData: Second Block\nHash: 8f2ad881b9e8d6c...ee\nPrevHash: c5e4ac9189c8a8d...fd\nNonce: 68\n```\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranavh-2004%2Fgochain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpranavh-2004%2Fgochain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranavh-2004%2Fgochain/lists"}