Etherscan v2.0.2 Etherscan.API.Proxy

Module to wrap Etherscan Geth/Parity proxy endpoints.

Etherscan API Documentation

Link to this section Summary

Functions

Returns the number of most recent block

Executes a new message call immediately without creating a transaction on the block chain

Makes a call or transaction, which won’t be added to the blockchain and returns the used gas, which can be used for estimating the used gas

Returns the current price per gas in wei

Returns information about a block by block number

Returns the number of transactions in a block from a block matching the given block number

Returns code at a given address

Returns the value from a storage position at a given address

Returns information about a transaction by block number and transaction index position

Returns the information about a transaction requested by transaction hash

Returns the number of transactions sent from an address

Returns the receipt of a transaction by transaction hash

Returns information about a uncle by block number

Creates new message call transaction or a contract creation for signed transactions

Link to this section Functions

Link to this function eth_block_number()

Returns the number of most recent block.

Example

iex> Etherscan.eth_block_number()
{:ok, "6196278"}
Link to this function eth_call(to, data)

Executes a new message call immediately without creating a transaction on the block chain.

Example

iex> Etherscan.eth_call("0xAEEF46DB4855E25702F8237E8f403FddcaF931C0", "0x70a08231000000000000000000000000e16359506c028e51f16be38986ec5746251e9724")
{:ok, "0x00000000000000000000000000000000000000000000000000601d8888141c00"}
Link to this function eth_estimate_gas(params)

Makes a call or transaction, which won’t be added to the blockchain and returns the used gas, which can be used for estimating the used gas.

Example

iex> params = %{
  to: "0xf0160428a8552ac9bb7e050d90eeade4ddd52843",
  value: "0xff22",
  gasPrice: "0x051da038cc",
  gas: "0xffffff",
}
iex> Etherscan.eth_estimate_gas(params)
{:ok, <TODO>}
Link to this function eth_gas_price()

Returns the current price per gas in wei.

Example

iex> Etherscan.eth_gas_price()
{:ok, "2100000000"}
Link to this function eth_get_block_by_number(tag)

Returns information about a block by block number.

Example

iex> Etherscan.eth_get_block_by_number("0x10d4f")
{:ok, %Etherscan.ProxyBlock{}}
Link to this function eth_get_block_transaction_count_by_number(tag)

Returns the number of transactions in a block from a block matching the given block number.

Example

iex> Etherscan.eth_get_block_transaction_count_by_number("0x10FB78")
{:ok, "3"}
Link to this function eth_get_code(address, tag)

Returns code at a given address.

Example

iex> Etherscan.eth_get_code("0xf75e354c5edc8efed9b59ee9f67a80845ade7d0c", "latest")
{:ok, "0x3660008037602060003660003473273930d21e01ee25e4c219b63259d214872220a261235a5a03f21560015760206000f3"}
Link to this function eth_get_storage_at(address, position)

Returns the value from a storage position at a given address.

Example

iex> Etherscan.eth_get_storage_at("0x6e03d9cce9d60f3e9f2597e13cd4c54c55330cfd", "0x0")
{:ok, "0x0000000000000000000000003d0768da09ce77d25e2d998e6a7b6ed4b9116c2d"}
Link to this function eth_get_transaction_by_block_number_and_index(tag, index)

Returns information about a transaction by block number and transaction index position.

Example

iex> Etherscan.eth_get_transaction_by_block_number_and_index("0x10d4f", "0x0")
{:ok, %Etherscan.ProxyTransaction{}}
Link to this function eth_get_transaction_by_hash(transaction_hash)

Returns the information about a transaction requested by transaction hash.

Example

iex> transaction_hash = "0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1"
iex> Etherscan.eth_get_transaction_by_hash(transaction_hash)
{:ok, %Etherscan.ProxyTransaction{}}
Link to this function eth_get_transaction_count(address)

Returns the number of transactions sent from an address.

Example

iex> Etherscan.eth_get_transaction_count("0x2910543af39aba0cd09dbb2d50200b3e800a63d2")
{:ok, 44893}
Link to this function eth_get_transaction_receipt(transaction_hash)

Returns the receipt of a transaction by transaction hash.

Example

iex> transaction_hash = "0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1"
iex> Etherscan.eth_get_transaction_receipt(transaction_hash)
{:ok, %Etherscan.ProxyTransactionReceipt{}}
Link to this function eth_get_uncle_by_block_number_and_index(tag, index)

Returns information about a uncle by block number.

Example

iex> Etherscan.eth_get_uncle_by_block_number_and_index("0x210A9B", "0x0")
{:ok, %{"number" => "0x210a99", ...}}
Link to this function eth_send_raw_transaction(hex)

Creates new message call transaction or a contract creation for signed transactions.

Replace the hex value with your raw hex encoded transaction that you want to send.

Example

iex> Etherscan.eth_send_raw_transaction("0xf904808000831cfde080")
{:ok, <TODO>}