PHPackages                             bitwasp/bitcoinconsensus - 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. bitwasp/bitcoinconsensus

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

bitwasp/bitcoinconsensus
========================

Composer package containing stubs for bitcoinconsensus. Make sure your version is correct!

v3.0.1(7y ago)64.2k↓66.7%620UnlicensePHPPHP &gt;=7.0

Since Nov 21Pushed 7y ago2 watchersCompare

[ Source](https://github.com/Bit-Wasp/bitcoinconsensus-php)[ Packagist](https://packagist.org/packages/bitwasp/bitcoinconsensus)[ Docs](https://github.com/Bit-Wasp/bitcoinconsensus-php)[ RSS](/packages/bitwasp-bitcoinconsensus/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (8)Used By (20)

bitcoinconsensus-php
====================

[](#bitcoinconsensus-php)

[![Build Status](https://camo.githubusercontent.com/cd17fa4850aa476913433f0df3a23af02853638d8f2777b1cfd4147948672e3c/68747470733a2f2f7472617669732d63692e6f72672f4269742d576173702f626974636f696e636f6e73656e7375732d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Bit-Wasp/bitcoinconsensus-php)[![codecov](https://camo.githubusercontent.com/f280744ac8354487c5d7bfe931e4a7e3bb068f3b783d21755a315b2a0f137038/68747470733a2f2f636f6465636f762e696f2f67682f4269742d576173702f626974636f696e636f6e73656e7375732d7068702f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Bit-Wasp/bitcoinconsensus-php)

PHP extension for Bitcoin Script validation.

It exposes bindings to the bitcoinconsensus.h library, which exposes the VerifyScript with a C compatible interface.

The library is normally build during compilation of Bitcoin Core, and is also distributed in signed releases of Bitcoin Core. This means you can build your own or get a trusted copy.

Requirements
------------

[](#requirements)

Version v3.0.0 can be run on PHP versions &gt; 7.0.

- In theory can be built with versions before Bitcoin Core v0.13.0.

Version v2.0.0 can run on PHP versions 5.3 - 5.6, and PHP 7.0 - 7.2, 7.3-RC

- It must be built against Bitcoin Core v0.13.0 upwards.

See how to install a certain branch in the installation section.

Supported features
------------------

[](#supported-features)

Script verification flags:

```
BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_NONE
BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_P2SH
BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_DERSIG

Optional (depends on bitcoinconsensus.h build):
BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY
BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY
BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_WITNESS
BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_NULLDUMMY

```

Error codes for bitcoinconsensus\_verify\_script{,with\_amount}

```
BITCOINCONSENSUS_ERR_OK                   no error
BITCOINCONSENSUS_ERR_TX_INDEX             input index not set in transaction
BITCOINCONSENSUS_ERR_TX_SIZE_MISMATCH     (not possible)
BITCOINCONSENSUS_ERR_TX_DESERIALIZE       invalid transaction serialization

Optional (depends on bitcoinconsensus.h build):
BITCOINCONSENSUS_ERR_AMOUNT_REQUIRED      used segwit flag with old function
BITCOINCONSENSUS_ERR_INVALID_FLAGS        invalid script verification flags used

```

Compatibility
-------------

[](#compatibility)

Script verification constants following the naming `BITCOINCONSENSUS_VERIFY_x`were removed in favor of those following upstreams naming.

To Install:
-----------

[](#to-install)

```
    git clone -b v3.0.0 git@github.com:bit-wasp/bitcoinconsensus-php
    cd bitcoinconsensus-php/bitcoinconsensus
    phpize && ./configure --with-bitcoinconsensus && make && sudo make install

```

(Optional) - Enable the extension by default!
---------------------------------------------

[](#optional---enable-the-extension-by-default)

Add this line to your php.ini files to enable the extension in PHP by default.

```
extension=bitcoinconsensus.so

```

Examples
--------

[](#examples)

### Get version

[](#get-version)

```
echo bitcoinconsensus_version() . PHP_EOL;
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~119 days

Recently: every ~27 days

Total

7

Last Release

2750d ago

Major Versions

v1.0 → v2.0.02017-06-22

v2.0.0 → v3.0.02018-07-22

v2.0.1 → 3.0.0.x-dev2018-11-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/763cdc5cc50414bacd4ff1080eede79432f7c3cc26a3d8aa9031b1537a8bd734?d=identicon)[thomaskerin](/maintainers/thomaskerin)

---

Top Contributors

[![afk11](https://avatars.githubusercontent.com/u/5617245?v=4)](https://github.com/afk11 "afk11 (7 commits)")

---

Tags

bitcoinbitcoinconsensus-phpext-bitcoinconsensusphpphp-extensionbitcoinscripttransactionbitcoinconsensus

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bitwasp-bitcoinconsensus/health.svg)

```
[![Health](https://phpackages.com/badges/bitwasp-bitcoinconsensus/health.svg)](https://phpackages.com/packages/bitwasp-bitcoinconsensus)
```

###  Alternatives

[bitcoin-php/bitcoin-ecdsa

PHP library allowing to generate BTC addresses from private keys

23062.6k7](/packages/bitcoin-php-bitcoin-ecdsa)[kornrunner/ethereum-offline-raw-tx

Pure PHP Ethereum Offline Raw Transaction Signer

63192.1k22](/packages/kornrunner-ethereum-offline-raw-tx)[bitwasp/bitcoin-lib

Implementation of raw transactions in bitcoin, HD wallets, Electrum wallets, and other fun stuff.

13922.3k5](/packages/bitwasp-bitcoin-lib)[kornrunner/ethereum-token

PHP Ethereum Token Utils

1412.9k1](/packages/kornrunner-ethereum-token)[eftec/minilang

A mini scripting language for php

113.2k2](/packages/eftec-minilang)

PHPackages © 2026

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