PHP code example of bitcoin-php / bitcoin-ecdsa

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

    

bitcoin-php / bitcoin-ecdsa example snippets


use BitcoinPHP\BitcoinECDSA\BitcoinECDSA;

$bitcoinECDSA->setPrivateKey($k);

$bitcoinECDSA->generateRandomPrivateKey($nonce);

$bitcoinECDSA->getPrivateKey();

$bitcoinECDSA->getWif();

$bitcoinECDSA->getPubKey();

$bitcoinECDSA->getUncompressedPubKey();

$bitcoinECDSA->getPubKeyPoints();

$bitcoinECDSA->getAddress();

$bitcoinECDSA->getUncompressedAddress();

$bitcoinECDSA->validateAddress($address);

$bitcoinECDSA->validateWifKey($wif);

$bitcoinECDSA->signMessage('message');

$bitcoinECDSA->checkSignatureForRawMessage($signedMessage);

$bitcoinECDSA->signHash($hash);

$bitcoinECDSA->checkDerSignature($pubKey, $signature, $hash)

composer 

"bitcoin-php/bitcoin-ecdsa" : ">=1.3"