PHPackages                             locpx/moralis-tracker - 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. locpx/moralis-tracker

ActiveLibrary

locpx/moralis-tracker
=====================

Laravel package to track and log multi-chain transactions for given addresses via Moralis API

v1.0.1(1w ago)02↓100%MITPHPPHP ^8.0

Since Mar 6Pushed 1w agoCompare

[ Source](https://github.com/phamxuanloc/moralis-tracker)[ Packagist](https://packagist.org/packages/locpx/moralis-tracker)[ RSS](/packages/locpx-moralis-tracker/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (7)Versions (3)Used By (0)

Moralis Tracker — Laravel Package
=================================

[](#moralis-tracker--laravel-package)

A Laravel package that tracks and logs transactions for one or more wallet addresses across **multiple EVM chains** (BSC, Ethereum, Polygon, Arbitrum, Base, Avalanche, and more) using the **Moralis API**, storing them in your database with full logging support.

---

Features
--------

[](#features)

- **Multi-chain** — track the same or different addresses on BSC, ETH, Polygon, Arbitrum, Base, Avalanche simultaneously
- Tracks **native**, **ERC-20/BEP-20 token**, and **NFT** transfers per chain
- Incremental sync — resumes from the last synced block per address per chain
- Cursor-based pagination — handles wallets with thousands of transactions
- Upsert strategy — new transactions inserted, existing ones updated on re-sync
- Configurable via `.env` and `config/moralis.php`
- Artisan commands: `moralis:sync` and `moralis:add-address`
- Auto-discovers via Laravel's package discovery
- Rate-limit aware with retry logic

---

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

[](#requirements)

- PHP ≥ 8.1
- Laravel 10 or 11
- A free [Moralis API key](https://admin.moralis.io/api-keys)
- `ext-bcmath` and `ext-curl` enabled

---

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

[](#installation)

### 1. Require via Composer

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

```
composer require locpx/moralis-tracker
```

### 2. Publish Config &amp; Migrations

[](#2-publish-config--migrations)

```
php artisan vendor:publish --tag=moralis-config
php artisan vendor:publish --tag=moralis-migrations
php artisan migrate
```

### 3. Configure `.env`

[](#3-configure-env)

```
# Get your free key at https://admin.moralis.io/api-keys
MORALIS_API_KEY=your_api_key_here

# Default chain when --chain is not specified (bsc, eth, polygon, arbitrum, base, avalanche)
MORALIS_CHAIN=bsc

# Optional: comma-separated addresses seeded on the default chain at first boot
MORALIS_ADDRESSES=0xabc123...,0xdef456...

# Optional overrides
MORALIS_TIMEOUT=30
MORALIS_MAX_RETRIES=3
MORALIS_LOG_CHANNEL=stack
```

---

Usage
-----

[](#usage)

### Add an address to track

[](#add-an-address-to-track)

```
# Track on the default chain (MORALIS_CHAIN)
php artisan moralis:add-address 0xYourAddress --label="My Wallet"

# Track the same address on multiple chains
php artisan moralis:add-address 0xYourAddress --chain=bsc  --label="BSC Wallet"
php artisan moralis:add-address 0xYourAddress --chain=eth  --label="ETH Wallet"
php artisan moralis:add-address 0xYourAddress --chain=polygon
```

### Sync transactions

[](#sync-transactions)

```
# Sync all active addresses on all chains
php artisan moralis:sync

# Sync only BSC addresses
php artisan moralis:sync --chain=bsc

# Sync a specific address on a specific chain
php artisan moralis:sync --address=0xYourAddress --chain=eth

# Sync from a specific block
php artisan moralis:sync --address=0xYourAddress --chain=bsc --from-block=25000000

# Force full re-sync (ignore last_synced_block)
php artisan moralis:sync --fresh
```

### Schedule automatic syncing

[](#schedule-automatic-syncing)

**Laravel 10 — `app/Console/Kernel.php`:**

```
protected function schedule(Schedule $schedule): void
{
    $schedule->command('moralis:sync')->everyMinute();
}
```

**Laravel 11 — `routes/console.php`:**

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

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

Add this cron entry to your server:

```
* * * * * cd /path-to-your-app && php artisan schedule:run >> /dev/null 2>&1
```

> Each sync fetches only blocks **newer than the last synced block**, so running every minute is efficient even across multiple chains.

---

Database Tables
---------------

[](#database-tables)

### `tracked_addresses`

[](#tracked_addresses)

ColumnTypeDescription`address`stringWallet address (0x...)`chain`stringChain key: `bsc`, `eth`, `polygon`, etc.`label`stringHuman-readable name (optional)`is_active`booleanWhether to sync this address`last_synced_block`bigintLast block synced (incremental)`last_synced_at`timestampTimestamp of last sync`meta`jsonExtra metadata> Unique key: `(address, chain)` — the same address can be tracked on multiple chains independently.

### `chain_transactions`

[](#chain_transactions)

ColumnTypeDescription`tx_hash`stringTransaction hash`type`string`normal`, `token`, `nft``chain`stringChain key: `bsc`, `eth`, `polygon`, etc.`tracked_address`stringAddress being tracked`block_number`bigintBlock number`block_timestamp`timestampBlock time`from_address`stringSender`to_address`stringReceiver`value_native`decimalValue in native currency (ETH/BNB/MATIC)`tx_fee_native`decimalFee in native currency`token_name`stringToken name (token/nft txs)`token_symbol`stringToken symbol`is_error`booleanWhether the tx failed`raw_data`jsonFull raw Moralis response> Unique key: `(tx_hash, type, chain, tracked_address)`

---

Programmatic Usage
------------------

[](#programmatic-usage)

```
use Locpx\MoralisTracker\Services\TransactionSyncService;
use Locpx\MoralisTracker\Models\ChainTransaction;
use Locpx\MoralisTracker\Models\TrackedAddress;

// Sync all chains
$service = app(TransactionSyncService::class);
$service->syncAll();

// Sync only BSC
$service->syncAll('bsc');

// Sync a specific address on a specific chain
$result = $service->syncByAddress('0xYourAddress', 'eth');
// $result = ['new' => 12, 'highestBlock' => 19340000]

// Query transactions
ChainTransaction::forAddress('0xYourAddress')->onChain('bsc')->ofType('token')->latest('block_number')->get();

// Get all incoming ETH transactions
ChainTransaction::onChain('eth')->incoming('0xYourAddress')->get();
```

---

Adding a Custom Chain
---------------------

[](#adding-a-custom-chain)

Add any Moralis-supported chain to `config/moralis.php`:

```
'chains' => [
    // ... existing chains ...
    'optimism' => [
        'name'              => 'Optimism',
        'moralis_id'        => 'optimism',
        'native_symbol'     => 'ETH',
        'transaction_types' => ['normal', 'token', 'nft'],
    ],
],
```

Then track an address on it:

```
php artisan moralis:add-address 0xYourAddress --chain=optimism
```

---

Configuration Reference
-----------------------

[](#configuration-reference)

```
// config/moralis.php
return [
    'api_key'       => env('MORALIS_API_KEY', ''),
    'base_url'      => env('MORALIS_BASE_URL', 'https://deep-index.moralis.io/api/v2.2'),
    'default_chain' => env('MORALIS_CHAIN', 'bsc'),

    'chains' => [
        'bsc'       => ['name' => 'BNB Smart Chain',    'moralis_id' => 'bsc',       'native_symbol' => 'BNB',  'transaction_types' => ['normal','token','nft']],
        'eth'       => ['name' => 'Ethereum',            'moralis_id' => 'eth',       'native_symbol' => 'ETH',  'transaction_types' => ['normal','token','nft']],
        'polygon'   => ['name' => 'Polygon',             'moralis_id' => 'polygon',   'native_symbol' => 'MATIC','transaction_types' => ['normal','token','nft']],
        'arbitrum'  => ['name' => 'Arbitrum One',        'moralis_id' => 'arbitrum',  'native_symbol' => 'ETH',  'transaction_types' => ['normal','token','nft']],
        'base'      => ['name' => 'Base',                'moralis_id' => 'base',      'native_symbol' => 'ETH',  'transaction_types' => ['normal','token','nft']],
        'avalanche' => ['name' => 'Avalanche C-Chain',   'moralis_id' => 'avalanche', 'native_symbol' => 'AVAX', 'transaction_types' => ['normal','token','nft']],
    ],

    'addresses'            => [],
    'timeout'              => env('MORALIS_TIMEOUT', 30),
    'max_retries'          => env('MORALIS_MAX_RETRIES', 3),
    'max_records_per_page' => 100,
    'start_block'          => 0,
    'log_channel'          => env('MORALIS_LOG_CHANNEL', 'stack'),

    'table_names' => [
        'tracked_addresses'  => 'tracked_addresses',
        'chain_transactions' => 'chain_transactions',
    ],
];
```

---

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 84% of packages

Maintenance98

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

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

Total

2

Last Release

13d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.0.1PHP ^8.0

### Community

Maintainers

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/locpx-moralis-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/locpx-moralis-tracker/health.svg)](https://phpackages.com/packages/locpx-moralis-tracker)
```

PHPackages © 2026

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