NAME

Monero::Keys - module to generate Monero cryptocurrency compatible keys. Monero pulic key generation algorithm varies from standard Ed25519.

SYNOPSIS

use Monero::Keys;

my $keys;
do {
    my $seed = random_32_bytes();
    $keys = Monero::Keys::generate_keys($seed);
} while (!defined($keys));
printf ("Spend Private key:%s \n", unpack('H*', $keys->{spend_pk}));
printf ("Spend Public key:%s \n", unpack('H*', $keys->{spend_pub}));
printf ("View Private key:%s \n", unpack('H*', $keys->{view_pk}));
printf ("View Public key:%s \n", unpack('H*', $keys->{view_pub}));

DESCRIPTION

This function generates Monero compatible keys from 32 bytes seed. The valid private keys in monero should less than L (L is 2^252 + 27742317777372353535851937790883648493). So private key = mod(seed, L). In case of seed is multiple of L, the function will return undef. In that case try another seed. The seed should be cryptographically secure random 32 bytes.

SEE ALSO

This module uses XS code from Crypt::PK::Ed25519 for point generation. It also uses sc_reduce32 function from Monero codebase for mod L operation.

AUTHOR

Denys Fisher, <shmakins at gmail dot com>

COPYRIGHT AND LICENSE

Copyright (C) 2025 by Denys Fisher

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.34.1 or, at your option, any later version of Perl 5 you may have available.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 189:

Unknown directive: =item1