PHPackages                             nadun/eth-wallet-creator - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. nadun/eth-wallet-creator

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

nadun/eth-wallet-creator
========================

Laravel package for EVM compatible network wallet creation with mnemonic seed phrase support

v1.1.0(6mo ago)017MITPHPPHP ^7.3|^8.0|^8.1|^8.2|^8.3CI failing

Since Dec 23Pushed 6mo agoCompare

[ Source](https://github.com/nadunMadhushanka/web3-laravel-eth-wallet-creator)[ Packagist](https://packagist.org/packages/nadun/eth-wallet-creator)[ RSS](/packages/nadun-eth-wallet-creator/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (4)Used By (0)

Ethereum Wallet Creator for Laravel
===================================

[](#ethereum-wallet-creator-for-laravel)

[![Latest Version](https://camo.githubusercontent.com/6d7ddb17172a7f6d3461ce009016374b8ebc7f45decb42a827c6cada2e12b7b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6164756e2f6574682d77616c6c65742d63726561746f722e737667)](https://packagist.org/packages/nadun/eth-wallet-creator)[![License](https://camo.githubusercontent.com/ab807d1c5bd11ad0986b6fb8f533385c87de9d7615f574cdf93cd72f14c1d356/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6164756e2f6574682d77616c6c65742d63726561746f722e737667)](https://packagist.org/packages/nadun/eth-wallet-creator)

A powerful Laravel package for generating Ethereum wallets with **mnemonic seed phrase support** (BIP39). This package uses a hybrid approach combining PHP and Node.js (ethers.js) for secure cryptographic operations.

Features
--------

[](#features)

- ✅ **Generate new Ethereum wallets** with mnemonic phrases
- ✅ **Restore wallets** from mnemonic (12 or 24 words)
- ✅ **HD Wallet support** (BIP32/BIP44 derivation)
- ✅ **Derive child wallets** from mnemonic
- ✅ **Mnemonic validation**
- ✅ **Laravel Facade** for easy integration
- ✅ **Artisan commands** for CLI usage
- ✅ **Secure** cryptographic operations via ethers.js

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

[](#requirements)

- PHP 7.3 or higher
- Laravel 8.x, 9.x, 10.x, or 11.x
- Node.js 16+ (with npm)
- Composer

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require nadun/eth-wallet-creator
```

### 2. Install Node.js Dependencies

[](#2-install-nodejs-dependencies)

```
cd vendor/nadun/eth-wallet-creator
npm install
```

### 3. Publish Configuration (Optional)

[](#3-publish-configuration-optional)

```
php artisan vendor:publish --tag=eth-wallet-config
```

This creates `config/eth-wallet.php` where you can customize settings.

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

[](#configuration)

Edit `config/eth-wallet.php`:

```
return [
    // Path to Node.js executable
    'node_path' => env('ETH_WALLET_NODE_PATH', 'node'),

    // Default BIP44 derivation path for Ethereum
    'derivation_path' => env('ETH_WALLET_DERIVATION_PATH', "m/44'/60'/0'/0/0"),

    // Mnemonic strength: 128 (12 words) or 256 (24 words)
    'mnemonic_strength' => env('ETH_WALLET_MNEMONIC_STRENGTH', 128),

    // Timeout for Node.js process
    'timeout' => env('ETH_WALLET_TIMEOUT', 30),
];
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use Nadun\EthWallet\Facades\EthWallet;

// Generate a new wallet with 12-word mnemonic
$wallet = EthWallet::generate();

/* Returns:
[
    'address' => '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
    'privateKey' => '0x...',
    'publicKey' => '0x...',
    'mnemonic' => 'word1 word2 word3 ... word12',
    'derivationPath' => "m/44'/60'/0'/0/0",
    'path' => "m/44'/60'/0'/0/0"
]
*/
```

### Generate Wallet with 24 Words

[](#generate-wallet-with-24-words)

```
// 256 bits = 24 words
$wallet = EthWallet::generate(256);
```

### Restore Wallet from Mnemonic

[](#restore-wallet-from-mnemonic)

```
$mnemonic = "your twelve word mnemonic phrase goes here for wallet recovery";

$wallet = EthWallet::restoreFromMnemonic($mnemonic);
```

### Derive Child Wallets (HD Wallet)

[](#derive-child-wallets-hd-wallet)

```
$mnemonic = "your mnemonic phrase here";

// Derive wallet at index 0
$wallet0 = EthWallet::deriveChildWallet($mnemonic, 0);

// Derive wallet at index 1
$wallet1 = EthWallet::deriveChildWallet($mnemonic, 1);

// Each child has a unique address but shares the same mnemonic
```

### Validate Mnemonic

[](#validate-mnemonic)

```
$isValid = EthWallet::validateMnemonic("your mnemonic phrase");

if ($isValid) {
    echo "Valid mnemonic!";
}
```

### Get Address from Private Key

[](#get-address-from-private-key)

```
$data = EthWallet::getAddressFromPrivateKey('0x1234567890abcdef...');

/* Returns:
[
    'address' => '0x...',
    'publicKey' => '0x...'
]
*/
```

### Custom Derivation Path

[](#custom-derivation-path)

```
// Use custom BIP44 path
$wallet = EthWallet::generate(128, "m/44'/60'/0'/0/5");

// Or set globally
EthWallet::setDerivationPath("m/44'/60'/1'/0/0");
$wallet = EthWallet::generate();
```

Artisan Commands
----------------

[](#artisan-commands)

### Generate New Wallet

[](#generate-new-wallet)

```
# Generate wallet with 12 words
php artisan eth-wallet:generate

# Generate with 24 words
php artisan eth-wallet:generate --strength=256

# Custom derivation path
php artisan eth-wallet:generate --path="m/44'/60'/1'/0/0"

# JSON output
php artisan eth-wallet:generate --json
```

### Restore from Mnemonic

[](#restore-from-mnemonic)

```
# Restore main wallet
php artisan eth-wallet:restore "your twelve word mnemonic phrase here"

# Restore child wallet
php artisan eth-wallet:restore "your mnemonic" --index=5

# JSON output
php artisan eth-wallet:restore "your mnemonic" --json
```

### Validate Mnemonic

[](#validate-mnemonic-1)

```
php artisan eth-wallet:validate "your mnemonic phrase here"
```

Using in Controllers
--------------------

[](#using-in-controllers)

```
namespace App\Http\Controllers;

use Nadun\EthWallet\Facades\EthWallet;
use Illuminate\Http\Request;

class WalletController extends Controller
{
    public function createWallet()
    {
        try {
            $wallet = EthWallet::generate();

            // ⚠️ IMPORTANT: In production, encrypt and securely store:
            // - $wallet['privateKey']
            // - $wallet['mnemonic']

            return response()->json([
                'success' => true,
                'address' => $wallet['address'],
                // Never return private key or mnemonic to client!
            ]);

        } catch (\Exception $e) {
            return response()->json([
                'success' => false,
                'error' => $e->getMessage()
            ], 500);
        }
    }

    public function restoreWallet(Request $request)
    {
        $request->validate([
            'mnemonic' => 'required|string'
        ]);

        if (!EthWallet::validateMnemonic($request->mnemonic)) {
            return response()->json([
                'success' => false,
                'error' => 'Invalid mnemonic phrase'
            ], 422);
        }

        $wallet = EthWallet::restoreFromMnemonic($request->mnemonic);

        return response()->json([
            'success' => true,
            'address' => $wallet['address']
        ]);
    }
}
```

Dependency Injection
--------------------

[](#dependency-injection)

```
use Nadun\EthWallet\WalletService;

class MyService
{
    protected $walletService;

    public function __construct(WalletService $walletService)
    {
        $this->walletService = $walletService;
    }

    public function generateWallet()
    {
        return $this->walletService->generate();
    }
}
```

Security Best Practices
-----------------------

[](#security-best-practices)

### ⚠️ CRITICAL SECURITY WARNINGS

[](#️-critical-security-warnings)

1. **Never expose private keys or mnemonics** to clients or logs
2. **Always encrypt** private keys before database storage
3. **Use Laravel's encryption**: `encrypt($wallet['privateKey'])`
4. **Never commit** wallets or keys to version control
5. **Store mnemonics securely** - they control all derived wallets
6. **Use HTTPS** for all wallet-related API endpoints
7. **Implement rate limiting** on wallet generation endpoints

### Secure Storage Example

[](#secure-storage-example)

```
use Illuminate\Support\Facades\Crypt;

// Generate wallet
$wallet = EthWallet::generate();

// Encrypt sensitive data before storing
$encryptedPrivateKey = Crypt::encryptString($wallet['privateKey']);
$encryptedMnemonic = Crypt::encryptString($wallet['mnemonic']);

// Store in database
DB::table('wallets')->insert([
    'address' => $wallet['address'],
    'encrypted_private_key' => $encryptedPrivateKey,
    'encrypted_mnemonic' => $encryptedMnemonic,
    'created_at' => now()
]);

// Later, decrypt when needed
$privateKey = Crypt::decryptString($encryptedPrivateKey);
```

BIP44 Derivation Paths
----------------------

[](#bip44-derivation-paths)

This package follows BIP44 standard for HD wallets:

```
m / purpose' / coin_type' / account' / change / address_index

Default Ethereum path: m/44'/60'/0'/0/0
├─ 44' = BIP44
├─ 60' = Ethereum
├─ 0'  = Account #0
├─ 0   = External chain
└─ 0   = Address #0

```

Error Handling
--------------

[](#error-handling)

```
use Nadun\EthWallet\Exceptions\WalletGenerationException;
use Nadun\EthWallet\Exceptions\NodeBridgeException;

try {
    $wallet = EthWallet::generate();
} catch (WalletGenerationException $e) {
    // Wallet generation failed
    Log::error('Wallet generation failed: ' . $e->getMessage());
} catch (NodeBridgeException $e) {
    // Node.js bridge communication error
    Log::error('Node bridge error: ' . $e->getMessage());
}
```

Testing
-------

[](#testing)

```
# Test Node.js bridge
npm test

# Laravel package tests
./vendor/bin/phpunit
```

Troubleshooting
---------------

[](#troubleshooting)

### "Node.js not found" Error

[](#nodejs-not-found-error)

Set the correct Node.js path in `.env`:

```
ETH_WALLET_NODE_PATH="C:\Program Files\nodejs\node.exe"
```

Or in `config/eth-wallet.php`:

```
'node_path' => 'C:\Program Files\nodejs\node.exe'
```

### Permission Issues

[](#permission-issues)

Ensure the Node.js script is executable:

```
chmod +x vendor/nadun/eth-wallet-creator/node-bridge/wallet-generator.js
```

Advanced Usage
--------------

[](#advanced-usage)

### Batch Wallet Generation

[](#batch-wallet-generation)

```
public function generateMultipleWallets(int $count)
{
    $wallets = [];

    for ($i = 0; $i < $count; $i++) {
        $wallets[] = EthWallet::generate();
    }

    return $wallets;
}
```

### One Mnemonic, Multiple Addresses

[](#one-mnemonic-multiple-addresses)

```
// Generate master mnemonic
$masterWallet = EthWallet::generate();
$mnemonic = $masterWallet['mnemonic'];

// Derive multiple addresses from same mnemonic
$addresses = [];
for ($i = 0; $i < 10; $i++) {
    $child = EthWallet::deriveChildWallet($mnemonic, $i);
    $addresses[] = $child['address'];
}

// All these addresses can be recovered with the single mnemonic!
```

License
-------

[](#license)

MIT License - see [LICENSE](LICENSE) file for details

Support
-------

[](#support)

For issues and questions:

- GitHub Issues:
- Email:

Contributing
------------

[](#contributing)

Pull requests are welcome! Please ensure:

1. Code follows PSR-12 standards
2. Tests pass
3. Security best practices are maintained

Credits
-------

[](#credits)

- Built with [ethers.js](https://docs.ethers.org/)
- BIP39/BIP44 implementation
- Laravel framework integration

---

**Made with ❤️ by Nadun**

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance67

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Total

3

Last Release

192d ago

PHP version history (2 changes)v1.0.0PHP ^8.0|^8.1|^8.2|^8.3

v1.1.0PHP ^7.3|^8.0|^8.1|^8.2|^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/112070908?v=4)[nadunMadhushanka](/maintainers/nadunMadhushanka)[@nadunMadhushanka](https://github.com/nadunMadhushanka)

---

Top Contributors

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

---

Tags

laravelwalletethereumweb3bip39mnemonic

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nadun-eth-wallet-creator/health.svg)

```
[![Health](https://phpackages.com/badges/nadun-eth-wallet-creator/health.svg)](https://phpackages.com/packages/nadun-eth-wallet-creator)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M305](/packages/laravel-horizon)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M165](/packages/spatie-laravel-health)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5752.3M18](/packages/directorytree-ldaprecord-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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