{"id":20573610,"url":"https://github.com/timf34/3d3-project-3","last_synced_at":"2026-04-19T17:33:07.745Z","repository":{"id":129477680,"uuid":"478201765","full_name":"timf34/3d3-project-3","owner":"timf34","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-05T11:07:11.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T21:25:51.531Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timf34.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":"2022-04-05T15:58:25.000Z","updated_at":"2022-04-05T16:09:44.000Z","dependencies_parsed_at":"2023-06-11T06:30:42.959Z","dependency_job_id":null,"html_url":"https://github.com/timf34/3d3-project-3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2F3d3-project-3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2F3d3-project-3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2F3d3-project-3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2F3d3-project-3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timf34","download_url":"https://codeload.github.com/timf34/3d3-project-3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242189744,"owners_count":20086617,"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-16T05:28:19.270Z","updated_at":"2026-04-19T17:33:07.733Z","avatar_url":"https://github.com/timf34.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project 3 - 3D3 - Blockchain messaging network \n\n# General TODO - Project 3\n\nNote: these would still be nice TODOs - get round to them over summer\n\n- [ ] Need to improve the robustness of the network nodes\n  - The best way to do this is to post status responses, to the \n  terminal is probably not the best way to do this but enough for now.\n  We would probably want to have a **constant status response displayed \n  on the webpage**!\n- [ ] Need to show robustness to content types in the network\n  - Show that our network can handle different input types.\n- [ ] Refamiliarize myself with the code base to spot where the improvements\n  are needed.\n\n## Programming TODO \n- [ ] Add test cases directly in the code rather than having to use the \n    web interface. \n- [ ] Post the https response status to the web interface.\n\n\n\n\n\n## Project 3 - Global Problem \n\nWith this project we are looking to contribute to the global problem \nthat is Cancel Culture and Free Speech. In order to help combat this \nproblem we are looking to build a network of nodes that can be used \nto communicate and publish to a public message board where all messages \nare stored _forever_. \n\n## Instructions\n### Setup:\n\nClone the project (or not, we will keep this repository private till the deadline)\n```\ngit clone https://github.com/satwikkansal/python_blockchain_app.git\n```\n\nSet up a virtual environment if you would like to\n```\nvirtualenv venv\n```\n\nInstall the requirments - we will use pip\n```\npip install -r requirements.txt\n```\n\nThis was tested with Python 3.7.3\n\n### Running the code:\nEnsure you're in the project directory\n```\ncd 3D3-project-2\n```\n\nNow open a terminal and set the flask_app variable to network.py - this will depend on your OS/ terminal, we will consider powershell\n```\n# On Windows PowerShell\n$env:FLASK_APP = \"network.py\"\n\n# On Bash \nexport FLASK_APP=network.py\n\nOn Windows CMD \nset FLASK_APP=network.py\n```\n\nThen run (note that the port isn't important, we will use port 8000). It is important to do this in the same terminal that you set the environment variable aove/\n```\nflask run --port 8000\n```\n\nNow in another terminal run the app. This will start the server and it is this link that you follow for the web app!\n```\npython run_app.py\n```\n\nNow you should be able to access the app at [http://localhost:5000](http://localhost:5000). \n\n### Setting up multiple nodes \n\nWe can set up multiple nodes by using multiple terminals. Also note that for these\ninstructions, its best to use a bash terminal for the `curl` commands as command \nprompt and powershell seem to act strangely to the quotes ' and \". \n\nFollow from the instructions above where we have a node set up at local port `8000`.\nWe can now repeat the process setting up nodes with ports `8001`, `8002`, `8003` etc.\n\nEnsure to set the environment variable `FLASK_APP` to `network.py` in each terminal.\n\nRun `flask run --port 8001` \n\nThen to register the nodes, and **ensure you do this in a bash terminal** (such as Git Bash) (to avoid issues with parsing the \" and ')\nrun \n\n```\ncurl -X POST http://127.0.0.1:8001/register_with -H 'Content-Type: application/json' -d '{\"node_address\": \"http://127.0.0.1:8000\"}'\n```\n\nIt should say _registration successful_. \nAlso make sure to do this before you have posted to the message board. \n\nYou can repeat this process on as many ports as you want. \n\nTo check whether this is working, we can query the nodes for a copy of their blockchain.\nSo after we have posted a few messages to the message board, we can run:\n\n```\ncurl -X GET http://localhost:8001/chain\n```\n\nThis will show us whether the multiple nodes are working or not - we can query it to \nsee if the other nodes (8001, 8002, etc.) are updating their blockchain!\n\nFor example, run the above code with multiple nodes running, then post some messages to the web app - watch the blockchain be \nupdated!\n\n\n\n### Functionality\n\n1. Type your message in the text box, and your name in the name box, and then click post. \n   1. The message will be posted to the blockchain. \n2. Now click 'Request to mine'\n   1. The node will request all other nodes to mine the block. \n3. Then click 'Resync'\n   1. Our message board will refresh and the message will be posted to the page. \n   \n\n## Resources\n\nThis project was inspired by:\n- [Blockchain](https://en.wikipedia.org/wiki/Blockchain)\n- [Blockchain basics](https://www.youtube.com/watch?v=Q_XZQZQZQZQ)\n- [Python Blockchain App](https://github.com/satwikkansal/python_blockchain_app)\n  - It was inspired by this repo in particular, from which we modified the web app interface. Much larger changes were \n  made to the blockchain code, which we refactored quite a bit to produce cleaner and more modular code - this really\n  helped with our understanding of blockchain. We also refactored the networking code to suit our needs, and once \n  again, make it more 'clean' and readable.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimf34%2F3d3-project-3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimf34%2F3d3-project-3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimf34%2F3d3-project-3/lists"}