{"id":22785612,"url":"https://github.com/thecomputerm/demochain","last_synced_at":"2025-03-30T15:27:03.662Z","repository":{"id":264531097,"uuid":"893104775","full_name":"TheComputerM/demochain","owner":"TheComputerM","description":"A WebRTC based toy blockchain network, hopefully useful for learning and demonstrations.","archived":false,"fork":false,"pushed_at":"2025-03-10T01:17:58.000Z","size":2793,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T02:40:28.823Z","etag":null,"topics":["blockchain","p2p","solidjs"],"latest_commit_sha":null,"homepage":"https://demochain.vercel.app","language":"TypeScript","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/TheComputerM.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-11-23T14:48:12.000Z","updated_at":"2025-03-10T01:18:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2296643-4379-4e87-8a75-a5be93eccd7b","html_url":"https://github.com/TheComputerM/demochain","commit_stats":null,"previous_names":["thecomputerm/demochain"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheComputerM%2Fdemochain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheComputerM%2Fdemochain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheComputerM%2Fdemochain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheComputerM%2Fdemochain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheComputerM","download_url":"https://codeload.github.com/TheComputerM/demochain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246337079,"owners_count":20761154,"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","p2p","solidjs"],"created_at":"2024-12-11T23:06:56.568Z","updated_at":"2025-03-30T15:27:03.633Z","avatar_url":"https://github.com/TheComputerM.png","language":"TypeScript","readme":"# Demochain\n\nThis is a toy blockchain network built for learning and demonstration. It started as a project for a Blockchain course I took at college, but I wanted to build a more *roboust* and *complete* one as a learning exercise. I tried to keep dependencies to a minimum and try to build the network from scratch.\n\n## Tech stack\n\nThis network fully runs on your browser, standing on the shoulders of giants such as:\n\n- [Trystero](https://github.com/dmotz/trystero): for the WebRTC p2p networking\n- [@noble/ed25519](https://github.com/paulmillr/noble-ed25519): for the encryption algorithms used\n- [cbor2](https://www.npmjs.com/package/cbor2): for the JS implementation of the CBOR spec\n- [Park UI](https://park-ui.com/): for the UI components\n- [SolidJS](https://www.solidjs.com/) and [SolidStart](https://start.solidjs.com/): JavaScript framework and metaframework respectively\n- [Bun](https://bun.sh/) - JavaScript runtime\n\n## Technical details\n\n\u003e TODO: add more details in a separate doc\n\n- Uses the Ed25519 algorithm for generating wallets and signing transactions/blocks.\n- Uses WebRTC for peer-2-peer all communication, except peer discovery which happens using a realtime database on firebase.\n- Uses PoW for consensus where difficulty is the number of leading 0s in the block's SHA-256 hash.\n- Uses the CBOR spec to encode blocks and transactions to send them over the network.\n- Can have multiple transactions in a single block.\n- Transactions are differentiated using a nonce, like in the ethereum network.\n- Transactions are signed by the one who created it.\n- Blocks are signed by the one who mined it.\n\n## Future\n\n- Graphs for monitoring network activity.\n- Add videos demonstrating common concepts and attacks (such as race attack, finney attack etc).\n- Add handy tool to manipulate blockchain data on your node.\n- Change difficulty dynamically.\n- Add button to broadcast after mine/create.\n\n## Afterword\n\nThe project took a considerable bit of effort and research, but it was quite enjoyable. I will continue to push changes when I get free time but there won't be any breaking features as I intend to keep it as rudimentary as possible. Shoot me a DM/mail if you found this project helpful.\n\n```\n───────────────────────────────────────────────────────────────────────────────\nLanguage                 Files     Lines   Blanks  Comments     Code Complexity\n───────────────────────────────────────────────────────────────────────────────\nTypeScript                  83      3218      321        76     2821        179\nJSON                         4       109        0         0      109          0\nCSS                          1         1        0         0        1          0\nMarkdown                     1        31       10         0       21          0\nTypeScript Typings           1         1        0         1        0          0\ngitignore                    1        33        7         6       20          0\n───────────────────────────────────────────────────────────────────────────────\nTotal                       91      3393      338        83     2972        179\n───────────────────────────────────────────────────────────────────────────────\nEstimated Cost to Develop (organic) $84,780\nEstimated Schedule Effort (organic) 5.38 months\nEstimated People Required (organic) 1.40\n───────────────────────────────────────────────────────────────────────────────\nProcessed 95003 bytes, 0.095 megabytes (SI)\n───────────────────────────────────────────────────────────────────────────────\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecomputerm%2Fdemochain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecomputerm%2Fdemochain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecomputerm%2Fdemochain/lists"}