Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 736 Bytes

Getting Started.md

File metadata and controls

36 lines (25 loc) · 736 Bytes

Getting started

Web3 can be installed from the package manager hex as follows.

  1. Add web3 to your list of dependencies in mix.exs:

    def deps do
      [{:web3, "~> 0.1.6"}]
    end
  2. Fetch mix dependencies:

    $ mix deps.get
  3. Define a Application module for your app.

    defmodule MyApp.Application do
      use web3, rpc_endpoint: "<PATH_TO_RPC_ENDPOINT>"
    end
  4. Then you can use the following APIs

    • Infura Eth Method of the same name: Eth API.
    • Includes a number of convenient utility functions: Base API.
    iex> MyApp.Application.eth_blockNumber
    {:ok, 15034908}