PHPackages                             limikael/blockchainwalletmock - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. limikael/blockchainwalletmock

ActiveLibrary[Testing &amp; Quality](/categories/testing)

limikael/blockchainwalletmock
=============================

Mocks the blockchain.info wallet api for testing...

v0.0.14(10y ago)0321PHP

Since Jun 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/limikael/blockchainwalletmock)[ Packagist](https://packagist.org/packages/limikael/blockchainwalletmock)[ RSS](/packages/limikael-blockchainwalletmock/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (15)Used By (1)

blockchainwalletmock
====================

[](#blockchainwalletmock)

Mocked version of the blockchain.info wallet API for automated testing.

About
-----

[](#about)

This is a mocked version of the API at [https://blockchain.info/api/blockchain\_wallet\_api](https://blockchain.info/api/blockchain_wallet_api) that uses a local database to store transactions. No bitcoins will be moved to or from any wallet and no fees involving real coins will have to be paied. Since we are dealing with financial software, it doesn't hurt if we get into the habit of writing tests for our code. In order to do that, e we can use this tool to see if we deal with responses and handle callbacks in the correct way.

Getting started
---------------

[](#getting-started)

First, install with:

```
composer global require blockchainwalletmock
```

And the run with:

```
blockchainwalletmock --port 8888
```

Once it is started we can see that it is up with:

```
curl "http://localhost:8888/list?password=testpassword"
```

Which should gice us the result:

```
{
  "addresses":[
  ]
}
```

The JSON comes out as raw text, it has been formatted here for readability. We can create a new address in the same way as we would using the blockchin.info api:

```
curl "http://localhost:8888/new_address?password=testpassword"
```

```
{
  "address": "075bd7684e782dca00007f01b24c34c0"
}
```

Now let's simulate an incoming payment:

```
curl "http://localhost:8888/debug_incoming?password=testpassword&address=075bd7684e782dca00007f01b24c34c0&amount=100000000"
```

```
{
  "message":"ok"
}
```

Let's list our addresses again:

```
curl "http://localhost:8888/list?password=testpassword"
```

```
{
  "addresses":[
    {
      "address":"075bd7684e782dca00007f01b24c34c0",
      "balance":"100000000",
      "total_received":"100000000"
    }
  ]
}
```

You get the idea.

This way we can test our code before deployment, as well as create unit test using e.g. [PHPUnit](http://phpunit.de/), without having to worry about what happens to our bitcoins.

Configuration
-------------

[](#configuration)

There are various configuration options we can set, for example what minimum transaction the should be accepted. We can also set a callback url in the same way as we do in the blockchain.info "Account Settings", and this url will be called using the same parameters. Run blockchainwalletmock without parameters to see a list of available options.

Starting from within a test
---------------------------

[](#starting-from-within-a-test)

API
---

[](#api)

The goal is that the API should follow that of [https://blockchain.info/api/blockchain\_wallet\_api](https://blockchain.info/api/blockchain_wallet_api), but it is not 100% complete currently. I have only implemented what I need for my own purpose so far. If there is something missing give me a shout and I might be interested in adding the functions you need, or feel free to contribute... :)

The ID:s for addresses and transaction hashes are not real bitcoin addresses, but actually random MD5 sums. This is deliberate in order to not confuse them with real bitcoin addresses.

Apart from the functions docummented there, there are some special ones prefixed with `debug_` that we can use for debugging.

`/debug_incoming?address=$address&amount=$amount`

- **address** The address that should receive an incoming payment.
- **amount** The amount to add to the balance of the address.

Simulates an incoming transactions. If we have a callback registered it will be called in the same way as when we use the blockchain.info API.

`debug_confirmation?address=$address&transaction=$transaction&confirmations=$confirmations`

- **address** *Optional.* The address that should receive confirmations for all its transactions.
- **transaction** *Optional.* The transaction hash of the transaction that should receive a confirmation.
- **confirmations** *Optional.* The number of confirmations to add.

Simulates one or several confirmations. Both the address and transaction hash is optional, in which case all transactions will receive a confirmation.

`/debug_clear`

Clear all the data in the database.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

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

Total

14

Last Release

3962d ago

### Community

Maintainers

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

---

Top Contributors

[![limikael](https://avatars.githubusercontent.com/u/902911?v=4)](https://github.com/limikael "limikael (37 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/limikael-blockchainwalletmock/health.svg)

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

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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