PHP code example of hdfchain / hdfchain-php-api

1. Go to this page and download the library: Download hdfchain/hdfchain-php-api 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/ */

    

hdfchain / hdfchain-php-api example snippets




$testnet = \Hdfchain\TestNet::instance();

$mainnet = \Hdfchain\MainNet::instance();

$seed = \Hdfchain\Crypto\ExtendedKey::generateSeed($testnet);

$master = \Hdfchain\Crypto\ExtendedKey::newMaster($seed, $testnet);

$defaultAccountPrivateKey = $master
    ->hardenedChildKey(44)
    ->hardenedChildKey(42)
    ->hardenedChildKey(0);

$defaultAccountPublicKey = $master->neuter();

echo sprintf("Default account HD private key: %s\n", $defaultAccountPrivateKey);
echo sprintf("Default account HD public key: %s\n", $defaultAccountPublicKey);

$defaultAddress = $defaultAccountPublicKey
    ->publicChildKey(0)
    ->publicChildKey(0)
    ->getAddress();

echo sprintf("Default address: %s\n", $defaultAddress);
bash
composer 
bash
git clone https://github.com/hdfchain/hdfchain-php-api.git