{"id":13687637,"url":"https://github.com/aviaviavi/legion","last_synced_at":"2025-12-29T23:44:28.745Z","repository":{"id":148236642,"uuid":"88019497","full_name":"aviaviavi/legion","owner":"aviaviavi","description":"Simple blockchain server written in Haskell for educational purposes","archived":false,"fork":false,"pushed_at":"2018-03-01T08:19:04.000Z","size":34,"stargazers_count":601,"open_issues_count":0,"forks_count":38,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-12T10:46:49.667Z","etag":null,"topics":["blockchain","haskell","peer-network"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/aviaviavi.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}},"created_at":"2017-04-12T06:51:49.000Z","updated_at":"2024-09-10T03:38:21.000Z","dependencies_parsed_at":"2023-05-19T12:15:27.609Z","dependency_job_id":null,"html_url":"https://github.com/aviaviavi/legion","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aviaviavi%2Flegion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aviaviavi%2Flegion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aviaviavi%2Flegion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aviaviavi%2Flegion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aviaviavi","download_url":"https://codeload.github.com/aviaviavi/legion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251881592,"owners_count":21659126,"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","haskell","peer-network"],"created_at":"2024-08-02T15:00:57.876Z","updated_at":"2025-12-29T23:44:28.708Z","avatar_url":"https://github.com/aviaviavi.png","language":"Haskell","funding_links":[],"categories":["Haskell"],"sub_categories":[],"readme":"# Legion - a simple blockchain implementation\n\n[![Build Status](https://travis-ci.org/aviaviavi/legion.svg?branch=master)](https://travis-ci.org/aviaviavi/legion)\n\nAn as-simple-as-possible blockchain server inspired by [naivechain](https://github.com/lhartikk/naivechain), but written in Haskell. Spinning up several\nLegion nodes creates a peer to peer network that syncronizes the block chain across the network. \n\nPrereqs: To compile from source, you'll need [stack](https://docs.haskellstack.org/en/stable/README/).\n\nAlternatively, you can get a precompiled [pre-release binary](https://github.com/aviaviavi/legion/releases). Note: if you download the binary\nfrom github, you'll need to mark it executable by running:\n```\n$ chmod +x legion-exe\n```\n\n### Usage:\n\n```\n$ stack exec legion-exe [http port] [p2p port] [optional: `seedhost:seedP2PPort`]\n\n```\n\n### Examples:\n\n```\n$ stack exec legion-exe 8001 9001\n```\nBy default, legion will log what it's doing to standard out. In another terminal window:\n```\n$ stack exec legion-exe 8002 9002 localhost:9001\n```\n\nAlternatively, you grab the binaries from the github releases, and run that directly rather than via `stack exec`\n\nThe 3rd argument tells the node where a seed node can be found to bootstrap the connection to the\npeer to peer network. The current state of the (valid) blockchain will be fetched from all servers, and it will automatically\nkeep itself updated and post its own updated to others.\n\nNow that 2 nodes are now synced, and you can view the current chain from either node at http://localhost:$httpPort/chain, eg http://localhost:8001/chain\n\nAdd a new block to the blockchain via a POST request to /block:\n\n```\n$ curl -H \"Content-Type: application/json\" -X POST -d '{\"blockBody\": \"this is the data for the next block\"}' http://localhost:8001/block\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faviaviavi%2Flegion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faviaviavi%2Flegion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faviaviavi%2Flegion/lists"}