Download the PHP package mrokwor/blockchain-sdk-php without Composer

On this page you can find all versions of the php package mrokwor/blockchain-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package blockchain-sdk-php

Blockchain SDK for PHP

Latest Version on Packagist Total Downloads PHP Version Require

A high-performance, zero-third-party-cryptography blockchain SDK for PHP 8.2+ and Laravel (10, 11, 12, and 13). Generate multi-chain custodial/deposit addresses, validate addresses with EIP-55/Base58/Bech32 checksums, sign transactions locally and offline, estimate network fees, query token balances, auto-fuel gas to deposit sub-wallets, track deposits with database models, and sweep customer funds into master cold vaults across 17+ supported blockchains including EVM (Ethereum, BNB Smart Chain, Polygon, Arbitrum, Base, Optimism, Avalanche, Fantom, Cronos, Linea, Scroll, zkSync, Celo, Mantle), Solana, Bitcoin (Native SegWit Bech32), and TRON.

💡 Looking for working examples? Check out the official blockchain-sdk-php-examples repository for a complete runnable Laravel application featuring multi-chain wallet generation, deposit monitoring, transaction explorer discovery, and automated gas-sponsored token sweeps.


📚 Examples & Demo Application

We maintain a complete, ready-to-run demo application in the MrOkwor/blockchain-sdk-php-examples repository. It includes:


Features


Supported Networks & Driver Identifiers

The SDK supports 17 individual network drivers out of the box:

Driver Code Network Name Ecosystem Address Format Signing Algorithm
ethereum Ethereum Mainnet EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
bsc BNB Smart Chain EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
polygon Polygon POS EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
arbitrum Arbitrum One EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
optimism OP Mainnet EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
base Base EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
avalanche Avalanche C-Chain EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
fantom Fantom Opera EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
cronos Cronos Chain EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
linea Linea EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
scroll Scroll EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
zksync zkSync Era EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
celo Celo EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
mantle Mantle EVM EIP-55 Hex (0x...) Secp256k1 + EIP-155 / RLP
solana Solana Solana Base58 Public Key Ed25519 (Libsodium)
tron TRON TRON Base58Check (T...) Secp256k1 + SHA-256
bitcoin Bitcoin UTXO Native SegWit Bech32 (bc1q...) Secp256k1 + BIP-143

Requirements


Installation

Install the package via Composer:


Part 1: Laravel Integration Guide (Laravel 10, 11, 12, and 13)

If you are using Laravel, the package registers automatically via auto-discovery.

1. Publishing Assets

A. Publish Configuration File (config/blockchainsdk.php)

B. Publish Database Migrations

C. Publish Eloquent Models to app/Models/

D. Run Migrations


2. Generating Master Vaults & Hot Gas Wallets

To sweep customer deposits into a central vault or sponsor network fees for dry sub-wallets, your platform needs Master Cold Vault Receiving Addresses and Hot Gas Station credentials.

You can generate both in a single command with automatic AES-256 encryption and clean, separated .env blocks:

How Master & Gas Wallets Are Stored in .env

[!TIP] Independent Separation: You can change your BLOCKCHAIN_MASTER_* destination addresses anytime (e.g. directing funds to a Hardware Ledger or Gnosis Safe multisig) without affecting or resetting your BLOCKCHAIN_GAS_* fee sponsor keys.


3. Validating Wallet Addresses in Laravel

You can validate customer receiving/payout addresses using the Blockchain::validateAddress() facade or the built-in Laravel Validation Rule:

Option A: Using the BlockchainAddress Validation Rule in Form Requests / Controllers

Option B: Validating Directly via Facade


4. Generating Multi-Chain Deposit Wallets in Laravel

Option A: Using Eloquent Models (Recommended)

Automatically creates a wallet keypair, encrypts the private key, and associates it with a user in your database:

Option B: Using the Blockchain Facade Directly


5. Querying Balances & Checking Token Statuses in Laravel


5.5 Discovering Incoming Deposit Transaction Hashes

