{"id":26940490,"url":"https://github.com/darren277/haskell-blockchain","last_synced_at":"2026-04-29T17:34:44.556Z","repository":{"id":269487333,"uuid":"780590642","full_name":"darren277/haskell-blockchain","owner":"darren277","description":"A simple blockchain written in Haskell along with a Haskell web server for interacting with it along with Postgres interactivity.","archived":false,"fork":false,"pushed_at":"2025-02-28T12:39:50.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T19:00:23.157Z","etag":null,"topics":["blockchain","functional-programming","haskell","postgres"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darren277.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-04-01T19:42:11.000Z","updated_at":"2025-02-28T12:41:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"46ce7f05-c4c5-4262-8107-cab41bd5935e","html_url":"https://github.com/darren277/haskell-blockchain","commit_stats":null,"previous_names":["darren277/haskell-blockchain"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darren277%2Fhaskell-blockchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darren277%2Fhaskell-blockchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darren277%2Fhaskell-blockchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darren277%2Fhaskell-blockchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darren277","download_url":"https://codeload.github.com/darren277/haskell-blockchain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246837628,"owners_count":20841906,"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","functional-programming","haskell","postgres"],"created_at":"2025-04-02T15:18:49.040Z","updated_at":"2026-04-29T17:34:39.524Z","avatar_url":"https://github.com/darren277.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Haskell Blockchain\n\n## About\n\nThis is an experimental project for me to learn Haskell a little bit better.\n\nThe use case is a very simple blockchain along with a web server for interacting with it along with Postgres interactivity.\n\n## Directory Structure\n\nHere's a suggested directory structure:\n```\nhaskell-blockchain/\n├── app/\n│   └── Main.hs\n├── src/\n│   └── Blockchain.hs\n|   └── Web.hs\n├── test/\n│   └── Spec.hs\n├── haskell-blockchain.cabal\n├── stack.yaml\n└── Setup.hs\n```\n\n`app/Main.hs`: The entry point of your application. It will import your blockchain module from src/ and run the main application logic.\n`src/Blockchain.hs`: Contains the blockchain logic, including data structures and functions for creating and manipulating the blockchain.\n`src/Web.hs`: Contains the REST Web API for interacting with our blockchain.\n`test/Spec.hs`: For any tests you want to write using a framework like Hspec.\n`haskell-blockchain.cabal`: Cabal file describing your application's properties, dependencies, and build information.\n~~`stack.yaml`: (Optional) If you're using Stack, this file will configure the project's stack tool settings.~~\n`Setup.hs`: Used by Cabal, typically a boilerplate file for simple projects.\n\n## Initializing the Project (Done)\n\nYou can initialize the project using either Cabal or Stack. These tools help manage dependencies, build processes, and package configurations.\n\n### Using Cabal\nInstall GHC and Cabal if you haven't already.\nNavigate to your project directory and run:\n`cabal init`\n\nFollow the interactive prompts to set up your project. You can choose the executable type when prompted, as this project is an application.\nAdd your dependencies to the generated .cabal file. For this project, you might need base, time, and cryptonite for cryptographic functions.\n\n### Using Stack\nInstall Stack if you haven't already.\nNavigate to project directory and run:\n`stack new haskell-blockchain simple`\n\nThis command creates a new project using the \"simple\" template.\nUpdate the stack.yaml and haskell-blockchain.cabal files with your project's dependencies.\n\n## Building and Running the Project\n\n### Using Cabal\n\nBuild project:\n`cabal build`\n\nRun project:\n`cabal run`\n\n### ~~Using Stack~~\n\n~~Build project:~~\n~~`stack build`~~\n\n~~Run project:~~\n~~`stack exec haskell-blockchain-exe`~~\n~~`stack run`~~\n\nReplace haskell-blockchain-exe with the name of your executable defined in the Cabal file if you are using a different name.\n\n## Assorted Notes\n\n### Cautionary Tales\n\nDependency conflicts can be particularly brutal with Haskell.\n\nAfter a whole lot of trial and error (mostly error) with `stack`, I would up switching to `cabal`.\n\nEven with `cabal`, I went through a few learning lessons to get things off the ground.\n\nOne thing to take note of: The `build-depends` sections of both the `library` and `executable` have to match. I spent way too much time trying to figure out why some of my dependencies simply were not being recognized.\n\nAlso, take note of some of the CLI commands in the following section in case you need to use a specific version of GHC, etc.\n\n### Some CLI Commands\n\n```shell\nstack exec -- ghc-pkg list\n\nstack setup --resolver ghc-8.8.4\n\n$env:GHC_PACKAGE_PATH = \"C:\\Users\\Darren\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-9.10.1\\lib\\package.conf.d\"\necho $env:GHC_PACKAGE_PATH\n\n#### To unset:\n$env:GHC_PACKAGE_PATH=\"\"\n\nstack exec -- cabal init\n```\n\n```shell\nghcup install ghc 8.8.4\nghcup set ghc 8.8.4\n$env:PATH = \"C:\\ghcup\\bin;\" + $env:PATH\n```\n\n## Testing\n\n`cabal repl`\n`:l src/Database.hs`\n`:t Envy.envMaybe \"PG_PORT\"`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarren277%2Fhaskell-blockchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarren277%2Fhaskell-blockchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarren277%2Fhaskell-blockchain/lists"}