{"id":16703324,"url":"https://github.com/krystianity/blockchain","last_synced_at":"2025-09-01T13:37:27.563Z","repository":{"id":31958996,"uuid":"131004106","full_name":"krystianity/blockchain","owner":"krystianity","description":":muscle::link: PoW Blockchain implementation in Typescript :currency_exchange:","archived":false,"fork":false,"pushed_at":"2022-12-10T19:46:29.000Z","size":324,"stargazers_count":32,"open_issues_count":7,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-02T20:06:18.513Z","etag":null,"topics":["block","blockchain","nodejs","proof","proof-of-work","scale","transaction","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krystianity.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-25T12:38:21.000Z","updated_at":"2024-05-18T18:28:38.000Z","dependencies_parsed_at":"2023-01-14T20:12:26.708Z","dependency_job_id":null,"html_url":"https://github.com/krystianity/blockchain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/krystianity/blockchain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krystianity%2Fblockchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krystianity%2Fblockchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krystianity%2Fblockchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krystianity%2Fblockchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krystianity","download_url":"https://codeload.github.com/krystianity/blockchain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krystianity%2Fblockchain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271128547,"owners_count":24703875,"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-19T02:00:09.176Z","response_time":63,"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":["block","blockchain","nodejs","proof","proof-of-work","scale","transaction","typescript"],"created_at":"2024-10-12T19:07:52.037Z","updated_at":"2025-08-19T09:08:55.358Z","avatar_url":"https://github.com/krystianity.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# blockchain\n\nFully fledged PoW blockchain implementation in TypeScript.\n\n## Features/Setup\n\n* Proof of Work __(similar to Bitcoin's Hashcash)__\n* Consensus __(similar to Bitcoin's longest chain)__\n* Implemented Node P2P communication via HTTP/S (register, transaction, blocks)\n* Addresses in RSA PEM 1024/2048 **easily swapable with e.g. elliptic curves**\n* Transaction SHA256 signature validation\n* SHA256 Block Hashes\n* All node operations are call-able via HTTP API\n* Chain backed to disk in nodes via SQLite3 **easily swapable with a different backend**\n\n## Use\n\n### Prepare\n\nRequires [Node.js](https://nodejs.org/en/) \u003e 8.x.x\nand yarn (`npm i -g yarn`).\n\n`yarn`\n\n### Start\n\n`yarn start`\n\n### Test\n\n3 Node Network E2E Tests\n\n### P2P Protocol\n\n`yarn test:p2p`\n\n### Consensus Algorithm\n\n`yarn test:consensus`\n\n## HTTP Node API\n\n### Client Facing\n\n* `GET /api/address/new` **blocking operation**\n* `POST /api/address/transactions/:address - {address}`\n* `POST /api/address/balance/:address - {address}`\n* `GET /api/blocks/last`\n\n* `POST /api/transaction/sign - {transaction, address, privateKey}` **test endpoint**\n* `POST /api/transactions/new - {sender, recipient, amount, payload, timestamp, signature}`\n\n### Operations (trigger)\n\n* `GET /api/mine` **blocking operation**\n* `GET /api/nodes/resolve`\n\n### P2P Node Protocol\n\n* `POST /api/nodes/register - {nodes}`\n* `GET /api/peer/chain` **p2p node endpoint**\n* `POST /api/peer/transaction - {transaction}` **p2p node endpoint**\n* `POST /api/peer/block - {block}` **p2p node endpoint**\n\n## License\n\nApache License 2.0\n\n## Further Scaling Oppertunities\n\n* During conflict resolvation the servering node streams TransferInterface to the\nfetching client node, but currently the client node does not stream insert the\nblockchain.\n* Currently the blockchain validation function is based on a full in memory process,\nto scale further this needs to either be chunked/streamed or based on a db process.\n* The balance of a sender should be checked when a transaction is made and when\nsuch a transaction is received by another node via peer communcation (requires a single function call)\n* Additional hardening might be needed in case of blocks that are mined at the exact same time\n* Addresses should be switched to elliptic curves to generate and sign faster\n* SQLite3 should be switched with a more scaleable database\n* Nodes should constantly extend their known nodes, by asking for other registered nodes (easily implemented)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrystianity%2Fblockchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrystianity%2Fblockchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrystianity%2Fblockchain/lists"}