{"id":15074343,"url":"https://github.com/pratik-codes/go-blockchain","last_synced_at":"2025-04-10T18:45:05.753Z","repository":{"id":253760445,"uuid":"844268182","full_name":"pratik-codes/go-blockchain","owner":"pratik-codes","description":"A light weight blockchain (inspired by bitcoin architecture) written in Golang for devs with interest in blockchain architecture.","archived":false,"fork":false,"pushed_at":"2024-11-03T17:22:44.000Z","size":40,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T16:35:11.414Z","etag":null,"topics":["blockchain","go","grpc","web3","websock"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pratik-codes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-08-18T22:03:33.000Z","updated_at":"2025-03-15T15:20:51.000Z","dependencies_parsed_at":"2025-02-17T20:42:59.799Z","dependency_job_id":null,"html_url":"https://github.com/pratik-codes/go-blockchain","commit_stats":{"total_commits":2,"total_committers":2,"mean_commits":1.0,"dds":0.5,"last_synced_commit":"cf319f350c947e1770bbb884ce730ae36be290d0"},"previous_names":["pratik-codes/go-blockchain"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratik-codes%2Fgo-blockchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratik-codes%2Fgo-blockchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratik-codes%2Fgo-blockchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratik-codes%2Fgo-blockchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pratik-codes","download_url":"https://codeload.github.com/pratik-codes/go-blockchain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248271925,"owners_count":21075800,"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","go","grpc","web3","websock"],"created_at":"2024-09-25T03:32:17.956Z","updated_at":"2025-04-10T18:45:05.733Z","avatar_url":"https://github.com/pratik-codes.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blockchain Interaction: Central Server \u0026 Miner Nodes\n\n## **Step-by-Step Interaction When a User Adds a Transaction Request:**\n\n```text\n  User                             Central Server                          Miners (M1, M2, ...)\n    |                                    |                                      |\n    |------ Add Transaction -------------|                                      |\n    |                                    |                                      |\n    |                                    |                                      |\n    |                               1. Broadcast Transaction -------------------| \n    |                                    |--------- Receive Transaction --------|\n    |                                    |                                      |\n    |                                    |                                      |\n    |                              2. Add transaction to txn pool               |\n    |                                    |                                      |\n    |                                    |--------- Broadcast new txns --------\u003e|\n    |                                    |                                      |\n    |                              3. Wait for block mining                    3. Start mining\n    |                                    |                                      |---|\n    |                                    |                                      |   |--\u003e Do proof of work\n    |                                    |                                      |---|\n    |                                    |                                      |\n    |                                    |                                      |---|\n    |                                    |                                      |   |--\u003e Successfully mine a block\n    |                                    |                                      |---|\n    |                                    |                                      |\n    |                                    | \u003c----- Broadcast new block --------- |\n    |                              4. Verify Block                             4. Verify Block\n    |                              5. Add Block to chain                       5. Add Block to chain\n    |                              6. Adjust difficulty                        6. Adjust difficulty\n    |                                    |                                      |\n    |                                    |                                      |\n    |                                    | ----- Broadcast new block ---------\u003e |\n    |                                    |            to                        |\n    |                                    |        other miners                  |\n    |                                    |                                      |\n    |                                    |                                      |\n    |------- Notify users of success ----|                                      |\n```\n\n## Central Server Responsibilities:\n1. Broadcast Transaction:\nWhen a user adds a new transaction, the central server broadcasts it to all connected miners.\n\n2. Manage Transaction Pool:\nThe server adds the transaction to its own transaction pool and removes transactions that are already included in a mined block.\n\n3. Broadcast New Transactions:\nThe server keeps miners updated by broadcasting new transactions regularly.\n\n4. Verify and Add Block:\nOnce a block is mined by any miner, the central server verifies it and broadcasts the new block to the rest of the miners.\n\n5. Adjust Difficulty:\nAfter receiving each new block, the server adjusts the difficulty level to maintain a steady block time.\n\n## Miner Server Responsibilities:\n1. Receive Transactions:\nEach miner receives new transactions from the central server and maintains its own transaction pool.\n\n2. Mine Blocks:\nMiners mine blocks at a fixed interval by performing Proof of Work (PoW). This involves finding a valid hash based on the difficulty level.\n\n3. Broadcast Mined Block:\nAfter successfully mining a block, the miner broadcasts it to the central server, which further distributes it to all other miners.\n\n4. Verify Block:\nEach miner verifies the received block and checks if the chain is valid. Smaller or erroneous chains are rejected.\n\n5. Update Blockchain:\nThe miner updates its local copy of the blockchain and adjusts the mining difficulty based on the central server’s broadcast.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratik-codes%2Fgo-blockchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpratik-codes%2Fgo-blockchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratik-codes%2Fgo-blockchain/lists"}