2017 © Pedro Peláez
 

library bitcoin-ecdsa

PHP library allowing to generate BTC addresses from private keys

image

bitcoin-php/bitcoin-ecdsa

PHP library allowing to generate BTC addresses from private keys

  • Wednesday, January 24, 2018
  • by rgex
  • Repository
  • 18 Watchers
  • 95 Stars
  • 2,366 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 50 Forks
  • 0 Open issues
  • 19 Versions
  • 20 % Grown

The README.md

Build   Quality Score   Latest Stable Version   Downloads, (*1)

WARNING

This piece of software is provided without warranty of any kind, use it at your own risk., (*2)

REQUIREMENTS

php 5.4.0 or newer., (*3)

php5-gmp needs to be installed., (*4)

If you want to launch the test file you need to be under a unix system with libbitcoin intalled on it., (*5)

USAGE

Installation, (*6)

Best way is to use composer, (*7)

composer require bitcoin-php/bitcoin-ecdsa

Alternatively add the following snippet to your composer.json, (*8)

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

Instantiation, (*9)

use BitcoinPHP\BitcoinECDSA\BitcoinECDSA;
require_once("src/BitcoinPHP/BitcoinECDSA/BitcoinECDSA.php");
$bitcoinECDSA = new BitcoinECDSA();

Set a private key, (*10)

$bitcoinECDSA->setPrivateKey($k);

examples of private keys :, (*11)

4C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D 00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC, (*12)

Generate a random private key, (*13)

$bitcoinECDSA->generateRandomPrivateKey($nonce);

The nonce is optional, typically the nonce is a chunk of random data you get from the user. This can be mouse coordinates. Using a nonce adds randomness, which means the generated private key is stronger., (*14)

Get the private key, (*15)

$bitcoinECDSA->getPrivateKey();

Returns the private key., (*16)

Get the Wif, (*17)

$bitcoinECDSA->getWif();

returns the private key under the Wallet Import Format, (*18)

Get the Public Key, (*19)

$bitcoinECDSA->getPubKey();

Returns the compressed public key. The compressed PubKey starts with 0x02 if its y coordinate is even and 0x03 if it is odd, the next 32 bytes corresponds to the x coordinates., (*20)

Example : 0226c50013603b085fbc26411d5d7e564b252d88964eedc4e01251d2d495e92c29, (*21)

Get the Uncompressed Public Key, (*22)

$bitcoinECDSA->getUncompressedPubKey();

Returns the uncompressed PubKey. The uncompressed PubKey starts with 0x04, the next 32 bytes are the x coordinates, the last 32 bytes are the y coordinates., (*23)

Example : 04c80e8af3f1b7816a18aa24f242fc0740e9c4027d67c76dacf4ce32d2e5aace241c426fd288a9976ca750f1b192d3acd89dfbeca07ef27f3e5eb5d482354c4249, (*24)

Get the coordinates of the Public Key, (*25)

$bitcoinECDSA->getPubKeyPoints();

Returns an array containing the x and y coordinates of the public key, (*26)

Example : Array ( [x] => a69243f3c4c047aba38d7ac3660317629c957ab1f89ea42343aee186538a34f8 [y] => b6d862f39819060378542a3bb43ff76b5d7bb23fc012f09c3cd2724bebe0b0bd ), (*27)

Get the Address, (*28)

$bitcoinECDSA->getAddress();

Returns the compressed Bitcoin Address., (*29)

Get the uncompressed Address, (*30)

$bitcoinECDSA->getUncompressedAddress();

Returns the uncompressed Bitcoin Address., (*31)

Validate an address, (*32)

$bitcoinECDSA->validateAddress($address);

Returns true if the address is valid and false if it isn't, (*33)

Validate a Wif key, (*34)

$bitcoinECDSA->validateWifKey($wif);

Returns true if the WIF key is valid and false if it isn't, (*35)

Signatures

Sign a message, (*36)

$bitcoinECDSA->signMessage('message');

Returns a satoshi client standard signed message., (*37)

verify a message, (*38)

$bitcoinECDSA->checkSignatureForRawMessage($signedMessage);

Returns true if the signature is matching the address and false if it isn't., (*39)

sign a sha256 hash, (*40)

$bitcoinECDSA->signHash($hash);

Returns a DER encoded hexadecimal signature., (*41)

verify a signature, (*42)

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

Returns true if the signature is matching the public key and false if it isn't., (*43)

Examples

License

This is free and unencumbered software released into the public domain., (*44)

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means., (*45)

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law., (*46)

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE., (*47)

For more information, please refer to http://unlicense.org/, (*48)

The Versions

24/01 2018

dev-master

9999999-dev https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

09/08 2017

1.3.4

1.3.4.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

08/07 2017

1.3.3

1.3.3.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

30/04 2017

1.3.2

1.3.2.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

16/04 2017

1.3.1

1.3.1.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

10/09 2016

1.3.0

1.3.0.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

14/12 2015

1.2.3

1.2.3.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

07/12 2015

1.2.2

1.2.2.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

06/12 2015

1.2.1

1.2.1.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

02/12 2015

1.2

1.2.0.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

10/05 2015

1.1.2

1.1.2.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

24/03 2015

1.1.1

1.1.1.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0
  • ext-gmp *

 

The Development Requires

bitcoin ecdsa

29/08 2014

1.1

1.1.0.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0

 

The Development Requires

bitcoin ecdsa

10/07 2014

1.0.5

1.0.5.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0

 

The Development Requires

bitcoin ecdsa

30/06 2014

1.0.4

1.0.4.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0

 

The Development Requires

bitcoin ecdsa

05/06 2014

1.0.2

1.0.2.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0

 

bitcoin ecdsa

05/06 2014

1.0.3

1.0.3.0 https://github.com/BitcoinPHP/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

Unlicense

The Requires

  • php >=5.4.0

 

bitcoin ecdsa

01/06 2014

1.0.1

1.0.1.0 http://github.com/rgex/BitcoinECDSA.php

PHP library allowing to generate BTC addresses from private keys

  Sources   Download

unlicensed

The Requires

  • php >=5.4.0

 

bitcoin ecdsa

01/06 2014

1.0.0

1.0.0.0 http://github.com/rgex/BitcoinECDSA.php

  Sources   Download

unlicensed

The Requires

  • php >=5.4.0

 

bitcoin ecdsa