alisinabh

alisinabh

Ethers - a comprehensive Web3 library for interacting with smart contracts on Ethereum using Elixir

Hello Elixir community!

I am excited to announce the release of a new Elixir library for interacting with the Ethereum blockchain: Ethers!

Ethers is heavily inspired by the popular ethers.js library and aims to provide a comprehensive and easy-to-use solution for Elixir developers working with Ethereum smart contracts. With Ethers, you can effortlessly interact with Ethereum contracts using automatically generated Elixir modules, complete with documentation and type-specs.

Here are some of the key features that differentiate Ethers from other Ethereum Clients.

  • Compile-time contract ABI to Elixir module conversion. This means it is faster in runtime and easier to use than other libraries like exw3
  • Out of the box support for standard contract interfaces such as ERC20, ERC721, ERC1155 and ERC777
  • Easy contract function calling and transaction sending
  • Simple log fetching and event filter creation
  • Developer first experience with typespecs and generated documentation
  • Portable RPC modules (Want to use a different RPC or want to add a feature to the RPC? You can swap it with your own)

Right now this is considered beta-testing release. I would encourage and also ask everybody who is interested to interact with and test Ethers. Did I mentioned that contribution is really welcomed?

Happy coding!

GitHub: alisinabh/elixir_ethers
Hex: ethers
Hexdocs

Most Liked

alisinabh

alisinabh

Ethers version 0.0.1 of Ethers is now published on hex.pm/packages/ethers.

This initial beta version is now shipped with the following functionalities.

  • Contract function generation during compile time from ABIs.
  • Ability to deploy a contract with its byte-code and constructor.
  • Common contract interfaces like ERC20, ERC721, ERC777 and ERC1155. (built-ins)
  • ENS and other name services resolve functionality and contracts.
  • Implicit type conversion and common type utility functions.

Feel free to give it a try and file your issues in github or your suggestions here.

alisinabh

alisinabh

Ethers 0.2.0 is out. This version adds new features which helps users to sign transactions locally, with JSON RPC endpoints or even bring their own signer implementation (e.g. using AWS KMS or proprietary HSM modules).

Please feel free to try it out and share your feedback.

Thanks!

alisinabh

alisinabh

By default on EVM chains when you issue a getLogs call you get logs from the last block only. You need to specify fromBlock and toBlock values. (Example below)

{:ok, current_block} = Ethers.current_block_number()
Ethers.get_logs!(
  filter, 
  fromBlock: current_block_number - 128, 
  toBlock: current_block_number
)

I can see there is a gap in the docs regarding these parameters. Will create an issue to track and fix this.

Thank you for introducing W3WS to me. Didn’t know about that!

alisinabh

alisinabh

Elixir Ethers 0.6.x Release

I’m thrilled to announce that Ethers 0.6 has been released.

This release contains long-awaited features such as raw Transaction decoding, native CCIP read support, improved ENS (Ethereum Name Service) support, and more.

Under the hood, it includes a refactored extensible Transaction module, which will make supporting more transaction types (e.g. EIP-4844) easier.

Version 0.6 has a few breaking changes, but for most typical use cases, it should not cause any major issues.

0.6.0 Changelog

Breaking Changes

  • Removed Ethers.Transaction struct and replaced with separate EIP-1559 and Legacy transaction structs for improved type safety
  • Deprecated Ethers.Transaction.from_map/1 - use Ethers.Transaction.from_rpc_map/1 instead for RPC response parsing
  • Deprecated Ethers.Utils.maybe_add_gas_limit/2 - gas limits should now be set explicitly
  • Changed input format requirements: All inputs to Ethers functions must use native types (e.g., integers) instead of hex strings encoded values
  • Removed auto-gas estimation from send_transaction calls
  • tx_type option in transaction overrides has been replaced with type, now requiring explicit struct modules (e.g. Ethers.Transaction.Eip1559, Ethers.Transaction.Legacy)
  • Moved Ethers.Transaction.calculate_y_parity_or_v/1 to Ethers.Transaction.Signed module
  • Deprecate Ethers.send/2 in favor of Ethers.send_transaction/2 for clarity and prevent collision with Kernel.send/2.

New features

  • Added EIP-3668 CCIP-Read support via Ethers.CcipRead module for off-chain data resolution
  • Extended NameService to handle off-chain and cross-chain name resolution using CCIP-Read protocol
  • Introduced Ethers.Transaction.Protocol behaviour for improved transaction handling
  • Added dedicated EIP-1559 and Legacy transaction struct types with validation
  • New address utilities: Ethers.Utils.decode_address/1 and Ethers.Utils.encode_address/1
  • Added Transaction.decode/1 to decode raw transactions

Enhancements

  • Improved error handling and reporting in Ethers.deploy/2
  • Enhanced NameService with ENSIP-10 wildcard resolution support
  • Use checksum addresses when decoding transactions
  • Add bang versions of Ethers top module functions which were missing

Please feel free to open issues, reply here or in Elixir’s #ethereum slack channel if you face any issues.

Where Next?

Popular in Libraries Top

Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
mbuhot
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs. Generate and serve a JSON Open API ...
New
achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
benlime
I created a new library GitHub - benvp/ex_cva: Class Variance Authority for Elixir which aims to make it very easy to define different va...
New
aditya7iyengar
Rummage.Ecto and Rummage.Phoenix provide ways to perform Searching, Sorting and Pagination over Ecto queries and Phoenix collections. Fo...
New
alisinabh
Hey everyone i’ve developed a library for Jalaali calendar for elixir which supports converting Gregorian dates to Jalaali and vice vers...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
engineeringdept
I’ve just released the first version of Snap, an Elasticsearch client. It borrows ideas about application structure and process managemen...
New
Qqwy
While not as prevalent as in imperative languages, arrays (collections with efficient random element access) are still very useful in Eli...
New
vic
Expat is a tiny experiment I did for extracting patterns and being able to reuse them (compose and share patterns between elixir librarie...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Sub Categories:

We're in Beta

About us Mission Statement