{"id":20553563,"url":"https://github.com/mrtj/pyncoin","last_synced_at":"2025-09-03T04:39:10.815Z","repository":{"id":69169748,"uuid":"137372887","full_name":"mrtj/pyncoin","owner":"mrtj","description":"A fully functioning blockchain implementation in python.","archived":false,"fork":false,"pushed_at":"2018-06-22T15:23:49.000Z","size":75,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-16T17:30:28.114Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/mrtj.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":"2018-06-14T14:58:11.000Z","updated_at":"2022-04-12T12:15:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"bd9afac2-2a76-4f76-8143-f506839e796f","html_url":"https://github.com/mrtj/pyncoin","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtj%2Fpyncoin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtj%2Fpyncoin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtj%2Fpyncoin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtj%2Fpyncoin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrtj","download_url":"https://codeload.github.com/mrtj/pyncoin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242157362,"owners_count":20081049,"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":[],"created_at":"2024-11-16T02:42:24.786Z","updated_at":"2025-03-06T06:19:23.383Z","avatar_url":"https://github.com/mrtj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyncoin\n\nThis project is a python port of [Naivecoin](https://github.com/lhartikk/naivecoin), an excellent tutorial that lets you implement a fully functioning blockchain and cryptocurrency in TypeScript for educational purposes.\n\n## Description\n\nIn this repo you find the implementation of a full node for the pyncoin blockchain. Only the features strictly necessary to make the node work are implemented. \n\nAs a user interface the node starts a simple web server that provides the following REST services:\n\n - `GET /blocks`: Returns the blockchain known to this node\n - `POST /mineBlock`: Mines a new block. Include the data you wish to put in the block as a string in the `data` parameter.\n - `GET /peers`: Returns the list of the peers known to this node\n - `POST /addPeer`: Adds a new peer to the node. The node does not discover other nodes, you should add them manually calling this service and passing the address of the peer node in `ws://127.0.0.1:6000` format in the `peer` parameter.\n\nThe blockchain is not persisted by the node, it is kept only in the memory.\n\npyncoin also manages a WebSocket interface to communcicate with peer nodes.\n\n## Getting Started\n\n### Dependencies\n\npyncoin depends on the following python libraries:\n\n - [twisted](https://github.com/twisted/twisted)\n - [autobahn](https://github.com/crossbario/autobahn-python)\n - [flask](https://github.com/pallets/flask)\n - [bitstring](https://github.com/scott-griffiths/bitstring)\n\npyncoin is developed and tested on python 3.\n\n### Installing\n\nInstall the dependent libraries above and check out the contents of this repository into a separate folder.\n\n### Executing program\n\nStart the node by passing the port number of the web server and the p2p server to `main.py`:\n\n```\npython main.py 5000 6000\n```\n\nThis command starts a web server at `127.0.0.1:5000` and a p2p node at `127.0.0.1:6000`. You can communicate with the web server with the simple API described in the introduction of the readme, for example:\n\n```\ncurl -d \"data=Hello+World%21\" -X POST http://127.0.0.1:5000/mineBlock\ncurl http://127.0.0.1:5000/blocks\n```\n\nIf you want, you can also start a second node on the same machine with different ports:\n\n```\npython main.py 5001 6001\n```\n\nAnd connect the two nodes:\n\n```\ncurl -d \"peer=ws%3A%2F%2F127.0.0.1%3A6000\" -X POST http://127.0.0.1:5000/addPeer\ncurl http://127.0.0.1:5000/peers\n```\n\n## Authors\n\n[@jtolgyesi](http://twitter.com/jtolgyesi)\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details\n\n## Acknowledgments\n\nMany thanks to Lauri Hartikka for his original [tutorial](https://lhartikk.github.io) of Naivecoin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtj%2Fpyncoin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrtj%2Fpyncoin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtj%2Fpyncoin/lists"}