Here’s a usage guide for the BlockSense package, covering its main features and how to get started:
BlockSense Usage Guide
1. Installation
If published on Packagist:
composer require mohib/block-sense
If using locally, add to your composer.json
as a path repository (see previous instructions).
2. Autoloading
Include Composer’s autoloader in your project:
require 'vendor/autoload.php';
3. Core Components
Fraud Detection
-
FraudDetector: Central class to manage and apply fraud rules.
-
Rules: Built-in rules for fraud detection:
- `HighValueRule`: Flags high-value transactions.
- `SuspiciousAddressRule`: Flags transactions to/from suspicious addresses.
- `UnknownSenderRule`: Flags transactions from unknown senders.
Example:
use BlockSense\FraudDetector;
use BlockSense\Rules\HighValueRule;
use BlockSense\Rules\SuspiciousAddressRule;
$detector = new FraudDetector();
$detector->addRule(new HighValueRule(1000)); // Flag tx > 1000
$detector->addRule(new SuspiciousAddressRule(['0xBAD1', '0xBAD2']));
$tx = ['value' => 1500, 'from' => '0xabc', 'to' => '0xBAD1'];
if ($detector->checkTransaction($tx)) {
echo "Fraud detected!";
} else {
echo "Transaction is clean.";
}
Compliance Engine
-
ComplianceEngine: For advanced compliance checks and reporting.
Block Monitoring
-
BlockMonitor: For real-time blockchain transaction monitoring.
Utilities
-
CurrencyConverter: Convert between cryptocurrencies and fiat.
-
Logger: Logging utility.
Example:
use BlockSense\Util\CurrencyConverter;
$converter = new CurrencyConverter();
$usd = $converter->convert('BTC', 'USD', 0.01);
echo \"0.01 BTC is $usd USD\";
Providers (Interfaces for Extensibility)
-
`FraudRuleInterface`: Create custom fraud rules.
-
`BlockchainProviderInterface`: Integrate with different blockchains.
-
`ExchangeRateProviderInterface`: Custom exchange rate sources.
-
`ReportGeneratorInterface`: Custom reporting.
-
`WebSocketServerInterface`: Real-time event handling.
4. Testing
To run the package’s tests:
composer install
composer test
5. Extending BlockSense
You can implement your own rules or providers by implementing the relevant interfaces in src/Providers/
.
Would you like a ready-to-use README.md with this content, or more detailed code examples for any specific feature?
BlockSense - Real-Time Blockchain Monitoring & Fraud Detection for PHP

/$$$$$$$ /$$ /$$ /$$$$$$
| $$__ $$| $$ | $$ /$$__ $$
| $$ \ $$| $$ /$$$$$$ /$$$$$$$| $$ /$$| $$ \__/ /$$$$$$ /$$$$$$$ /$$$$$$$ /$$$$$$
| $$$$$$$ | $$ /$$__ $$ /$$_____/| $$ /$$/| $$$$$$ /$$__ $$| $$__ $$ /$$_____/ /$$__ $$
| $$__ $$| $$| $$ \ $$| $$ | $$$$$$/ \____ $$| $$$$$$$$| $$ \ $$| $$$$$$ | $$$$$$$$
| $$ \ $$| $$| $$ | $$| $$ | $$_ $$ /$$ \ $$| $$_____/| $$ | $$ \____ $$| $$_____/
| $$$$$$$/| $$| $$$$$$/| $$$$$$$| $$ \ $$| $$$$$$/| $$$$$$$| $$ | $$ /$$$$$$$/| $$$$$$$
|_______/ |__/ \______/ \_______/|__/ \__/ \______/ \_______/|__/ |__/|_______/ \_______/
---------------------------------------------------------------
REAL-TIME BLOCKCHAIN MONITORING & FRAUD DETECTION FOR PHP
---------------------------------------------------------------
> Enterprise-grade blockchain security for PHP developers
? Features
-
Real-time monitoring (BTC/ETH/BSC) via WebSocket/API
-
Custom fraud rules (high-value TXs, unknown senders, etc.)
-
Compliance tools (FATF/OFAC report generation)
-
Laravel & Symfony integration
-
AI-powered anomaly detection