Skip to content

ss58toH160 not correct #1

@Imdavyking

Description

@Imdavyking

export function ss58ToH160(accountSS58Address: string): Binary {
// 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

return new Binary(ethers.getBytes(ethAddress));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions