End-to-End Testnet Walkthrough
This guide walks you through a complete end-to-end flow: building all components from scratch, running the full stack locally, and executing a real distribution on Hedera Testnet using a test asset and USDC test funds.
Prerequisites
- All Full Development Setup steps completed
- Docker running (for PostgreSQL)
- A Hedera Testnet account with HBAR
- Access to the ATS staging environment (see Step 3)
Step 1: Build All Components in Order
Mass Payout depends on the ATS contracts and SDK. Build everything in the correct dependency order:
# 1. ATS contracts first (MP contracts depend on these ABIs)
npm run ats:contracts:build
# 2. Mass Payout contracts
npm run mass-payout:contracts:build
# 3. Mass Payout SDK (depends on MP contracts)
npm run mass-payout:sdk:build
# 4. Mass Payout backend (depends on MP SDK)
npm run mass-payout:backend:build
# 5. ATS SDK last (depends on ATS contracts)
npm run ats:sdk:build
Building mass-payout:contracts before ats:contracts will fail. Always start with ATS contracts.
Step 2: Start the Local Stack
2.1 Start the Database
cd apps/mass-payout/backend
docker compose up -d
2.2 Start the Backend
From the backend directory (required to load .env correctly):
cd apps/mass-payout/backend
npm run start:debug
The backend API will be available at http://localhost:3000.
Tip: Use
start:debuginstead ofstart:devto have the Node.js debugger available on port 9229, useful for stepping through distribution execution.
2.3 Start the Frontend
In a new terminal, from the monorepo root:
npm run mass-payout:frontend:dev
The frontend will be available at http://localhost:5173.
Step 3: Create a Test Asset in ATS Staging
You need a token deployed on Hedera Testnet to import into Mass Payout. Use the ATS staging environment:
- Go to the ATS staging app: https://asset-tokenization-studio-iobuilders.netlify.app/
- Password: Ask for it
- Connect your Hedera Testnet wallet
- Create a new security token (bond or equity)
- Mint tokens to at least one holder address
An address only becomes a token holder after tokens are minted to it. If you skip minting, Mass Payout will import the asset but show zero holders — no distribution can be executed. See Asset Imported But Shows Zero Holders for details.
Step 4: Import the Asset into Mass Payout
- Open the local frontend at http://localhost:5173
- Click Import Asset
- On the asset row, click the import button on the right side
- Follow the next steps to confirm the import
After import, the asset will appear in the dashboard with holder count and balances synced from the blockchain.
Step 5: Fund the Distributions Contract with Test USDC
Each imported asset has a Distributions SC address — the smart contract that will hold the funds to be distributed.
5.1 Find the Distributions SC Address
In the Mass Payout frontend:
- Navigate to the asset row
- Copy the Distributions SC address (format:
0.0.XXXXXXXX)
5.2 Get Test USDC from Circle Faucet
- Go to https://faucet.circle.com/
- Select Hedera Testnet as the network
- Paste the Distributions SC address as the recipient
- Request test USDC
5.3 Verify the Balance on Hashscan
- Go to https://hashscan.io/testnet/
- Search for the Distributions SC address
- Navigate to Associated Contract → Assets
- Confirm the USDC balance appears
Once the contract has funds, Mass Payout can execute a distribution to all token holders.
Step 6: Create and Execute a Distribution
- In the frontend, select the imported asset
- Click New Distribution
- Set the distribution amount and payment token (USDC)
- Review the list of holders and their proportional amounts
- Click Execute Payout
The backend will batch the payments via the Distributions contract and submit transactions to Hedera Testnet. You can monitor progress in the backend logs and verify transactions on Hashscan.
Troubleshooting
Backend fails to start after rebuilding contracts
The backend depends on generated ABIs from the contracts build. If you change contracts, rebuild in the correct order (Step 1) before restarting the backend.
Distribution SC shows no balance after faucet
- Confirm the faucet transaction was on Hedera Testnet (not another network)
- Wait ~10 seconds for Mirror Node indexing, then refresh Hashscan
- Ensure you used the Distributions SC address, not the token contract address
Holders not appearing after import
Tokens must be minted to holder addresses in ATS before importing. Re-mint in ATS, then click Sync Holders in the Mass Payout asset details page.