-
Notifications
You must be signed in to change notification settings - Fork 1
ss58toH160 incorrect #7
Copy link
Copy link
Open
Description
the result should have a keccak256 bytes of the public key
export function ss58ToH160(accountSS58Address: string): string {
// Decode the SS58 address to a Uint8Array public key
const publicKey = decodeAddress(accountSS58Address);
// Step 2: Hash with keccak256
const hashed = keccak256(publicKey); // hex string (0x-prefixed, 64 chars)
// Step 3: Take last 20 bytes (40 hex characters)
const ethAddress = "0x" + hashed.slice(-40); // Ethereum H160 address
console.log("Ethereum-style address:", ethAddress);
return ethAddress;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels