Function isChecksumWif

  • Checks if the checksum of an private key WIF is correct.

    The private key WIF has 3 parts in this order:

    • prefix: 1 byte
    • private key: 32 bytes
    • compressed: 1 byte for compressed public key (no byte for uncompressed)
    • checksum: 4 bytes

    checks:

    • It must use version 0x80 in the prefix
    • If the corresponding public key is compressed the byte 33 must be 0x01
    • checksum = first 4 bytes of sha256(sha256(prefix + private key + compressed))

    See Bitcoin WIF.

    Parameters

    • wif: string | Uint8Array

    Returns boolean

Generated using TypeDoc