EthWallet (eth_wallet v0.0.9)

Documentation for EthWallet.

    1. keys operations
    1. generate signed tx

    tx generated path: build_tx -> hash_for_signing(serialize -> rlp encode -> kec) -> gen sig -> get signed tx -> to raw tx-> send tx to node

Link to this section Summary

Link to this section Functions

Link to this function

build_tx(to_str, value, data, nonce, gas_price, gas_limit)

Specs

build_tx(String.t(), integer(), binary(), integer(), integer(), integer()) ::
  Transction.t()

build transaction

Link to this function

decrypt_key(payload, password)

decrypt key with password.

## Examples

iex> EthWallet.decrypt_key(payload, "bbc")

"ddd"

Link to this function

encrypt_key(encrypted_key, password)

encrypt key with password.

## Examples

iex> EthWallet.encrypt_key("ddd", "abc")

<<40, 28, 220, 122, 235, 180, 216, 145, 142, 171, 53, 146, 25, 136, 47, 215>>

Link to this function

generate_keys()

generate keys with/without privkey.

## Examples

iex> EthWallet.generate_keys()

%{

addr: "0xd705f740d934acfb27df7bf71aadc00f20d03c7a",
priv: <<21, ..., 166>>,
pub: <<4, ..., 165, ...>>

}

Link to this function

generate_keys(priv)

Specs

generate_keys(binary()) :: map()

iex> EthWallet.generate_keys(<<21, ..., 166>>)

%{

addr: "0xd705f740d934acfb27df7bf71aadc00f20d03c7a",
priv: <<21, ..., 166, ...>>,
pub: <<4, ..., 165, ...>>

}

Link to this function

sign_msg(msg, privkey)

Specs

sign_msg(binary(), binary()) :: binary()

See EthWallet.Utils.Crypto.sign_msg/2.

Link to this function

sign_tx(tx, private_key, chain_id \\ nil)

Specs

sign transaction

Link to this function

signed_tx_to_raw_tx(signed_tx)

Specs

signed_tx_to_raw_tx(EthWallet.Transaction.t()) :: String.t()

signed transaction to raw transaction

Link to this function

verify_msg_sig(msg, sig, privkey)

Specs

verify_msg_sig(binary(), binary(), binary()) :: boolean()

See EthWallet.Utils.Crypto.verify_msg_sig/3.