NAME
CBitcoin::CBHD - A wrapper for Bip32 Hierarchial Deterministic Keys
SEE INSTEAD?
The module CBitcoin::CBHD provides another interface for generating Bip32 Hierarchial Deterministic Keys. For most of the legwork, this wrapper relies on the picocoin library.
- dl_load_flags
-
Don't worry about this.
---+ constructors
---++ new($xprv_txt)
Create a cbhd object from a serialized, base58 encoded scalar.
TODO: check for the appropriate network bytes.
---++ generate($seed)
generate a key (parent)
---++ deriveChild($hardbool,$childid)
If you want to go from private parent keypair to public child keypair, then set $hardbool to false. If you want to go from private parent keypair to private child keypair, then set $hardbool to true.
---++ deriveChildPubExt($childid)
If you want to take an CBHD key with private key and create a soft child that does not have the private bits, then use this function.
From Hard to Soft.
---+ utilities
---++ is_soft_child
Returns true if yes, false if soft.
---++ export_xpub
---++ export_xprv
---++ network_bytes()
Return either 'production' or 'test' depending on whether we are on testnet or mainnet
---++ cbhd_type
Return 'private' if we posses the serialized private key, else return public.
---++ address()
The network bytes are determined by the global variable $CBitcoin::network_bytes.
---++ publickey()
Provide the public key in raw binary form.
---++ privatekey()
Provide the private key in raw binary form.
---++ ripemdHASH160
---++ index
---++ childid->($hardbool,$index)
---++ print_to_stderr
---+ encryption
These are just subroutines, not object methods.
---++ encrypt($recepient_pub,$readsub,$writesub)->$cipher_data
$cipher_data = $hmac.$ephemeral_pubkey.$ciphertext
$hmac = hmac_sha256(sha256(data),shared_secret);
---++ decrypt($recepient_priv,$header,$readsub,$writesub)->0/1
$cipher_data = $hmac.$ephemeral_pubkey.$ciphertext
---++ offset_keypair_private
Given a private key and an offset, create a new private/public keypair.
---++ shared_secret($pubkey,$privkey,$kdf1_sub)->0/1
SYNOPSIS
use CBitcoin;
use CBitcoin::CBHD;
my $root1 = CBitcoin::CBHD->generate("my magic seed!");
my $child_hard = $root1->deriveChild(1,323);
my $c_1_323_0_20_priv = $child_hard->deriveChild(0,20);
print "Root address:".$root1->address()."\n";
AUTHOR
Joel De Jesus, <dejesus.joel at e-flamingo.jp>
BUGS
Please report any bugs or feature requests to https://github.com/favioflamingo/libcbitcoin-perl. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc CBitcoin::CBHD
You can also look for information at:
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2014 Joel De Jesus.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
3 POD Errors
The following errors were encountered while parsing the POD:
- Around line 36:
'=item' outside of any '=over'
- Around line 670:
You forgot a '=back' before '=head1'
- Around line 704:
You forgot a '=back' before '=head1'