2017 © Pedro Peláez
 

library cashaddr-converter

Converts old Bitcoin Cash addresses to the new CashAddr format and vice versa

image

submtd/cashaddr-converter

Converts old Bitcoin Cash addresses to the new CashAddr format and vice versa

  • Thursday, June 14, 2018
  • by submtd
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,023 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 102 % Grown

The README.md

CashaddrConverter

Converts old Bitcoin Cash addresses to the new CashAddr format and vice versa in a Laravel friendly package. Based off Har01d's CashAddressPHP code., (*1)

Installation

Begin by pulling in the package through Composer., (*2)

composer require submtd/cashaddr-converter

Next, if you are using Laravel 5.4, you will need to include the service provider and optionally, the alias in your config/app.php file. If you are using Laravel 5.5, these will be discovered automatically., (*3)

'providers' => [
    Submtd\CashaddrConverter\Providers\CashaddrConverterServiceProvider::class,
];

'aliases' => [
    'CashaddrConverter' => Submtd\CashaddrConverter\Facades\CashaddrConverterFacade::class,
];

Usage

A facade and a helper function are provided to make it super simple to use., (*4)

Using the facade

// convert from a legacy address to a cashaddr address
$legacyAddress = '1PchCm7XXAjifhpchPB8wR2WG5rzMFqjnR';
CashaddrConverter::convertToCashaddr($legacyAddress);
// returns bitcoincash:qrup9c40gr9usrz6m7rg7rknjmsp685r2yhxkdx8tf

// convert from a cashaddr address to a legacy address
$cashaddrAddress = 'bitcoincash:qrup9c40gr9usrz6m7rg7rknjmsp685r2yhxkdx8tf';
CashaddrConverter::convertFromCashaddr($cashaddrAddress);
// returns 1PchCm7XXAjifhpchPB8wR2WG5rzMFqjnR

Using the helper functions

// convert from a legacy address to a cashaddr address
$legacyAddress = '1PchCm7XXAjifhpchPB8wR2WG5rzMFqjnR';
convertToCashaddr($legacyAddress);
// returns bitcoincash:qrup9c40gr9usrz6m7rg7rknjmsp685r2yhxkdx8tf

// convert from a cashaddr address to a legacy address
$cashaddrAddress = 'bitcoincash:qrup9c40gr9usrz6m7rg7rknjmsp685r2yhxkdx8tf';
convertFromCashaddr($cashaddrAddress);
// returns 1PchCm7XXAjifhpchPB8wR2WG5rzMFqjnR

Donation

If this project helped you save some development time, feel free to buy me a beer ;), (*5)

paypal, (*6)

The Versions

14/06 2018

dev-master

9999999-dev

Converts old Bitcoin Cash addresses to the new CashAddr format and vice versa

  Sources   Download

MIT

The Requires

  • php >=7.0.0
  • ext-gmp *

 

by Steve Harmeyer

24/01 2018

1.0.1

1.0.1.0

Converts old Bitcoin Cash addresses to the new CashAddr format and vice versa

  Sources   Download

MIT

The Requires

  • php >=7.0.0
  • ext-gmp *

 

by Steve Harmeyer

23/01 2018

1.0

1.0.0.0

Converts old Bitcoin Cash addresses to the new CashAddr format and vice versa

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Steve Harmeyer

23/01 2018

0.1

0.1.0.0

Converts old Bitcoin Cash addresses to the new CashAddr format and vice versa

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Steve Harmeyer