2017 © Pedro Peláez
 

library cryptocurrencies

Definitions and implementations of cryptocurrencies in Openclerk

image

openclerk/cryptocurrencies

Definitions and implementations of cryptocurrencies in Openclerk

  • Monday, September 11, 2017
  • by soundasleep
  • Repository
  • 4 Watchers
  • 3 Stars
  • 211 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

openclerk/cryptocurrencies

A library for accessing balances, block counts and difficulties of common cryptocurrencies, used by Openclerk and live on CryptFolio., (*1)

This extends on the abstract currency definitions provided by openclerk/currencies., (*2)

Installing

Include openclerk/cryptocurrencies as a requirement in your project composer.json, and run composer update to install it into your project:, (*3)

{
  "require": {
    "openclerk/cryptocurrencies": "dev-master"
  }
}

PHP 5.4.6+ is required because some APIs require cURL 7.24+ due to the POODLE SSL bug., (*4)

Using

Get the balance for a certain address:, (*5)

use \Monolog\Logger;

$logger = new Logger("log");

$currency = new \Cryptocurrencies\Dogecoin();
$balance = $currency->getBalance("D64vbPp9TvqQ67xc6we5GnEtcKqiTXfp1S", $logger);

Get the balance for a certain address with a number of confirmations:, (*6)

$currency = new \Cryptocurrencies\Bitcoin();
$balance = $currency->getBalanceWithConfirmations("17eTMdqaFRSttfBYB9chKEzHubECZPTS6p", 6, $logger);

Get the current difficulty of a given cryptocurrency:, (*7)

$currency = new \Cryptocurrencies\Litecoin();
$balance = $currency->getDifficulty($logger);

Check whether a given address is valid:, (*8)

$currency = new \Cryptocurrencies\Bitcoin();
return $currency->isValid("17eTMdqaFRSttfBYB9chKEzHubECZPTS6p");

Tests

Each cryptocurrency comes with a suite of tests to check each associated service., (*9)

composer install
vendor/bin/phpunit

To run the tests for a single currency:, (*10)

vendor/bin/phpunit --bootstrap "vendor/autoload.php" test/DogecoinTest

To get debug output for the tests (such as CURL requests and decoded output), add the --debug switch to your vendor/bin/phpunit command., (*11)

Assets

Assets for each cryptocurrency, for example icons associated with the currency and associated services, are provided in css/ and images/., (*12)

These can be included into your project with asset-discovery and mixins are provided, for example:, (*13)

@each $code in $currency-codes {
  .currency_name.currency_#{$code}, .currency_name_#{$code} {
    padding-left: 20px;
    @include currency-label-background($code);
    background-position: 0 0;
    background-repeat: no-repeat;
    background-size: 16px 16px;
  }
}

Donations are appreciated., (*14)

Contributing

Pull requests that contribute new currencies, services or APIs are welcome., (*15)

For new currencies, make sure that you also provide an associated CurrencyTest so that the currency is automatically testable., (*16)

TODO

  1. Generate README list of currencies/services automatically
  2. Provide 32x32 icons for each cryptocurrency
  3. Link to live APIs on CryptFolio
  4. CI build server and link to test results

The Versions

11/09 2017

dev-master

9999999-dev

Definitions and implementations of cryptocurrencies in Openclerk

  Sources   Download

The Requires

 

The Development Requires

11/09 2017

0.1.2

0.1.2.0

Definitions and implementations of cryptocurrencies in Openclerk

  Sources   Download

The Requires

 

The Development Requires

11/09 2017

0.1.1

0.1.1.0

Definitions and implementations of cryptocurrencies in Openclerk

  Sources   Download

The Requires

 

The Development Requires

11/09 2017

0.1.0

0.1.0.0

Definitions and implementations of cryptocurrencies in Openclerk

  Sources   Download

The Requires

 

The Development Requires