BlockPayGate Documentation

Everything you need to know to harness decentralized, zero-fee crypto payment routing natively on your own server.

Introduction

Standard crypto payment processors act as a "middleman", holding your funds in an escrow and charging you 1-3% to simply forward the transactions to you. BlockPayGate entirely eliminates the third party constraint.

By giving you direct control over your own HD Master Seed, our backend daemon generates millions of unique deposit addresses algorithmically. Players natively pay into these transit addresses, and BlockPayGate automatically sweeps them directly to your cold storage completely free of centralized fees.

Architecture Overview

  • Laravel 11 UI & API: Handles API proxying, Admin dashboard rendering, Webhook dispatching, and acts as the relational database bridge.
  • Node.js Web3 Daemon: An isolated process running web3.js that establishes WebSockets/HTTP connections to RPC nodes (Mainnet, BSC). Performs mathematical HD derivation, generates wallets without DB hit, and executes RAW signed transactions.
  • Daemon Workers: Artisan commands specifically built to act as supervisors (`blockpay:process-sweeps` and `blockpay:monitor-deposits`). They perpetually poll the system to find unconfirmed network transactions or orphaned wallets needing sweeps.

Treasury Sweeping Mechanics

The core logic behind the block processor is managing ERC20/TRC20 token balances across thousands of user wallets without leaving a massive stranded ETH/BNB gas deficit.

When 50.0 USDT enters a user's Hot Wallet, the user wallet does not contain the native ETH to pay for the gas to forward that USDT to your Treasury. The Sweeper Engine does the following:

  1. Query exact current network gas heuristics.
  2. Transfers exactly 0.00x ETH from the Master Hot Treasury into the Player Wallet.
  3. Wait for 1 confirmation block.
  4. Player Wallet executes signed Token Transfer sending 100% USDT to cold storage.

Webhook Events

To notify your primary Casino/Platform backend when a deposit is complete, BlockPayGate fires POST webhooks carrying HMAC-SHA256 signatures.

{ "event": "deposit.confirmed", "player_ref": "USER_8829", "internal_ref": "8192-AAAA-9912", "token": "USDT", "network": "TRC20", "amount_received": 100.00 }

Security Notice: Always verify the X-Signature header generated using your secret key to prevent spoofing.