PHPackages                             sakoora0x/laravel-bitcoin-module - 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. sakoora0x/laravel-bitcoin-module

ActiveLibrary

sakoora0x/laravel-bitcoin-module
================================

Laravel Bitcoin Module

010PHP

Since Oct 24Pushed 6mo agoCompare

[ Source](https://github.com/sakoora0x/laravel-bitcoin-module)[ Packagist](https://packagist.org/packages/sakoora0x/laravel-bitcoin-module)[ RSS](/packages/sakoora0x-laravel-bitcoin-module/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Pest Laravel Expectations](https://camo.githubusercontent.com/51d922ef14f029f9b0ce24a1847beb01238b17e0fc39c97df9f32b3df5bb24d8/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f426974636f696e2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6d6f6c6c736f66742532466c61726176656c2d626974636f696e2d6d6f64756c65267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d576f726b696e672b776974682b63727970746f63757272656e63792b426974636f696e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/51d922ef14f029f9b0ce24a1847beb01238b17e0fc39c97df9f32b3df5bb24d8/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f426974636f696e2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6d6f6c6c736f66742532466c61726176656c2d626974636f696e2d6d6f64756c65267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d576f726b696e672b776974682b63727970746f63757272656e63792b426974636f696e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

[ ![Latest Version on Packagist](https://camo.githubusercontent.com/f02aecf98fe75239f33d37463e05e537a438fc828a3992d5f61534538b31e5a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616b6f6f726130782f6c61726176656c2d626974636f696e2d6d6f64756c652e7376673f7374796c653d666c61742663616368655365636f6e64733d33363030)](https://packagist.org/packages/sakoora0x/laravel-bitcoin-module)[ ![Php Version](https://camo.githubusercontent.com/af3c14fed4241be47ccc899f006a8cddf0bd4f0ee21ac9b1ed280a351df75c08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d382e322d627269676874677265656e2e7376673f6d61784167653d32353932303030)](https://www.php.net)[ ![Laravel Version](https://camo.githubusercontent.com/93ebaaac239cc58970e58aee4b520fca00886097715f1a14eee00ef0b4b26abc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d313125323025374325323031322d7265642e7376673f6d61784167653d32353932303030)](https://laravel.com/)[ ![Total Downloads](https://camo.githubusercontent.com/7ca0c93c3059e236864e838e1583fedfccd0c777cb34689aa71c900bf028268e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616b6f6f726130782f6c61726176656c2d626974636f696e2d6d6f64756c652e7376673f7374796c653d666c61742663616368655365636f6e64733d33363030)](https://packagist.org/packages/sakoora0x/laravel-bitcoin-module)[![Website](https://camo.githubusercontent.com/32092acc7d40888936c3ebeecec5d97294fed6ea1561fcbbcd17ec7a0a001c2e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f576562736974652d68747470733a2f2f6d6f6c6c736f66742e636f6d2d626c61636b)](https://mollsoft.com)[![Telegram](https://camo.githubusercontent.com/10db3b0fd4e2c0154cd02533cfc67c102acd88202857f79f950885ddaa0843e1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54656c656772616d2d406d6f6c6c736f66742d626c7565)](https://t.me/mollsoft)

---

**Laravel Bitcoin Module** is a Laravel package for work with cryptocurrency Bitcoin. You can create descriptor wallets, generate addresses, track current balances, collect transaction history, organize payment acceptance on your website, and automate outgoing transfers.

You can contact me for help in integrating payment acceptance into your project.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Examples](#examples)
- [Installation](#installation)
- [Commands](#commands)
- [WebHook](#webhook)
- [Testing](#testing)
- [Requirements](#requirements)
- [Configuring RPC Authentication](#configuring-rpc-authentication)

Features
--------

[](#features)

- ✅ **Multi-Node Support** - Manage multiple Bitcoin nodes
- ✅ **Descriptor Wallets** - Create and import descriptor-based wallets
- ✅ **Address Generation** - Support for all address types (Legacy, P2SH-SegWit, Bech32, Bech32m)
- ✅ **Transaction Management** - Send BTC, send all, custom fee rates
- ✅ **Automated Syncing** - Background wallet synchronization
- ✅ **Deposit Tracking** - Automatic incoming transaction detection
- ✅ **Webhook Support** - Get notified of new deposits
- ✅ **Encrypted Storage** - Secure wallet passwords and descriptors
- ✅ **Precise Decimals** - Satoshi-level precision (8 decimal places)
- ✅ **Laravel 11 &amp; 12** - Full support for latest Laravel versions
- ✅ **Comprehensive Tests** - 88 tests with 100% pass rate

Examples
--------

[](#examples)

Create Descriptor Wallet:

```
$name = 'my-wallet';
$password = 'password for encrypt wallet files';
$title = 'My First Wallet';

$node = Bitcoin::createNode('localhost', 'LocalHost', '127.0.0.1');
$wallet = Bitcoin::createWallet($node, $name, $password, $title);
```

Import Descriptor Wallet using descriptors:

```
$name = 'my-wallet';
$password = 'password for encrypt wallet files';
$descriptions = json_decode('DESCRIPTORS JSON', true);
$title = 'My First Wallet';

$node = Bitcoin::createNode('localhost', 'LocalHost', '127.0.0.1');
$wallet = Bitcoin::importWallet($node, $name, $descriptions, $password, $title);
```

Create address:

```
$wallet = BitcoinWallet::firstOrFail();
$title = 'My address title';

$address = Bitcoin::createAddress($wallet, AddressType::BECH32, $title);
```

Validate address:

```
$address = '....';

$node = BitcoinNode::firstOrFail();
$addressType = Bitcoin::validateAddress($node, $address);
if( $addressType === null ) {
    die('Address is not valid!');
}

var_dump($addressType); // Enum value of AddressType
```

Send all BTC from wallet:

```
$wallet = BitcoinWallet::firstOrFail();
$address = 'to_address';

$txid = Bitcoin::sendAll($wallet, $address);

echo 'TXID: '.$txid;
```

Send BTC from wallet:

```
$wallet = BitcoinWallet::firstOrFail();
$address = 'to_address';
$amount = 0.001;

$txid = Bitcoin::send($wallet, $address, $amount);

echo 'TXID: '.$txid;
```

### Installation

[](#installation)

You can install the package via composer:

```
composer require sakoora0x/laravel-bitcoin-module
```

After you can run installer using command:

```
php artisan bitcoin:install
```

And run migrations:

```
php artisan migrate
```

The package will automatically register its service provider and facade via Laravel's package auto-discovery.

### Laravel 11+ Task Scheduling

[](#laravel-11-task-scheduling)

In Laravel 11+, add the following to your `routes/console.php` file:

```
use Illuminate\Support\Facades\Schedule;

Schedule::command('bitcoin:sync')
    ->everyMinute()
    ->runInBackground();
```

### Laravel 10 Task Scheduling

[](#laravel-10-task-scheduling)

For Laravel 10, add to `app/Console/Kernel.php` in the `schedule()` method:

```
$schedule->command('bitcoin:sync')
    ->everyMinute()
    ->runInBackground();
```

Commands
--------

[](#commands)

Scan transactions and update balances:

```
> php artisan bitcoin:sync
```

Scan transactions and update balances for wallet:

```
> php artisan bitcoin:sync-wallet {wallet_id}
```

WebHook
-------

[](#webhook)

You can set up a WebHook that will be called when a new incoming BTC deposit is detected.

In file config/bitcoin.php you can set param:

```
'webhook_handler' => \sakoora0x\LaravelBitcoinModule\WebhookHandlers\EmptyWebhookHandler::class,
```

Example WebHook handler:

```
class EmptyWebhookHandler implements WebhookHandlerInterface
{
    public function handle(BitcoinWallet $wallet, BitcoinAddress $address, BitcoinDeposit $transaction): void
    {
        Log::error('Bitcoin Wallet '.$wallet->name.' new transaction '.$transaction->txid.' for address '.$address->address);
    }
}
```

Testing
-------

[](#testing)

This package includes a comprehensive test suite with 88 tests covering all major components:

```
# Run all tests
composer test

# Run tests with coverage
composer test-coverage
```

The test suite includes:

- Unit tests for core functionality (RPC API, address validation, decimal casting)
- Feature tests for models, commands, and integration workflows
- 100% pass rate with 192 assertions

For more details, see [TEST\_STATUS.md](TEST_STATUS.md).

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

[](#requirements)

The following versions are supported by this package:

- PHP 8.2 or newer
- Laravel 11.x or 12.x
- PHP Extensions: BCMath (usually enabled by default)
- PHP Extensions: Decimal (optional, for better performance with decimal calculations)

### Configuring RPC Authentication

[](#configuring-rpc-authentication)

The `rpcauth` line in your `.bitcoin/bitcoin.conf` file contains authentication credentials for connecting to your Bitcoin node. To create a different login, you need to generate a new `rpcauth` string.

#### Using the rpcauth.py script (Recommended)

[](#using-the-rpcauthpy-script-recommended)

This package includes a Python script to generate these credentials:

1. Generate new credentials (replace `newusername` with your desired username):

```
python3 rpcauth.py newusername
```

This will output something like:

```
String to be appended to bitcoin.conf:
rpcauth=newusername:salt$hash
Your password:
randomGeneratedPassword123

```

3. Copy the `rpcauth` line to your config file and save the password - you'll need it to connect.

#### Manual generation

[](#manual-generation)

If you want to generate it manually, the format is:

```
rpcauth=username:salt$hmac_sha256(salt, password)

```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance46

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.5% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a57bfb0b7a98c2728ab3b8e2d9e41a18bd0f9d47fccefbd3ebc6d1293801f94?d=identicon)[sakoora0x](/maintainers/sakoora0x)

---

Top Contributors

[![mollsoft](https://avatars.githubusercontent.com/u/151442118?v=4)](https://github.com/mollsoft "mollsoft (28 commits)")[![sakoora0x](https://avatars.githubusercontent.com/u/239889939?v=4)](https://github.com/sakoora0x "sakoora0x (4 commits)")

### Embed Badge

![Health badge](/badges/sakoora0x-laravel-bitcoin-module/health.svg)

```
[![Health](https://phpackages.com/badges/sakoora0x-laravel-bitcoin-module/health.svg)](https://phpackages.com/packages/sakoora0x-laravel-bitcoin-module)
```

PHPackages © 2026

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