Public Key From Private

This example demonstrates how to extract a public key from a private key

public void PublicKeyFromPrivate()
{
    // Load private key
    var keys = PhantasmaKeys.FromWIF("PK_in_WIF_format");

    // Or
    // var keys = new PhantasmaKeys(Base16.Decode("PK_in_HEX_format"));

    // Log the address and corresponding public key in base16 format
    Debug.Log($"[PublicKey] Address: {keys.Address.Text}, Public Key: {Base16.Encode(keys.PublicKey)}");
}

Last updated