Developer’s Guide: Integrating VelumX
Welcome to VelumX! This guide will help you integrate gasless transactions into your Stacks dApp using our Native Sponsorship infrastructure.[!NOTE] No Smart Wallets Required: Unlike traditional Account Abstraction, VelumX uses Stacks’ native sponsorship. Users don’t need to deploy a smart wallet; they can use their existing Leather, Xverse, or OKX wallets immediately.
1. Setup & Configuration
Get your API Key
Log in to the VelumX Dashboard and create a new project to generate yourAPI_KEY.
Fund your Relayer Node
On your Dashboard, you will see a unique Relayer Node Address (Hot Wallet).- This wallet is uniquely derived for you using our Master Key system.
- Action Required: You must send a small amount of STX to this address to “fill your gas tank.” This STX will be used to pay for your users’ transactions.
2. Install the SDK
Add the VelumX SDK to your project:3. Integration Patterns
A. Secure Production Pattern (Recommended)
For production, initialize the SDK using a Secure Proxy. This ensures yourvelumx_live_ API key is never exposed to the client.
B. Direct SDK Pattern (Development Only)
You can connect directly to the relayer during local development.4. Sponsorship Policies
VelumX supports two primary sponsorship models managed via the Project Settings in your Dashboard.A. USER_PAYS Policy (Default)
In this model, the user pays a fee in a SIP-010 token (e.g., USDCx, ALEX, sBTC) to compensate the relayer for the gas fee.- UX: User sees a small token fee in the confirmation UI.
- Revenue: You can collect a markup on top of the gas cost.
- Requirement: User must hold the selected
feeToken.
B. DEVELOPER_SPONSORS Policy (Zero-Gas UX)
In this model, the developer pays 100% of the gas using their Relayer’s STX balance. The user pays nothing.- UX: Pure “Gasless” experience—user pays $0.00 and 0 tokens.
- Growth: Ideal for onboarding new users who hold no assets yet.
- Requirement: Your Relayer Node must have sufficient STX balance.
5. 🔐 Security: The Proxy Architecture
CRITICAL: In production, your API key must stay on the server. Implement a Proxy Route in your backend (Next.js, Express, etc.) to securely communicate with VelumX.Next.js Proxy Example (/api/velumx/proxy/[...path]/route.ts)
6. Understanding Revenue & Fees
The transaction flow depends on your selected Sponsorship Policy:With USER_PAYS (Revenue Model)
- User Pays Fee: The user pays your dApp’s specific fee (e.g. 0.25 USDCx) as part of their transaction logic.
- SDK Reports Fee: When you call
.sponsor(txHex, { feeAmount: '250000' }), the SDK reports this volume to the Relayer. - Dashboard Analytics: The Relayer matches your API Key to the reported fee. Your USDCx Revenue chart on the dashboard will update in real-time.
- Relayer Pays Gas: The relayer node uses its STX to broadcast the transaction.
With DEVELOPER_SPONSORS (Growth Model)
- User Pays Nothing: The
feeAmountis automatically ignored or set to0by the Relayer logic. - Zero-Token UX: The user’s wallet confirmation will show a total cost of 0 tokens and 0 STX.
- Gas Expenditure: Each transaction consumes a small amount of STX (typically 0.005 STX) from your Relayer Node’s balance.
- Volume Tracking: Your Dashboard will track the number of sponsored transactions and total STX spent instead of token revenue.