{"id":15636610,"url":"https://github.com/izelnakri/eth","last_synced_at":"2025-04-05T15:05:00.061Z","repository":{"id":24646499,"uuid":"102129748","full_name":"izelnakri/eth","owner":"izelnakri","description":"Ethereum utilities for Elixir","archived":false,"fork":false,"pushed_at":"2023-10-17T13:49:46.000Z","size":408,"stargazers_count":121,"open_issues_count":18,"forks_count":48,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-29T14:07:35.133Z","etag":null,"topics":["blockchain","ethereum","ethereum-transactions","ethereum-wallet","query-engine","rpc"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/izelnakri.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-09-01T15:58:46.000Z","updated_at":"2025-03-10T12:48:54.000Z","dependencies_parsed_at":"2024-10-23T03:51:55.182Z","dependency_job_id":null,"html_url":"https://github.com/izelnakri/eth","commit_stats":{"total_commits":107,"total_committers":10,"mean_commits":10.7,"dds":0.1869158878504673,"last_synced_commit":"dd3ed7a34772865891c640e2000532c7d534ae1f"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izelnakri%2Feth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izelnakri%2Feth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izelnakri%2Feth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izelnakri%2Feth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/izelnakri","download_url":"https://codeload.github.com/izelnakri/eth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353729,"owners_count":20925329,"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","ethereum","ethereum-transactions","ethereum-wallet","query-engine","rpc"],"created_at":"2024-10-03T11:05:27.839Z","updated_at":"2025-04-05T15:05:00.028Z","avatar_url":"https://github.com/izelnakri.png","language":"Elixir","funding_links":[],"categories":["Elixir"],"sub_categories":[],"readme":"[![Hex Version](http://img.shields.io/hexpm/v/eth.svg?style=flat)](https://hex.pm/packages/eth) [![Hex docs](http://img.shields.io/badge/hex.pm-docs-green.svg?style=flat)](https://hexdocs.pm/eth/ETH.html)\n\n# ETH\nThe essential Elixir library for interacting with Ethereum blockchain. You can now create Ethereum wallets, query the blockchain and sign/send transactions, all from Elixir / Erlang Virtual Machine.\n\n## Example\n\n```elixir\n  wallet = ETH.Wallet.create\n  # %{eth_address: \"0x31CF67A272A23C7A11128C97FC3B2F4C13AFD87F\",\n  #   mnemonic_phrase: \"similar bleak naive absorb picnic avoid sponsor canoe inform misery crisp hotel critic have parent couch wrong survey staff primary wet wear velvet horse\",\n  #   private_key: \"C8E2F24A806A422034990C7391B4CEB7133CD3680987FEBB5750555F99F0FC83\",\n  #   public_key: \"04C4AA07F234226CA90FB3E8BB1590D5BEB703E449700FE0B2DF539A948289EA75220CC837CA68F429F3FB3D6677B2D63CF66277888B8209D0B3F3229CE339654C\"}\n\n  specific_private_key = \"9756371A51D7FC25EDFC95A49DEF3806ED34DF2EBCA2065E543369E708C47374\"\n  another_wallet = ETH.Wallet.create(specific_private_key)\n  # %{eth_address: \"0x6A26B49D8046DC5B74D41E29F9A5CA7AD78EEC9B\",\n  #   mnemonic_phrase: \"nuclear random shoot photo lemon base retire naive pig urge sock assist spy hurdle road nephew alien verify art stable identify giraffe soccer mushroom\",\n  #   private_key: \"9756371A51D7FC25EDFC95A49DEF3806ED34DF2EBCA2065E543369E708C47374\",\n  #   public_key: \"04D1F70F6048D1E22FBEBBF3AF462E3356747AB2BB81EC269C600BE6A53C3223472AA336DF0060719C6F3AEC45E40AE57ED39735B61B8F5EF989466D46CA1B72C0\"}\n\n  accounts_in_your_client = ETH.get_accounts\n  # [\"0xfdf5d02f2082753dda0817492d6efff7e76e47aa\",\n  #  \"0xb9906b679aa8edd03fdf7fe396af4d9a77af4108\",\n  #  \"0xae6463bf32efc106ad4300d902e572e1c43e6e9c\",\n  #  \"0xb764c82ae23467be2cf90ab9019ee2464a3946f9\",\n  #  \"0xfc5b5a6cd171f4123439f28fad9986c70572b35f\",\n  #  \"0x7605c8812cfb51a7d2d16e598f521c9302d0ed7f\",\n  #  \"0x7dab29cc88c2ecd69ec216b7d089a82bb95fe1ad\",\n  #  \"0xba3a30f3c4fd2b4a44936b42ceea87ec3e53294a\",\n  #  \"0xb3f4869ce14d6bbd659dc5d2f9a515b58b2765d2\",\n  #  \"0x8c9cec7feacdbbf472ebcc4f61224d83c880896b\"]\n\n  first_account_in_your_client = List.first(accounts_in_your_client)\n  first_account_private_key = \"f121f608500f7e3379c813aa6df62864e35aa0b6cd11a2ff2c20ac84b5771fb2\"\n\n  ETH.get_balance(\"0x31CF67A272A23C7A11128C97FC3B2F4C13AFD87F\") # {:ok, 0} # this account holds no ether\n  ETH.get_balance!(first_account_in_your_client, :wei) # 1.0e20 -\u003e in this example this address holds 100 ether / 1.0e20 wei\n\n  ETH.get_transaction_count(first_account_in_your_client) # {:ok, 0}\n\n  {:ok, tx_hash} = ETH.send_transaction(%{\n    from: first_account_in_your_client, to: wallet[:eth_address], value: 22\n  }, first_account_private_key)\n  # {:ok, \"0x13893d677251ddb9259263490504f3e611a0a7bff23b108641d2cb08b7af21dc\"}\n\n  ETH.get_transaction!(tx_hash)\n  # %{block_hash: \"0xf9917088fc6750677cc1cfb4f7dcab453b21c7de2cb22ed7e6753df058bec5cf\",\n  #   block_number: 1, from: \"0xfdf5d02f2082753dda0817492d6efff7e76e47aa\",\n  #   gas: 21000, gas_price: 20000000000,\n  #   hash: \"0x13893d677251ddb9259263490504f3e611a0a7bff23b108641d2cb08b7af21dc\",\n  #   input: \"0\", nonce: 0, to: \"0x725316bb37d202b0eb203cd83238c31e983a7936\",\n  #   transaction_index: 0, value: 22}\n\n  ETH.get_balance!(first_account_in_your_client) # 99.99958 # in ether\n  ETH.get_balance(wallet[:eth_address], :wei) # {:ok, 22.0} # in wei\n```\n\nWarning: This library uses the Ethereum JSON-RPC under the hood, so you need an ethereum client such as parity/geth or testrpc to use of most of the API.\n\n### Credits\n\n- [Izel Nakri](https://github.com/izelnakri) - I reverse engineered ethereum JavaScript libraries in Elixir so you don't have to.\n\nAdditionally this library wouldnt exist without the libraries below:\n- ExRLP\n- Ethereumex\n- keccakf1600\n- libsecp256k1\n\n#### NOTE:\nTo properly use this package, you will need to run `rebar compile eunit` for [libsecp256k1](https://github.com/exthereum/libsecp256k1).\n\n### TODO:\nEthereum Smart Contracts, small enhancements\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `eth` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:eth, \"~\u003e 0.6.5\"}\n  ]\nend\n```\n\n### Running the tests\n\nInstall a testrpc(now renamed to ganache) to run ethereum locally:\n```npm install -g ganache```\n\nElixir tests automatically spawns and kills the ganache process. All you need to do now is to run the tests in sequence thus --seed 0:\n```mix test --seed 0```\n\nThe docs can be found at [https://hexdocs.pm/eth](https://hexdocs.pm/eth).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizelnakri%2Feth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizelnakri%2Feth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizelnakri%2Feth/lists"}