Ethex.Web3.Wallet (Ethex v1.1.1)
View SourceWallet
Summary
Functions
@spec create(binary()) :: %Ethex.Web3.Wallet{ eth_address: term(), mnemonic_phrase: term(), private_key: term(), public_key: term() }
Create wallet or import from private key.
Example
iex(1)> Ethex.create_wallet
%Ethex.Web3.Wallet{
private_key: "58d4475ecd42f9be425b28866374741db82dd6b71cfb0eb54bb1a09ff85ca87b",
public_key: "04d179509d453e1d401850c1dc4ba16541487dd22565747ccde722312802e05c3b4f39375891a711f05aa93f56da130eed164efa10620a9a45390b66046862653b",
eth_address: "0x2dc3c3ce6901ab9be01379d374d58c1eb0fc7a85",
mnemonic_phrase: "flee peasant stumble once convince tennis annual govern major brick brown derive lizard twice symbol panda attitude prevent unaware donkey zebra comic peanut lazy"
}
iex(2)> Ethex.create_wallet "58d4475ecd42f9be425b28866374741db82dd6b71cfb0eb54bb1a09ff85ca87b"
%Ethex.Web3.Wallet{
private_key: "58d4475ecd42f9be425b28866374741db82dd6b71cfb0eb54bb1a09ff85ca87b",
public_key: "04d179509d453e1d401850c1dc4ba16541487dd22565747ccde722312802e05c3b4f39375891a711f05aa93f56da130eed164efa10620a9a45390b66046862653b",
eth_address: "0x2dc3c3ce6901ab9be01379d374d58c1eb0fc7a85",
mnemonic_phrase: "flee peasant stumble once convince tennis annual govern major brick brown derive lizard twice symbol panda attitude prevent unaware donkey zebra comic peanut lazy"
}
@spec get_private_key() :: binary()
Generate private key
Example
iex(2)> Ethex.Web3.Wallet.get_private_key
<<207, 228, 100, 110, 23, 247, 233, 255, 88, 87, 82, 9, 91, 99, 158, 96, 34, 4,
80, 197, 207, 233, 111, 200, 254, 152, 148, 230, 93, 78, 135, 57>>