EthWallet (eth_wallet v0.0.10)
Documentation for EthWallet
.
- keys operations
- 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
Functions
build transaction
decrypt key with password.
encrypt key with password.
generate keys with/without privkey.
iex> EthWallet.generate_keys(<<21, ..., 166>>)
sign transaction
signed transaction to raw transaction
Link to this section Functions
build_tx(to_str, value, data, nonce, gas_price, gas_limit)
Specs
build transaction
decrypt_key(payload, password)
decrypt key with password.
## Examples
iex> EthWallet.decrypt_key(payload, "bbc")
"ddd"
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>>
generate_keys()
generate keys with/without privkey.
## Examples
iex> EthWallet.generate_keys()
%{
addr: "0xd705f740d934acfb27df7bf71aadc00f20d03c7a",
priv: <<21, ..., 166>>,
pub: <<4, ..., 165, ...>>
}
generate_keys(priv)
Specs
iex> EthWallet.generate_keys(<<21, ..., 166>>)
%{
addr: "0xd705f740d934acfb27df7bf71aadc00f20d03c7a",
priv: <<21, ..., 166, ...>>,
pub: <<4, ..., 165, ...>>
}
sign_msg(msg, privkey)
Specs
sign_tx(tx, private_key, chain_id \\ nil)
Specs
sign_tx(EthWallet.Transaction.t(), binary(), integer() | nil) :: EthWallet.Transaction.t()
sign transaction
signed_tx_to_raw_tx(signed_tx)
Specs
signed_tx_to_raw_tx(EthWallet.Transaction.t()) :: String.t()
signed transaction to raw transaction