{"id":16166020,"url":"https://github.com/koshikraj/pynaivechain","last_synced_at":"2025-06-29T05:38:09.980Z","repository":{"id":93975178,"uuid":"124015019","full_name":"koshikraj/pynaivechain","owner":"koshikraj","description":"Python implementation of naivechain project","archived":false,"fork":false,"pushed_at":"2018-03-24T06:42:14.000Z","size":71,"stargazers_count":18,"open_issues_count":2,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T20:06:08.858Z","etag":null,"topics":["blockchain","python","sanic","websocket"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/koshikraj.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-03-06T03:28:10.000Z","updated_at":"2022-12-13T15:29:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"b8c2c554-52f5-42a1-89c7-0e9ea9d19223","html_url":"https://github.com/koshikraj/pynaivechain","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/koshikraj/pynaivechain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koshikraj%2Fpynaivechain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koshikraj%2Fpynaivechain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koshikraj%2Fpynaivechain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koshikraj%2Fpynaivechain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koshikraj","download_url":"https://codeload.github.com/koshikraj/pynaivechain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koshikraj%2Fpynaivechain/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262543970,"owners_count":23326632,"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","python","sanic","websocket"],"created_at":"2024-10-10T02:53:05.769Z","updated_at":"2025-06-29T05:38:09.944Z","avatar_url":"https://github.com/koshikraj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pynaivechain\nPython implementation of [naivechain](https://github.com/lhartikk/naivechain) project\n\n[![Build Status](https://travis-ci.org/koshikraj/pynaivechain.svg?branch=master)](https://travis-ci.org/koshikraj/pynaivechain)\n\n# Naivechain - a blockchain implementation in 200 lines of code\n\n### Motivation\nAll the current implementations of blockchains are tightly coupled with the larger context and problems they (e.g. Bitcoin or Ethereum) are trying to solve. This makes understanding blockchains a necessarily harder task, than it must be. Especially source-code-wisely. This project is an attempt to provide as concise and simple implementation of a blockchain as possible.\n\n \n### What is blockchain\n[From Wikipedia](https://en.wikipedia.org/wiki/Blockchain_(database)) : Blockchain is a distributed database that maintains a continuously-growing list of records called blocks secured from tampering and revision.\n\n### Key concepts of Naivechain\nCheck also [this blog post](https://medium.com/@lhartikk/a-blockchain-in-200-lines-of-code-963cc1cc0e54#.dttbm9afr5) for a more detailed overview of the key concepts\n* HTTP interface to control the node\n* Use Websockets to communicate with other nodes (P2P)\n* Super simple \"protocols\" in P2P communication\n* Data is not persisted in nodes\n* No proof-of-work or proof-of-stake: a block can be added to the blockchain without competition\n\n\n![alt tag](naivechain_blockchain.png)\n\n![alt tag](naivechain_components.png)\n\n\n### Naivecoin\nFor a more extensive tutorial about blockchains, you can check the project [Naivecoin](https://lhartikk.github.io/). It is based on Naivechain and implements for instance Proof-of-work, transactions and wallets.\n\n### Quick start\n(set up two connected nodes and mine 1 block)\n```\ninstall python version \u003e= 3.5\n\npip install -r requirements.txt\nPORT=3001 python main.py\nPORT=3002 PEERS=ws://localhost:3001 python main.py\ncurl -H \"Content-type:application/json\" --data '{\"data\" : \"Some data to the first block\"}' http://localhost:3001/mineBlock\n```\n\n### Quick start with Docker\n(set up three connected nodes and mine a block)\n###\n```sh\ndocker-compose up\ncurl -H \"Content-type:application/json\" --data '{\"data\" : \"Some data to the first block\"}' http://localhost:3001/mineBlock\n```\n\n### HTTP API\n##### Get blockchain\n```\ncurl http://localhost:3001/blocks\n```\n##### Create block\n```\ncurl -H \"Content-type:application/json\" --data '{\"data\" : \"Some data to the first block\"}' http://localhost:3001/mineBlock\n``` \n##### Add peer\n```\ncurl -H \"Content-type:application/json\" --data '{\"peer\" : \"ws://localhost:6001\"}' http://localhost:3001/addPeer\n```\n#### Query connected peers\n```\ncurl http://localhost:3001/peers\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoshikraj%2Fpynaivechain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoshikraj%2Fpynaivechain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoshikraj%2Fpynaivechain/lists"}