MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / public_key_address

Function public_key_address

utils/src/crypto.rs:109–111  ·  view source on GitHub ↗

Convert a public key into an address using the last 20 bytes of the hash ```rust use utils::crypto::{keypair, public_key_address}; let (private_key, public_key) = keypair(); let address = public_key_address(&public_key); ```

(key: &PublicKey)

Source from the content-addressed store, hash-verified

107/// let address = public_key_address(&public_key);
108/// ```
109pub fn public_key_address(key: &PublicKey) -> H160 {
110 to_address(&key.serialize_uncompressed())
111}
112
113/// Convert a private key into an address using the last 20 bytes of the hash
114///

Callers 6

verifyMethod · 0.85
recover_addressMethod · 0.85
private_key_addressFunction · 0.85
recover_addressFunction · 0.85

Calls 1

to_addressFunction · 0.85