PHP code example of dan-da / hd-wallet-addrs

1. Go to this page and download the library: Download dan-da/hd-wallet-addrs library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dan-da / hd-wallet-addrs example snippets




// normally a single xpub is used.  multiple can be provided for multisig key generation.
$xpub_list = ['xpub6BfKpqjTwvH21wJGWEfxLppb8sU7C6FJge2kWb9315oP4ZVqCXG29cdUtkyu7YQhHyfA5nt63nzcNZHYmqXYHDxYo8mm1Xq1dAC7YtodwUR'];

$params = walletaddrs::default_params();
// modify params here if you need to.  see default_params() for keys.

$wa = new walletaddrs($params);
$data = $wa->discover_wallet_addrs( $xpub_list );

echo json_encode($data, JSON_PRETTY_PRINT);

// or for fancier printing, you could use:
// walletaddrsreport::print_results($wa->get_params(), $data);

 sudo apt-get install php-cli php-gmp composer

./hd-wallet-addrs.php -g --xpub=xpub6BfKpqjTwvH21wJGWEfxLppb8sU7C6FJge2kWb9315oP4ZVqCXG29cdUtkyu7YQhHyfA5nt63nzcNZHYmqXYHDxYo8mm1Xq1dAC7YtodwUR

./hd-wallet-addrs.php -g --xpub=xpub6BfKpqjTwvH21wJGWEfxLppb8sU7C6FJge2kWb9315oP4ZVqCXG29cdUtkyu7YQhHyfA5nt63nzcNZHYmqXYHDxYo8mm1Xq1dAC7YtodwUR --logfile=/tmp/log.txt

 cd tests
 ./test_runner.php