public_key_point_to_eth_address
Converts a public key point to its corresponding Ethereum address.The Ethereum address is calculated by taking the Keccak-256 hash of the public key coordinates and taking the last 20 big-endian bytes. # Argumentspublic_key_point
- A point on a secp256 curve representing a public key # ReturnsThe 20-byte Ethereum address derived from the public key # Examples
use starknet::eth_signature::public_key_point_to_eth_address;
use starknet::secp256k1::Secp256k1Point;
use starknet::secp256_trait::Secp256Trait;
let public_key: Secp256k1Point = Secp256Trait::secp256_ec_get_point_from_x_syscall(
0xa9a02d48081294b9bb0d8740d70d3607feb20876964d432846d9b9100b91eefd, false,
)
.unwrap()
.unwrap();
let eth_address = public_key_point_to_eth_address(public_key);
assert!(eth_address == 0x767410c1bb448978bd42b984d7de5970bcaf5c43.try_into().unwrap());
Fully qualified path: core::starknet::eth_signature::public_key_point_to_eth_address
pub fn public_key_point_to_eth_address<
Secp256Point,
+Drop<Secp256Point>,
+Secp256Trait<Secp256Point>,
+Secp256PointTrait<Secp256Point>,
>(
public_key_point: Secp256Point,
) -> EthAddress