PHPackages                             offline-agency/aws-blockchain-laravel - 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. [API Development](/categories/api)
4. /
5. offline-agency/aws-blockchain-laravel

ActiveLibrary[API Development](/categories/api)

offline-agency/aws-blockchain-laravel
=====================================

AWS Blockchain integration package for Laravel supply chain applications

0.0.4(6mo ago)027MITPHPPHP ^8.3CI passing

Since Nov 5Pushed 6mo agoCompare

[ Source](https://github.com/offline-agency/aws-blockchain-laravel)[ Packagist](https://packagist.org/packages/offline-agency/aws-blockchain-laravel)[ GitHub Sponsors](https://github.com/OfflineAgency)[ RSS](/packages/offline-agency-aws-blockchain-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (13)Versions (6)Used By (0)

AWS Blockchain Laravel
======================

[](#aws-blockchain-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fde3fbb5e7d6ffb92f1265350b9154597744dd1fc09055f975ca0594a0718f3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f66666c696e652d6167656e63792f6177732d626c6f636b636861696e2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/offline-agency/aws-blockchain-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/08e1e7977c6a042eccdee4370a5cb5854c785d5bca2830141242b005442fd6da/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f66666c696e652d6167656e63792f6177732d6c61726176656c2d626c6f636b636861696e2f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/offline-agency/aws-laravel-blockchain/actions?query=workflow%3ATests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/ffa2f6630bb165b8a0a2785df2cf3932896a8a4e19fa775ea9f7c85b9648b7e4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f66666c696e652d6167656e63792f6177732d6c61726176656c2d626c6f636b636861696e2f636f64652d7374796c652e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/offline-agency/aws-laravel-blockchain/actions?query=workflow%3A%22Code+Style%22+branch%3Amain)[![codecov](https://camo.githubusercontent.com/e198bde741552944139826c6ea3336f3e6b928131562a412d1cefb25b5e7815c/68747470733a2f2f636f6465636f762e696f2f6769746875622f6f66666c696e652d6167656e63792f6177732d626c6f636b636861696e2d6c61726176656c2f67726170682f62616467652e7376673f746f6b656e3d4961557a433559656e48)](https://codecov.io/github/offline-agency/aws-blockchain-laravel)[![Total Downloads](https://camo.githubusercontent.com/dc816f3ada4a5772b9ec4f5dc521fbb9f5d5d7f0f51ab819ad0daa963b7d0b30/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f66666c696e652d6167656e63792f6177732d626c6f636b636861696e2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/offline-agency/aws-blockchain-laravel)

A comprehensive Laravel package for AWS blockchain integration, specifically designed for supply chain traceability applications.

[![AWS Blockchain Laravel Banner](https://camo.githubusercontent.com/5adb7324e8be793f66d8b98d580247ca0a54171043b9d0fa2638e093b3a1e541/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f415753253230426c6f636b636861696e2532304c61726176656c2e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6f66666c696e652d6167656e63792532466177732d626c6f636b636861696e2d6c61726176656c267061747465726e3d63616765267374796c653d7374796c655f32266465736372697074696f6e3d412b636f6d70726568656e736976652b4c61726176656c2b7061636b6167652b666f722b4157532b626c6f636b636861696e2b696e746567726174696f6e2532432b7370656369666963616c6c792b64657369676e65642b666f722b737570706c792b636861696e2b74726163656162696c6974792b6170706c69636174696f6e73266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/5adb7324e8be793f66d8b98d580247ca0a54171043b9d0fa2638e093b3a1e541/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f415753253230426c6f636b636861696e2532304c61726176656c2e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6f66666c696e652d6167656e63792532466177732d626c6f636b636861696e2d6c61726176656c267061747465726e3d63616765267374796c653d7374796c655f32266465736372697074696f6e3d412b636f6d70726568656e736976652b4c61726176656c2b7061636b6167652b666f722b4157532b626c6f636b636861696e2b696e746567726174696f6e2532432b7370656369666963616c6c792b64657369676e65642b666f722b737570706c792b636861696e2b74726163656162696c6974792b6170706c69636174696f6e73266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

Features
--------

[](#features)

- **Multiple Blockchain Drivers**: Support for EVM (Ethereum), AWS Managed Blockchain, Amazon QLDB, and Mock drivers
- **Direct JSON-RPC Implementation**: Native Ethereum JSON-RPC client without external Web3 dependencies
- **Dual Blockchain Architecture**: Separate public and private blockchain operations
- **Smart Contract Management**: Complete lifecycle management with Artisan commands
- **Data Separation**: Automatic categorization of public vs private data
- **Laravel Integration**: Seamless integration with Laravel's service container
- **Testing Support**: Mock drivers for testing without AWS credentials (90%+ code coverage)
- **Hot Reload**: Watch contract files and auto-redeploy during development
- **Gas Estimation**: Automatic gas estimation and transaction preview
- **Contract Upgrades**: Support for upgradeable contracts with rollback capability

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

[](#installation)

You can install the package via Composer:

```
composer require offline-agency/aws-blockchain-laravel
```

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

[](#configuration)

The package configuration is published to `config/aws-blockchain-laravel.php`:

```
return [
    'default_driver' => env('BLOCKCHAIN_DRIVER', 'mock'),
    'public_driver' => env('BLOCKCHAIN_PUBLIC_DRIVER', 'mock'),
    'private_driver' => env('BLOCKCHAIN_PRIVATE_DRIVER', 'mock'),

    'drivers' => [
        'mock' => [
            'type' => 'mock',
        ],
        'evm' => [
            'type' => 'evm',
            'network' => env('BLOCKCHAIN_EVM_NETWORK', 'mainnet'),
            'rpc_url' => env('BLOCKCHAIN_EVM_RPC_URL', 'http://localhost:8545'),
            'default_account' => env('BLOCKCHAIN_EVM_DEFAULT_ACCOUNT'),
        ],
        'managed_blockchain' => [
            'type' => 'managed_blockchain',
            'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
            'access_key_id' => env('AWS_ACCESS_KEY_ID'),
            'secret_access_key' => env('AWS_SECRET_ACCESS_KEY'),
            'network_id' => env('AWS_BLOCKCHAIN_NETWORK_ID'),
            'member_id' => env('AWS_BLOCKCHAIN_MEMBER_ID'),
            'node_id' => env('AWS_BLOCKCHAIN_NODE_ID'),
            'channel_name' => env('BLOCKCHAIN_CHANNEL_NAME', 'mychannel'),
            'chaincode_name' => env('BLOCKCHAIN_CHAINCODE_NAME', 'supply-chain'),
        ],
        'qldb' => [
            'type' => 'qldb',
            'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
            'access_key_id' => env('AWS_ACCESS_KEY_ID'),
            'secret_access_key' => env('AWS_SECRET_ACCESS_KEY'),
            'ledger_name' => env('AWS_QLDB_LEDGER_NAME', 'supply-chain-ledger'),
        ],
    ],
];
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use AwsBlockchain\Laravel\Facades\Blockchain;

// Get public driver
$publicDriver = Blockchain::publicDriver();

// Get private driver
$privateDriver = Blockchain::privateDriver();

// Record an event
$eventId = $publicDriver->recordEvent($data);

// Get an event
$event = $publicDriver->getEvent($eventId);

// Verify integrity
$isValid = $publicDriver->verifyIntegrity($eventId, $data);
```

### Using the Service Container

[](#using-the-service-container)

```
// Get the blockchain manager
$manager = app('blockchain');

// Get specific drivers
$publicDriver = app('blockchain.public');
$privateDriver = app('blockchain.private');
```

Drivers
-------

[](#drivers)

### MockDriver

[](#mockdriver)

Perfect for testing and development. Stores events in memory and provides simulated blockchain operations.

```
$driver = new \AwsBlockchain\Laravel\Drivers\MockDriver('mock');
```

### EvmDriver

[](#evmdriver)

Ethereum Virtual Machine (EVM) compatible blockchain driver. Supports Ethereum, Polygon, BSC, and other EVM-compatible networks. Uses direct JSON-RPC communication without external Web3 dependencies.

```
$driver = new \AwsBlockchain\Laravel\Drivers\EvmDriver([
    'network' => 'mainnet',
    'rpc_url' => 'https://mainnet.infura.io/v3/YOUR-PROJECT-ID',
    'default_account' => '0x...',
]);
```

Features:

- Direct JSON-RPC implementation (no external Web3 library)
- Smart contract deployment and interaction
- Gas estimation and transaction management
- ABI encoding/decoding support

### ManagedBlockchainDriver

[](#managedblockchaindriver)

Integrates with AWS Managed Blockchain service for production blockchain operations.

```
$driver = new \AwsBlockchain\Laravel\Drivers\ManagedBlockchainDriver($config);
```

### QldbDriver

[](#qldbdriver)

Uses Amazon QLDB for immutable, cryptographically verifiable transaction logs.

```
$driver = new \AwsBlockchain\Laravel\Drivers\QldbDriver($config);
```

Note: QLDB is a ledger database, not an EVM-compatible blockchain. Smart contract operations are not supported with QLDB.

Data Separation
---------------

[](#data-separation)

The package automatically separates data into public and private categories:

**Public Data** (transparent blockchain):

- Product origin
- Certifications
- Public timestamps
- Quality scores

**Private Data** (confidential blockchain):

- Supplier details
- Pricing information
- Internal notes
- Sensitive locations

Testing
-------

[](#testing)

The package includes comprehensive testing support with mock drivers that don't require AWS credentials:

```
// In your tests
$this->app->bind('blockchain.public', function () {
    return new \AwsBlockchain\Laravel\Drivers\MockDriver('mock');
});
```

Smart Contract Management
-------------------------

[](#smart-contract-management)

The package provides comprehensive Artisan commands for deploying and managing smart contracts on both EVM (Ethereum) and Hyperledger Fabric blockchains.

### Installation &amp; Setup

[](#installation--setup)

Publish the configuration and migrations:

```
php artisan vendor:publish --tag=aws-blockchain-laravel-config
php artisan vendor:publish --tag=aws-blockchain-laravel-migrations
php artisan migrate
```

### Available Commands

[](#available-commands)

#### Deploy a Contract

[](#deploy-a-contract)

Deploy a new smart contract with automatic gas estimation:

```
php artisan blockchain:deploy MyContract \
    --constructor="constructor(uint256 initialSupply)" \
    --params="1000000" \
    --network=local \
    --verify
```

Options:

- `--constructor`: Constructor signature
- `--params`: Constructor parameters (JSON or comma-separated)
- `--network`: Target network (mainnet, sepolia, local, fabric)
- `--from`: Deployer address
- `--source`: Path to Solidity source file
- `--contract-version`: Contract version (default: 1.0.0)
- `--verify`: Verify on block explorer after deployment
- `--preview`: Preview deployment without executing
- `--gas-limit`: Manual gas limit
- `--json`: Output in JSON format for CI/CD

#### Upgrade a Contract

[](#upgrade-a-contract)

Upgrade an existing upgradeable contract:

```
php artisan blockchain:upgrade MyContract@v1 \
    --preserve-state \
    --migration=update_contract_v2 \
    --source=contracts/MyContractV2.sol
```

Options:

- `--preserve-state`: Preserve contract state during upgrade
- `--migration`: Run data migration script
- `--source`: Path to new contract source
- `--from`: Address performing the upgrade
- `--json`: JSON output

#### Call a Contract Method

[](#call-a-contract-method)

Interact with deployed contracts:

```
php artisan blockchain:call MyContract getBalance \
    --params="0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb" \
    --network=mainnet
```

Options:

- `--params`: Method parameters
- `--from`: Sender address (for transactions)
- `--network`: Network filter
- `--wait`: Wait for transaction confirmation
- `--gas-limit`: Manual gas limit
- `--json`: JSON output

#### Test a Contract

[](#test-a-contract)

Deploy and test a contract on a test network:

```
php artisan blockchain:test MyContract \
    --network=sepolia \
    --coverage
```

Options:

- `--network`: Test network (default: local)
- `--coverage`: Generate code coverage report
- `--source`: Contract source file
- `--json`: JSON output

#### Compile a Contract

[](#compile-a-contract)

Compile Solidity without deploying:

```
php artisan blockchain:compile contracts/MyContract.sol MyContract --contract-version=1.0.0
```

#### List Contracts

[](#list-contracts)

View all deployed contracts:

```
php artisan blockchain:list --network=mainnet --status=deployed
```

#### Contract Status

[](#contract-status)

Show detailed contract information:

```
php artisan blockchain:status MyContract --network=mainnet
```

#### Verify Contract

[](#verify-contract)

Verify contract source on block explorer:

```
php artisan blockchain:verify MyContract --network=mainnet
```

#### Rollback Contract

[](#rollback-contract)

Rollback to a previous version:

```
php artisan blockchain:rollback MyContract --target-version=1.0.0
```

#### Watch Contracts (Hot Reload)

[](#watch-contracts-hot-reload)

Auto-recompile and redeploy on file changes:

```
php artisan blockchain:watch --network=local
```

### CI/CD Integration

[](#cicd-integration)

All commands support `--json` flag for machine-readable output:

```
php artisan blockchain:deploy MyContract --json | jq '.contract.address'
```

Example CI/CD workflow:

```
- name: Deploy Contract
  run: |
    RESULT=$(php artisan blockchain:deploy MyToken --params="1000000" --json)
    ADDRESS=$(echo $RESULT | jq -r '.contract.address')
    echo "CONTRACT_ADDRESS=$ADDRESS" >> $GITHUB_ENV
```

Environment Variables
---------------------

[](#environment-variables)

Add these to your `.env` file for production:

```
# AWS Credentials
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_DEFAULT_REGION=us-east-1

# Blockchain Configuration
BLOCKCHAIN_DRIVER=mock
BLOCKCHAIN_PUBLIC_DRIVER=mock
BLOCKCHAIN_PRIVATE_DRIVER=mock

# For production with AWS
BLOCKCHAIN_PUBLIC_DRIVER=managed_blockchain
BLOCKCHAIN_PRIVATE_DRIVER=qldb

# AWS Blockchain Settings
AWS_BLOCKCHAIN_NETWORK_ID=your_network_id
AWS_BLOCKCHAIN_MEMBER_ID=your_member_id
AWS_BLOCKCHAIN_NODE_ID=your_node_id
BLOCKCHAIN_CHANNEL_NAME=mychannel
BLOCKCHAIN_CHAINCODE_NAME=supply-chain

# QLDB Settings
AWS_QLDB_LEDGER_NAME=supply-chain-ledger

# EVM Network RPC URLs
BLOCKCHAIN_MAINNET_RPC=https://mainnet.infura.io/v3/YOUR-PROJECT-ID
BLOCKCHAIN_SEPOLIA_RPC=https://sepolia.infura.io/v3/YOUR-PROJECT-ID
BLOCKCHAIN_LOCAL_RPC=http://localhost:8545

# EVM Settings
BLOCKCHAIN_EVM_NETWORK=mainnet
BLOCKCHAIN_EVM_RPC_URL=https://mainnet.infura.io/v3/YOUR-PROJECT-ID
BLOCKCHAIN_EVM_DEFAULT_ACCOUNT=0x...

# Block Explorer API Keys
ETHERSCAN_API_KEY=your_etherscan_api_key
```

### Contract Configuration

[](#contract-configuration)

Configure networks, compiler settings, and gas options in `config/aws-blockchain-laravel.php`:

```
'contracts' => [
    'networks' => [
        'mainnet' => [
            'type' => 'evm',
            'rpc_url' => env('BLOCKCHAIN_MAINNET_RPC'),
            'chain_id' => 1,
            'explorer_url' => 'https://etherscan.io',
            'explorer_api_key' => env('ETHERSCAN_API_KEY'),
        ],
        'sepolia' => [
            'type' => 'evm',
            'rpc_url' => env('BLOCKCHAIN_SEPOLIA_RPC'),
            'chain_id' => 11155111,
        ],
        'local' => [
            'type' => 'evm',
            'rpc_url' => env('BLOCKCHAIN_LOCAL_RPC', 'http://localhost:8545'),
            'chain_id' => 1337,
        ],
        'fabric' => [
            'type' => 'fabric',
            'network_id' => env('AWS_BLOCKCHAIN_NETWORK_ID'),
            'member_id' => env('AWS_BLOCKCHAIN_MEMBER_ID'),
        ],
    ],

    'compiler' => [
        'solc_path' => env('SOLC_PATH', 'solc'),
        'optimize' => true,
        'optimize_runs' => 200,
    ],

    'gas' => [
        'default_limit' => 3000000,
        'price_multiplier' => 1.1,
        'max_priority_fee' => 2000000000, // 2 gwei
        'max_fee_per_gas' => 100000000000, // 100 gwei
    ],
],
```

### Features

[](#features-1)

#### Gas Estimation

[](#gas-estimation)

All commands automatically estimate gas before transactions:

```
# Preview shows estimated gas and costs
php artisan blockchain:deploy MyContract --preview
```

#### Transaction Preview

[](#transaction-preview)

Preview transactions before committing:

```
# Shows gas estimate, costs, and transaction details
php artisan blockchain:deploy MyContract --preview
```

#### Hot Reload for Development

[](#hot-reload-for-development)

Watch contracts for changes and automatically redeploy:

```
# Enable in config
BLOCKCHAIN_HOT_RELOAD=true

# Start watching
php artisan blockchain:watch
```

#### Upgradeable Contracts

[](#upgradeable-contracts)

Support for proxy pattern upgrades with state preservation:

```
# Deploy upgradeable contract
php artisan blockchain:deploy MyContract --upgradeable

# Upgrade to new version
php artisan blockchain:upgrade MyContract@v2 --preserve-state

# Rollback if needed
php artisan blockchain:rollback MyContract --target-version=1.0.0
```

### Contract Storage

[](#contract-storage)

Contracts are stored in:

- **Artifacts**: `storage/app/contracts/{name}/{version}/artifact.json`
- **Database**: `blockchain_contracts` and `blockchain_transactions` tables

### Testing

[](#testing-1)

Run the test suite:

```
composer test
composer test-coverage
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review our [security policy](SECURITY.md) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- **Offline Agency**
- **All Contributors**

Based on [italia/spid-laravel](https://github.com/italia/spid-laravel)

Support
-------

[](#support)

For support and questions:

- **Email**:
- **GitHub Issues**: [Create an issue](https://github.com/offline-agency/aws-laravel-blockchain/issues)

License
-------

[](#license)

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

About Offline Agency
--------------------

[](#about-offline-agency)

Offline Agency is a web development agency based in Italy, specializing in Laravel and Filament applications.

- **Website**:
- **GitHub**: [@offline-agency](https://github.com/offline-agency)
- **Email**:

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance69

Regular maintenance activity

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

Total

4

Last Release

181d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/33f8b76656d71bddf83e5924863f37dea04f3f89196e7fb9cf25e30c3ee27093?d=identicon)[offlineagency](/maintainers/offlineagency)

---

Top Contributors

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

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/offline-agency-aws-blockchain-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/offline-agency-aws-blockchain-laravel/health.svg)](https://phpackages.com/packages/offline-agency-aws-blockchain-laravel)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.8M26](/packages/genealabs-laravel-model-caching)[laravel/pennant

A simple, lightweight library for managing feature flags.

57311.1M53](/packages/laravel-pennant)[mikebronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k127.1k1](/packages/mikebronner-laravel-model-caching)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)

PHPackages © 2026

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