{"id":13561295,"url":"https://github.com/cmditch/elm-ethereum","last_synced_at":"2025-05-10T20:33:11.393Z","repository":{"id":22545714,"uuid":"96652343","full_name":"cmditch/elm-ethereum","owner":"cmditch","description":"dApps in Elm","archived":false,"fork":false,"pushed_at":"2023-01-04T00:53:11.000Z","size":13555,"stargazers_count":148,"open_issues_count":25,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-09T17:04:30.155Z","etag":null,"topics":["elm","elm-lang","ethereum","ethereumjs","functional-programming","web3","web3js"],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/cmditch/elm-ethereum/1.0.1/","language":"Elm","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/cmditch.png","metadata":{"files":{"readme":"README.md","changelog":"changelog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-09T00:46:41.000Z","updated_at":"2025-02-22T01:48:23.000Z","dependencies_parsed_at":"2022-09-02T15:01:34.585Z","dependency_job_id":null,"html_url":"https://github.com/cmditch/elm-ethereum","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmditch%2Felm-ethereum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmditch%2Felm-ethereum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmditch%2Felm-ethereum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmditch%2Felm-ethereum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmditch","download_url":"https://codeload.github.com/cmditch/elm-ethereum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253292124,"owners_count":21885037,"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":["elm","elm-lang","ethereum","ethereumjs","functional-programming","web3","web3js"],"created_at":"2024-08-01T13:00:54.599Z","updated_at":"2025-05-09T17:04:51.035Z","avatar_url":"https://github.com/cmditch.png","language":"Elm","funding_links":[],"categories":["Roadmap","Elm","Dapps development"],"sub_categories":["APIs / subproviders"],"readme":"# [![elm-ethereum](https://cmdit.ch/images/elm-ethereum-logo.svg)](https://github.com/cmditch/elm-ethereum) elm-ethereum\n\n**Examples:**  \n[Simple starter example](https://github.com/cmditch/elm-ethereum/tree/master/examples/simple/src/Main.elm)  \n[Complex example SPA Dapp](https://github.com/cmditch/elm-ethereum/tree/master/examples/complex) \n\nCool Feature:  See [here](https://github.com/cmditch/elm-ethereum/blob/master/examples/simple/src/Main.elm#L138) how you can easily track the block depth of transactions after they've been mined.\n\n-----------------------\n\nThis library allows you to interact with the Ethereum blockchain much like `purescript-web3`, `ethers.js`, or `web3.js`.\nYou can hook into web wallets like MetaMask and send transactions, as well as perform read-only operations on smart contracts.\n\nSee [why elm?](#why-elm)\n\n## Setup\n\n- **Setup** and define your node endpoint.\n\n```elm\n    import Eth\n    import Eth.Types exposing (..)\n\n\n    type alias Model =\n        { ethNode : HttpProvider }\n\n    init =\n        { ethNode = \"https://mainnet.infura.com/\" }\n```\n\n  It's good to keep the node url in your model. This way it can be kept in sync with MetaMask.\n  Example code of this \"sync\" pattern to come.\n\n## Examples\n\n- **Simple** - Look at the blockchain\n\n    Get an account balance at a specific block height.\n\n```elm\n    getMyBalanceInHistory : Int -\u003e Task Http.Error BigInt\n    getMyBalanceInHistory blockNum =\n        Eth.getBalanceAtBlock model.ethNode myAddress (BlockNum blockNum)\n```\n\n- **Advanced** - Chain tasks together\n\n    Get all newly created contract addresses in the latest block. In a few lines of code.  \n\n```elm\n    findNewestContracts : Task String (List Address)\n    findNewestContracts =\n        Eth.getBlockNumber model.ethNode\n            |\u003e Task.andThen (Eth.getBlock model.ethNode)\n            |\u003e Task.andThen\n                (\\block -\u003e\n                    block.transactions\n                        |\u003e List.map (Eth.getTxReceipt model.ethNode)\n                        |\u003e Task.sequence\n                )\n            |\u003e Task.map (MaybeExtra.values \u003c\u003c List.map .contractAddress)\n            |\u003e Task.mapError prettifyHttpError\n```  \n\nThis is an example of [Railway Oriented Programming](https://fsharpforfunandprofit.com/rop/). A [great video](https://vimeo.com/113707214) by Scott Wlaschin.  \n\n## Why Elm\n\nI'd sum up the experience of programming in Elm with two words: **Fearless Refactoring**\n\nThis is by no means the only pleasantry the fine tree has to offer.\n\nElm's claim to fame is zero runtime exceptions. It's compiler and static types are your best friends. Both from an error catching standpoint, but just as importantly, from a domain modeling standpoint.  \n\n**Union Types** allow you to fully leverage the compiler when modeling your business domain. See [BlockId](http://package.elm-lang.org/packages/cmditch/elm-ethereum/latest/Eth-Types#BlockId) or [NetworkId](http://package.elm-lang.org/packages/cmditch/elm-ethereum/latest/Eth-Net#NetworkId) for instance.  \n\nUnion types also allow you to hide implementation details by implementing \"opaque types\".  An [Address](https://github.com/cmditch/elm-ethereum/blob/master/src/Internal/Types.elm#L4) is just a string under the hood, but you can never directly touch that string.\n\n### Why else\n\n- **Simplicity and cohesion**\n\n```text\n    Javascript                    Elm\n    ---------------------------------\n    npm/yarn                 built in\n    Webpack                  built in\n    React                    built in\n    Redux                    built in\n    Typescript/Flow          built in\n    Immutable.JS             built in\n```\n\n- **Phenomenal tooling and resources**\n\n     [**Time traveling debugger**](http://elm-lang.org/blog/the-perfect-bug-report) - Import/Export history. QA like a champ.  \n     [**elm-format**](https://github.com/avh4/elm-format) - Adds up to hours of tedius \"work\" saved.  \n     [**elm-reactor**](https://github.com/elm-lang/elm-reactor) - Nice dev server.  \n     [**elm-test**](http://package.elm-lang.org/packages/elm-community/elm-test/latest) - Fuzz testing == legit.  \n     [**elm-benchmark**](http://package.elm-lang.org/packages/BrianHicks/elm-benchmark/latest) - Clone this package and give it a whirl.  \n     [**Elm Package and Docs**](http://package.elm-lang.org/) - Pleasant and consistent. Enforced semantic versioning.  \n\n- **Strong static types**\n\n     Find errors fast with readable compiler messages.  \n     Less [millions of dollars lost](https://twitter.com/a_ferron/status/892350579162439681?lang=en) from typos.\n\n- **No null or undefined**\n\n     Never miss a potential problem.\n\n- **Purely functional**\n\n     Leads to decoupled and easily refactorable code.\n\n- **Great Community**\n\n     Thoughtful, responsive, intelligent, and kind.  \n     Great [Slack](https://elmlang.herokuapp.com/) and [Discourse](https://discourse.elm-lang.org/).\n\n## Contributing\n\nPull requests and issues are greatly appreciated!  \nIf you think there's a better way to implement parts of this library, I'd love to hear your feedback.\n\n\n###### Feed the tree some ether\n### 🌳Ξ🌳Ξ🌳\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmditch%2Felm-ethereum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmditch%2Felm-ethereum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmditch%2Felm-ethereum/lists"}