PHPackages                             cpuchain-php/cpuchain-ecdsa - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cpuchain-php/cpuchain-ecdsa

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cpuchain-php/cpuchain-ecdsa
===========================

PHP library allowing to generate CPU addresses from private keys

1.3.4(6y ago)041unlicensePHPPHP &gt;=5.4.0

Since Jun 1Pushed 4y agoCompare

[ Source](https://github.com/cpuchain/CPUchainECDSA.php)[ Packagist](https://packagist.org/packages/cpuchain-php/cpuchain-ecdsa)[ Docs](https://github.com/CPUchainPHP/CPUchainECDSA.php)[ RSS](/packages/cpuchain-php-cpuchain-ecdsa/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (19)Used By (0)

[![Build](https://camo.githubusercontent.com/eb37c6a758208752069e79e16ab93387e17f6a04c9ea9e86d6dc0445c8412dad/68747470733a2f2f7472617669732d63692e6f72672f435055636861696e5048502f435055636861696e45434453412e7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/CPUchainPHP/CPUchainECDSA.php) [![Quality Score](https://camo.githubusercontent.com/20e435832f85ab33809e8d0067393c2b2a53b9476d24c4205664c0e40601f6e2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f435055636861696e5048502f435055636861696e45434453412e7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/CPUchainPHP/CPUchainECDSA.php/?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/eb3e9313ca2ab0faec2c736abd84e4266acd520d45db0aa1ac885f3629011054/68747470733a2f2f706f7365722e707567782e6f72672f637075636861696e2d7068702f637075636861696e2d65636473612f762f737461626c652e737667)](https://packagist.org/packages/cpuchain-php/cpuchain-ecdsa) [![Downloads](https://camo.githubusercontent.com/aa9e4b6ae518d8efa22fa6f91a5d2f3609ab86b0807cd9b28b9bccd68aae8016/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f637075636861696e2d7068702f637075636861696e2d65636473612e7376673f7374796c653d666c6174)](https://packagist.org/packages/cpuchain-php/cpuchain-ecdsa)

REQUIREMENTS
============

[](#requirements)

*php 5.4.0* or newer.

*php5-gmp* needs to be installed.

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

USAGE
=====

[](#usage)

**Installation**

Best way is to use composer

```
composer require cpuchain-php/cpuchain-ecdsa

```

Alternatively add following snippet in you composer.json

```
"cpuchain-php/cpuchain-ecdsa" : ">=1.3"

```

**Instanciation**

```
use CPUchainPHP\CPUchainECDSA\CPUchainECDSA;
require_once("src/CPUchainPHP/CPUchainECDSA/CPUchainECDSA.php");
$cpuchainECDSA = new CPUchainECDSA();
```

**Set a private key**

```
$cpuchainECDSA->setPrivateKey($k);
```

examples of private keys :

4C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D 00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC

**Generate a random private key**

```
$cpuchainECDSA->generateRandomPrivateKey($nonce);
```

The nonce is optional, typically the nonce is a chunck 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.

**Get the private key**

```
$cpuchainECDSA->getPrivateKey();
```

Returns the private key.

**Get the Wif**

```
$cpuchainECDSA->getWif();
```

returns the private key under the Wallet Import Format

**Get the Public Key**

```
$cpuchainECDSA->getPubKey();
```

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

Example : 0226c50013603b085fbc26411d5d7e564b252d88964eedc4e01251d2d495e92c29

**Get the Uncompressed Public Key**

```
$cpuchainECDSA->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.

Example : 04c80e8af3f1b7816a18aa24f242fc0740e9c4027d67c76dacf4ce32d2e5aace241c426fd288a9976ca750f1b192d3acd89dfbeca07ef27f3e5eb5d482354c4249

**Get the coordinates of the Public Key**

```
$cpuchainECDSA->getPubKeyPoints();
```

Returns an array containing the x and y coordinates of the public key

Example : Array ( \[x\] =&gt; a69243f3c4c047aba38d7ac3660317629c957ab1f89ea42343aee186538a34f8 \[y\] =&gt; b6d862f39819060378542a3bb43ff76b5d7bb23fc012f09c3cd2724bebe0b0bd )

**Get the Address**

```
$cpuchainECDSA->getAddress();
```

Returns the compressed CPUchain Address.

**Get the uncompressed Address**

```
$cpuchainECDSA->getUncompressedAddress();
```

Returns the uncompressed CPUchain Address.

**Validate an address**

```
$cpuchainECDSA->validateAddress($address);
```

Returns true if the address is valid and false if it isn't

**Validate a Wif key**

```
$cpuchainECDSA->validateWifKey($wif);
```

Returns true if the WIF key is valid and false if it isn't

Signatures
==========

[](#signatures)

**Sign a message**

```
$cpuchainECDSA->signMessage('message');
```

Returns a satoshi client standard signed message.

**verify a message**

```
$cpuchainECDSA->checkSignatureForRawMessage($signedMessage);
```

Returns true if the signature is matching the address and false if it isn't.

**sign a sha256 hash**

```
$cpuchainECDSA->signHash($hash);
```

Returns a DER encoded hexadecimal signature.

**verify a signature**

```
$cpuchainECDSA->checkDerSignature($pubKey, $signature, $hash)
```

Returns true if the signature is matching the public key and false if it isn't.

Examples
========

[](#examples)

- [Generate an address](https://github.com/CPUchainPHP/CPUchainECDSA.php/blob/master/Examples/generateAddress.php)
- [Sign a message](https://github.com/CPUchainPHP/CPUchainECDSA.php/blob/master/Examples/signMessage.php)
- [Verify a message](https://github.com/CPUchainPHP/CPUchainECDSA.php/blob/master/Examples/verifyMessage.php)
- [Import or export a private key using WIF](https://github.com/CPUchainPHP/CPUchainECDSA.php/blob/master/Examples/wif.php)

License
=======

[](#license)

This is free and unencumbered software released into the public domain.

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.

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.

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.

For more information, please refer to

Credits
=======

[](#credits)

This library is a fork of [BitcoinECDSA](https://github.com/BitcoinPHP/BitcoinECDSA.php) by [BitcoinPHP](https://github.com/BitcoinPHP), adapted to work with [CPUchain](https://cpuchain.org).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 94.4% of commits — single point of failure

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 ~124 days

Recently: every ~320 days

Total

18

Last Release

2245d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/32ee54d4a7274cbd7c0ddb277f5ed8812945a077e5eb93dd3126dbeac993204c?d=identicon)[cpuchain](/maintainers/cpuchain)

---

Top Contributors

[![rgex](https://avatars.githubusercontent.com/u/3996942?v=4)](https://github.com/rgex "rgex (152 commits)")[![tuaris](https://avatars.githubusercontent.com/u/5660265?v=4)](https://github.com/tuaris "tuaris (2 commits)")[![ErikPelli](https://avatars.githubusercontent.com/u/46297387?v=4)](https://github.com/ErikPelli "ErikPelli (2 commits)")[![mikerousseau](https://avatars.githubusercontent.com/u/6607176?v=4)](https://github.com/mikerousseau "mikerousseau (1 commits)")[![anthonyryan1](https://avatars.githubusercontent.com/u/543852?v=4)](https://github.com/anthonyryan1 "anthonyryan1 (1 commits)")[![yfgeek](https://avatars.githubusercontent.com/u/7533831?v=4)](https://github.com/yfgeek "yfgeek (1 commits)")[![Cuchulain](https://avatars.githubusercontent.com/u/473790?v=4)](https://github.com/Cuchulain "Cuchulain (1 commits)")[![dragu](https://avatars.githubusercontent.com/u/2284006?v=4)](https://github.com/dragu "dragu (1 commits)")

---

Tags

ECDSACPUchain

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cpuchain-php-cpuchain-ecdsa/health.svg)

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

###  Alternatives

[bitcoin-php/bitcoin-ecdsa

PHP library allowing to generate BTC addresses from private keys

23062.6k7](/packages/bitcoin-php-bitcoin-ecdsa)[shipmonk/name-collision-detector

Simple tool to find ambiguous classes or any other name duplicates within your project.

362.1M34](/packages/shipmonk-name-collision-detector)[bostondv/bootstrap-ninja-forms

Adds Bootstrap classes to Ninja Forms

222.2k](/packages/bostondv-bootstrap-ninja-forms)

PHPackages © 2026

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