Skip to main content

pubkey

Macro pubkey 

Source
pubkey!() { /* proc-macro */ }
Expand description

Converts a 66-character hex string to a 33-byte [PublicKey] at compile time.

The first two hex characters must be a valid XRPL public key prefix: 02 or 03 (secp256k1) or ED (Ed25519). The prefix check is case-insensitive — ed is accepted and normalised. Any other prefix, wrong length, or non-hex characters are compile errors.

§Example

use xrpl_wasm_stdlib::pubkey;
use xrpl_wasm_stdlib::core::types::public_key::PublicKey;

const KEY: PublicKey =
    pubkey!("02C7387FFC25C156CA7F8A6D760C8D01EF642CEE9CE4680C33FFB3FF39AFECFE70");