bitwasp / bitcoin-lib
Implementation of raw transactions in bitcoin, HD wallets, Electrum wallets, and other fun stuff.
Installs: 21 746
Dependents: 8
Suggesters: 1
Security: 0
Stars: 136
Watchers: 28
Forks: 86
Open Issues: 7
Requires
- php: >=5.3.3
- ext-bcmath: *
- ext-gmp: *
- ext-mcrypt: *
- mdanter/ecc: ~0.3.0
- rych/hash_pbkdf2-compat: ~1.0
Requires (Dev)
- phpunit/phpunit: ~4.1
- squizlabs/php_codesniffer: ~2
Suggests
- ext-intl: Required for BIP39 Mnemonic Seeds with UTF-8 passphrases
README
PHP libraries implementing bitcoin key functions, as well as BIP32 and electrum.
NB: This library is outdated, and no longer maintained. BC breaks will not be accepted for this reason. For a newer library, please see https://github.com/Bit-Wasp/bitcoin-php
The library intends to expose a lot of general functionality which isn't available using the RPC (like deterministic addresses).
It also allows you to reduce the number of queries that are made to bitcoind, such as createrawtransaction/signrawtransaction/decoderawtransaction. As such, such, use of bitcoin RPC functionality can be kept to a minimum.
Libraries
- Raw Transactions: create, sign, validate, with support for P2SH.
- Create multi-signature addresses, create redeeming transactions.
- BIP32: Functions for generating BIP32 deterministic keys.
- Electrum: Create seed from mnemonic, create MPK from seed, derive public keys from MPK, or private keys from seed.
- BitcoinLib: The core class, with key functionality, encoding/decoding & validation functions, etc.
- BIP39: Functions for generating Mnemonic code for generating deterministic keys (possibly password protected)
If this library powers your project and you're feeling tipsy, buy me lunch some day! 1sCVtkEhQmvp3D4K22Pw9xhFPTDWFh8SZ
Installation
Installing via Composer (recommended)
-
Install Composer in your project:
curl -s http://getcomposer.org/installer | php
-
Create a
composer.json
file in your project root:{ "require": { "bitwasp/bitcoin-lib": "1.0.*" } }
-
Install via Composer
php composer.phar install
Dependencies
Mcrypt Extension (Random data)
The Mcrypt Extension is required for generating random data, it does this internally
by using /dev/urandom
on unix or CryptGenRandom
on windows.
GMP Extension (Math)
The GMP Extension is required for the crypto math.
PECL intl extension (BIP39)
The PECL intl extension is required for BIP39 Mnemonic Seeds when a UTF-8 passphrase is used.
Mdanter's PHP Pure PHP Elliptic Curve Cryptography Library
mdanter/ecc
is required for most of the crypto.
Contributing
Please make sure that all phpunit tests pass (and preferably added new unit tests) and that the coding style passing PSR2 checks:
./vendor/bin/phpunit
./vendor/bin/phpcs --standard=./phpcs.xml -n -s ./src/