PHP code example of andkom / php-bitcoin-wallet

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

    

andkom / php-bitcoin-wallet example snippets




use AndKom\Bitcoin\Wallet\Wallet;
 
// create wallet instance
$wallet = new Wallet();
$wallet->read("/path/to/wallet.dat");
 
// check if wallet is encrypted
if ($wallet->isEncrypted()) {
 
    // print wallet master key
    echo $wallet->getMasterKey()->getEncryptedKey() . "\n";
     
    // decrypt wallet
    $wallet->decrypt("password");
}
 
// print stored keys
foreach ($wallet->getKeys() as $key) {
    echo $key->getPrivateKey()->toWif() . " => " . $key->getPublicKey()->getAddress()->getAddress() . "\n";
}
bash
composer