When customers deposit funds into temporary sub-wallets or personal addresses, you can automatically capture the incoming blockchain transaction hash across EVM, Solana, TRON, and Bitcoin without writing low-level RPC chunking loops:


6. Sweeping Sub-Wallets into Master Vaults in Laravel

A. Sweeping Native Currency via Facade

B. Sweeping Supported Tokens via Facade

C. Sweeping Dry Wallets with Automated Gas Sponsorship


7. Giving Value to Users After Sweeping or Depositing in Laravel

In crypto platforms and fintech applications, "giving value" means crediting the customer's account balance, ledger, or wallet in your application database. The SDK dispatches events so you can execute your own custom credit logic.

Paradigm A: Credit After Master Vault Sweep (Post-Sweep Hook)

  1. Execute the sweep command with the --credit flag:

  2. Listen to BlockchainSdk\Laravel\Events\WalletSwept in your application:

Paradigm B: Immediate Credit on Confirmed Deposit (Instant UX)

If you want users to receive their platform balance as soon as the transaction is confirmed on-chain (while vault sweeping runs asynchronously in the background):


8. Laravel Artisan Commands Reference

Command Description Options
php artisan blockchainsdk:generate-master-wallets Generates master cold vault receiving addresses and hot gas station credentials in separated .env blocks --network=, --no-encrypt, --no-store, --force
php artisan blockchainsdk:sweep Sweeps sub-wallets into central cold vault --network=, --token= (symbol/contract), --sponsor (auto-gas), --credit (dispatch value event)
php artisan blockchainsdk:monitor Multi-chain background deposit confirmation listener --network=, --token=, --once (run single pass)
php artisan vendor:publish --tag="blockchainsdk-config" Publishes config/blockchainsdk.php --force (overwrite existing)
php artisan vendor:publish --tag="blockchainsdk-migrations" Publishes database migrations --force (overwrite existing)
php artisan vendor:publish --tag="blockchainsdk-models" Publishes Eloquent models to app/Models/ --force (overwrite existing)

Part 2: Standalone / Vanilla PHP Guide (Non-Laravel)

You can use blockchain-sdk-php in any PHP application, microservice, or framework (Symfony, Slim, Laminas, WordPress, pure PHP CLI scripts) without Laravel.

1. Initialization

Instantiate the BlockchainManager with a configuration array:


2. Validating Addresses in Vanilla PHP


3. Generating Wallets in Vanilla PHP


4. Querying Balances & Checking Tokens in Vanilla PHP


5. Sweeping Sub-Wallets & Sponsoring Gas in Vanilla PHP


Part 3: Architecture & Security

Adding Custom Tokens

You can register new custom or standard ERC-20, SPL, or TRC-20 tokens on any blockchain by adding them to the tokens array:

Testing

Run the package test suite with PHPUnit:

Security Best Practices

  1. Keep Private Keys Encrypted at Rest: Always store custodial keys using strong symmetric encryption (e.g. AES-256-GCM / Laravel's Crypt::encryptString or casts => ['private_key' => 'encrypted']).
  2. Separate Cold Master Vaults from Hot Gas Stations: Keep your main reserves in cold storage (master_wallets), while maintaining small working balances in hot gas station wallets (master_gas_wallets) solely for gas fueling.
  3. Never Pass Private Keys over RPC: All signing in this library happens locally on your application server. The RPC nodes only receive the final, cryptographically signed raw byte payload.
  4. Use Dedicated RPC Nodes in Production: While public RPCs are supported, running dedicated nodes (e.g. QuickNode, Alchemy, Helius, Trongrid) provides higher throughput and zero rate-limiting.

License

The MIT License (MIT). Please see License File for more information.


All versions of blockchain-sdk-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-gmp Version *
ext-sodium Version *
ext-bcmath Version *
ext-json Version *
guzzlehttp/guzzle Version ^7.0 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mrokwor/blockchain-sdk-php contains the following files

Loading the files please wait ...