{"id":20629215,"url":"https://github.com/dcts/holochain-hackathon-barcelona","last_synced_at":"2025-03-08T17:21:25.398Z","repository":{"id":36261650,"uuid":"222228543","full_name":"dcts/holochain-hackathon-barcelona","owner":"dcts","description":"repo used during holochain hackathon in barcelona (15.11.2019 - 17.11.2019)","archived":false,"fork":false,"pushed_at":"2022-06-17T01:32:00.000Z","size":782,"stargazers_count":5,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T11:13:15.812Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/dcts.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}},"created_at":"2019-11-17T10:04:33.000Z","updated_at":"2024-03-22T12:13:24.000Z","dependencies_parsed_at":"2022-09-06T19:40:27.865Z","dependency_job_id":null,"html_url":"https://github.com/dcts/holochain-hackathon-barcelona","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/dcts%2Fholochain-hackathon-barcelona","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcts%2Fholochain-hackathon-barcelona/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcts%2Fholochain-hackathon-barcelona/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcts%2Fholochain-hackathon-barcelona/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcts","download_url":"https://codeload.github.com/dcts/holochain-hackathon-barcelona/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242582608,"owners_count":20153279,"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-16T13:42:12.592Z","updated_at":"2025-03-08T17:21:25.374Z","avatar_url":"https://github.com/dcts.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Holochain Hackathon CodeDiary\nThis repo was created during the [Holochain](www.holochain.org) Hackathon in Barcelona (15.11 - 18.11.2019). The event was a lot of fun and super intense. Here's a short recap what I've learned:\n- **Rust programming language** basics. Intro by [Hedayat Abedijoo](http://abedijoo.com/). Keywords: `ownership` of resources; `borrowing` of ownership (vs referencing); `cloning` as a mechanism to prevent loss of ownership.\n- Holochain basic [tutorials](https://developer.holochain.org/docs/tutorials/coreconcepts/): I've managed to go through all basic tutorials covering zome-functions, testing, connecting the DHT to the frontend as well as connecting multiple agents with the `holochain` conductor.\n- **Project**: On the last day I build a p2p **annonymous chat** running on holochain.\n\n## Project Screenshot\n![screenshot](https://user-images.githubusercontent.com/44790691/69198785-3eebc600-0b36-11ea-825e-65319d9a85f0.jpeg)\nSimple p2p chat app that allows connected users to throw messages inside a pool of messages. The sender of the message is not stored, also messages with the same content are not duplicated. Since I didnt haver time to implement an anchor and links, I has to store the hashes of each message in a centralized db (I used firebase). So I kinda cheated. The content itself is stored in the DHT, the references (hashes) of the content are stored in firestore databse. Obviously this is not a working product, its just a simple implementation and tryout. Logo Design by [Allan Holmes](https://github.com/HeyHolmes). \n\n## NOTES\n### holochain command line\n```bash\n# compile\nhc package\n\n# run tests\nhc test\n\n# run holochain (dev) -i: mode (http or websocket), -p: specify on which port\nhc run -i http -p 8888\n\n# run holochain with conductor (to connect multiple nodes):\nholochain -c \u003cpath-to-conductor-config.toml\u003e\nholochain -c conductor-config-alice.toml\n```\n\n### manually test\n```bash\n# \"MANUAL\" WAY OF TESTING\n# run server in http mode (tests make http requests)\nhc run -i http\n# test using npm (navigate to test folder first!)\nnpm start\n```\n\n## basic tests (CURL)\n```bash\n# START APP\nhc run -i http -p 8888\n\n# different http requests\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"id\": \"0\", \"jsonrpc\": \"2.0\", \"method\": \"call\", \"params\": {\"instance_id\": \"test-instance\", \"zome\": \"hello\", \"function\": \"hello_holo\", \"args\": {\"name\": \"Insert Your Name\"} }}' http://127.0.0.1:8888 | jq\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"id\": \"0\", \"jsonrpc\": \"2.0\", \"method\": \"call\", \"params\": {\"instance_id\": \"test-instance\", \"zome\": \"hello\", \"function\": \"generate_rand\", \"args\": {} }}' http://127.0.0.1:8888 | jq\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"id\": \"0\", \"jsonrpc\": \"2.0\", \"method\": \"call\", \"params\": {\"instance_id\": \"test-instance\", \"zome\": \"hello\", \"function\": \"create_message\", \"args\": {\"message\": { \"content\": \"hello world!! first message\"} } }}' http://127.0.0.1:8888 | jq\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"id\": \"0\", \"jsonrpc\": \"2.0\", \"method\": \"call\", \"params\": {\"instance_id\": \"test-instance\", \"zome\": \"hello\", \"function\": \"retrieve_message\", \"args\": {\"address\": \"QmZNDbibhFVMnPDFomEfbsX1PShYjR6aFRoDs4ikxThiNn\" } }}' http://127.0.0.1:8888 | jq\n```\n\n### advanced tests (2 agents)\n```bash\n# start agent 1 (3401)\n# hc run -i http -p 3401 # NOT WORKING\nholochain -c conductor-config-bob.toml\n# start agent 2 (3402)\n# hc run -i http -p 3402 # NOT WORKING\nholochain -c conductor-config-alice.toml\n\n# TESTS-------------------------------------------------------------------------\n# put message in DHT from agent 1 (3401)\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"id\": \"0\", \"jsonrpc\": \"2.0\", \"method\": \"call\", \"params\": {\"instance_id\": \"test-instance\", \"zome\": \"hello\", \"function\": \"create_message\", \"args\": {\"message\": { \"content\": \"hello from port 3401\"} } }}' http://127.0.0.1:3401 | jq\n# =\u003e Qmanzk2aQs73tsyoioidFB9Yww8PwbFYKF8bXJyrbD3x2b\n# retrieve message from agent1 (3401)\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"id\": \"0\", \"jsonrpc\": \"2.0\", \"method\": \"call\", \"params\": {\"instance_id\": \"test-instance\", \"zome\": \"hello\", \"function\": \"retrieve_message\", \"args\": {\"address\": \"Qmanzk2aQs73tsyoioidFB9Yww8PwbFYKF8bXJyrbD3x2b\" } }}' http://127.0.0.1:3401 | jq\n# retrieve message from agent2 (3402)\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"id\": \"0\", \"jsonrpc\": \"2.0\", \"method\": \"call\", \"params\": {\"instance_id\": \"test-instance\", \"zome\": \"hello\", \"function\": \"retrieve_message\", \"args\": {\"address\": \"Qmanzk2aQs73tsyoioidFB9Yww8PwbFYKF8bXJyrbD3x2b\" } }}' http://127.0.0.1:3402 | jq\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcts%2Fholochain-hackathon-barcelona","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcts%2Fholochain-hackathon-barcelona","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcts%2Fholochain-hackathon-barcelona/lists"}