Bitcoin::Crypto::PublicKey - class for Bitcoin public keys
use Bitcoin::Crypto::PublicKey; # verify signature (it has to be byte string, see perlpacktut) $pub->verifyMessage("Hello world", $sig); # getting address from public key (p2pkh) my $address = $pub->getAddress();
This class allows you to create a public key instance.
You can use a public key to:
read from and export to byte / hexadecimal string
verify messages
create p2pkh address
This class doesn't:
create any addresses other than p2pkh (yet)
Use these methods to create a PublicKey instance. All take single string argument with public key data. Returns class instance.
Takes a single argument which must be instance of Crypt::PK::ECC. This allows you to use raw Crypt::PK::ECC methods to create key on your own.
Change key's compression state to $val (1/0). This will change the Address generated by public key.
Change key's network state to $val. It can be either network name present in Bitcoin::Crypto::Network package or a valid network hashref. This will enable generation of this network's addresses.
Returns string containing Base58Check encoded public key hash (p2pkh address)
Verifies $signature against digest of $message (with $algo digest algorithm) using public key. $algo must be available in Digest package. Returns boolean.
Returns public key representation in specified format.
To install Bitcoin::Crypto, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bitcoin::Crypto
CPAN shell
perl -MCPAN -e shell install Bitcoin::Crypto
For more information on module installation, please visit the detailed CPAN module installation guide.