Skip to main content

Generating an Ethereum address

Advanced
Ethereum

On Ethereum, there are two types of addresses: wallet addresses for holding assets and contract addresses. Wallet addresses are public accounts that can send and receive ETH tokens. Contract addresses refer to a smart contract that has been executed on Ethereum and the transactions associated with that contract.

Wallet and contract addresses can be queried using the EVM RPC canister.

Canister ETH addresses

To create an ETH address for your canister, first you will need to obtain an ECDSA public key associated with your canister. You can get this key by calling the ecdsa_public_key API method of the management canister:

motoko/threshold-ecdsa/src/ecdsa_example_motoko/main.mo
loading...

Then, convert the public key bytes to an Ethereum address. An example in Rust can be found below:

packages/ic-evm-utils/src/evm_signer.rs
loading...

Resources

You can use this address to make Ethereum transactions from your canister.

Learn how to sign Ethereum transactions.