PHPackages                             decred/decred-php-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. decred/decred-php-api

ActiveLibrary[API Development](/categories/api)

decred/decred-php-api
=====================

PHP API for the Decred Cryptocurrency

v0.0.2(6y ago)91037[3 issues](https://github.com/decred/decred-php-api/issues)[1 PRs](https://github.com/decred/decred-php-api/pulls)1ISCPHPPHP &gt;=5.6

Since Mar 12Pushed 6y ago5 watchersCompare

[ Source](https://github.com/decred/decred-php-api)[ Packagist](https://packagist.org/packages/decred/decred-php-api)[ RSS](/packages/decred-decred-php-api/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (8)Versions (3)Used By (1)

Decred PHP API
==============

[](#decred-php-api)

[![Build Status](https://github.com/decred/decred-php-api/workflows/Build%20and%20Test/badge.svg)](https://github.com/decred/decred-php-api/actions)[![ISC License](https://camo.githubusercontent.com/95c61c397ca3825757ec835268e50886b2c10ddc4f0676e1222b19037610927f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4953432d626c75652e737667)](http://copyfree.org)

PHP API for the [Decred](https://decred.org) Cryptocurrency

Installation
------------

[](#installation)

Add composer package to your project

```
composer require decred/decred-php-api
```

Make sure [GMP PHP extesion](https://www.php.net/manual/en/book.gmp.php) is installed. In ubuntu:

```
sudo apt install php7.0-gmp
```

### From repository

[](#from-repository)

You also can clone git package with

```
git clone https://github.com/decred/decred-php-api.git
```

But still you will need to fetch library dependencies with [composer](https://getcomposer.org/doc/00-intro.md).

```
composer install --no-dev
```

Don't forget to include composer autoloader.

```
include __DIR__.'/../vendor/autoload.php';
```

Usage examples
--------------

[](#usage-examples)

Library have wide functionality, so you could find usage examples in `examples` library or looking into PHPUnit tests.

### Generating seed

[](#generating-seed)

First of all we need to get Network intance to start working with library.

```
$testnet = \Decred\TestNet::instance();
```

And mainnet accordingly

```
$mainnet = \Decred\MainNet::instance();
```

Now lets generate a seed, that will be also verified for usage on testnet. Defaut account and branch address will be derivded to verify the seed.

```
$seed = \Decred\Crypto\ExtendedKey::generateSeed($testnet);
```

### HD Wallets

[](#hd-wallets)

When we have usable seed we can create HD master key.

```
$master = \Decred\Crypto\ExtendedKey::newMaster($seed, $testnet);
```

`newMaster` method will return `ExtendedKey` object, that have variant API for working with HD wallets.

#### `ExtendedKey::privateChildKey($index)`

[](#extendedkeyprivatechildkeyindex)

Derives HD private child key from parent HD private key, returns `ExtendedKey` object.

#### `ExtendedKey::hardenedChildKey($index)`

[](#extendedkeyhardenedchildkeyindex)

Derives HD hardened child key from parent HD private key, returns `ExtendedKey` object.

Can't be dervied from HD public key.

#### `ExtendedKey::publicChildKey($index)`

[](#extendedkeypublicchildkeyindex)

Derives HD public child key from parent HD private or public key, returns `ExtendedKey` object.

#### `ExtendedKey::neuter`

[](#extendedkeyneuter)

Verify that extended key is public, returns `ExtendedKey` object.

### Default account

[](#default-account)

Using this basic methods we can derive default account HD private and public keys accourding to [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki).

HD path (m\\44'\\42'\\0')

```
$defaultAccountPrivateKey = $master
    ->hardenedChildKey(44)
    ->hardenedChildKey(42)
    ->hardenedChildKey(0);

$defaultAccountPublicKey = $master->neuter();
```

`ExtendedKey` implements `__toString()` method, so you can easily get Base58 representation of HD key.

```
echo sprintf("Default account HD private key: %s\n", $defaultAccountPrivateKey);
echo sprintf("Default account HD public key: %s\n", $defaultAccountPublicKey);
```

From default account we can derive 0 branch and 0 index and the get default address.

```
$defaultAddress = $defaultAccountPublicKey
    ->publicChildKey(0)
    ->publicChildKey(0)
    ->getAddress();

echo sprintf("Default address: %s\n", $defaultAddress);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~507 days

Total

2

Last Release

2479d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/efde93422926c40d99f8761ac9ddf5ef10d42a798e020382fad74fa054b38477?d=identicon)[decred](/maintainers/decred)

---

Top Contributors

[![R3VoLuT1OneR](https://avatars.githubusercontent.com/u/1111188?v=4)](https://github.com/R3VoLuT1OneR "R3VoLuT1OneR (4 commits)")[![dajohi](https://avatars.githubusercontent.com/u/3308193?v=4)](https://github.com/dajohi "dajohi (3 commits)")[![degeri](https://avatars.githubusercontent.com/u/41839293?v=4)](https://github.com/degeri "degeri (1 commits)")[![Sup3rWet](https://avatars.githubusercontent.com/u/19609067?v=4)](https://github.com/Sup3rWet "Sup3rWet (1 commits)")

---

Tags

apibitcoindecredphpwalletcryptobitcoindecreddcr

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/decred-decred-php-api/health.svg)

```
[![Health](https://phpackages.com/badges/decred-decred-php-api/health.svg)](https://phpackages.com/packages/decred-decred-php-api)
```

###  Alternatives

[coinpaymentsnet/coinpayments-php

A PHP wrapper for the CoinPayments.net v1 API.

55126.2k](/packages/coinpaymentsnet-coinpayments-php)[blocktrail/blocktrail-sdk

The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API

4921.1k3](/packages/blocktrail-blocktrail-sdk)[mocking-magician/coinbase-pro-sdk

Library for coinbase pro API calls

223.2k](/packages/mocking-magician-coinbase-pro-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
