Skip to main content

Getting Started

Integrate gasless transactions into your Stacks dApp in minutes.
No Smart Wallets Required: VelumX uses Stacks’ native sponsored transaction capability. Users keep their existing Leather, Xverse, or OKX wallets.

1. Get Your API Key

Log in to the VelumX Dashboard and create a new project. You’ll receive:
  • A VELUMX_API_KEY — your server-side credential
  • A Relayer Address — the unique wallet that co-signs and pays STX gas for your users
Fund your relayer: Send STX to your Relayer Address from the Dashboard. This is your “gas tank” — the STX used to sponsor your users’ transactions.

2. Install the SDK


3. Set Up a Secure Proxy

Your API key must never be exposed in client-side code. Create a server-side proxy that injects it on every request to the VelumX Relayer.
Point VelumXClient.paymasterUrl at whichever route you create — the SDK doesn’t care about the framework.

4. Initialize the SDK


5. Get the User’s Public Key

buildSponsoredContractCall requires the user’s Stacks public key to construct the transaction. Fetch it once after wallet connection and cache it for the session.

6. DEVELOPER_SPONSORS — Simplest Integration

The developer’s relayer pays STX gas. Users pay nothing. No paymaster contract needed. This example calls the Bitflow STX/stSTX stableswap pool directly — a real, runnable contract call.

7. USER_PAYS — Fee Collected in SIP-010 Token

The user pays a token fee. You need a paymaster contract that atomically collects the fee and executes the action. Option A: Use the VelumX DeFi reference paymaster (for Bitflow swaps and USDCx bridge). Option B: Deploy your own paymaster contract. Copy velumx-defi-paymaster-v1-1.clar as a template and replace the protocol calls with your own logic. See The Paymaster Pattern for a full walkthrough.

8. Testing on Testnet

To test the full flow before going to mainnet:
  1. Switch network to 'testnet' in VelumXClient and buildSponsoredContractCall.
  2. Get testnet STX for your relayer from the Stacks Testnet Faucet.
  3. Get testnet STX for your test wallet from the same faucet (needed to hold tokens for USER_PAYS testing).
  4. Use testnet contract addresses — the Bitflow testnet deployer is ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.
  5. Your VELUMX_API_KEY works on both networks — the relayer routes based on the network field in each request.

9. Export Your Relayer Key

You can export your relayer’s private key from the Dashboard at any time. This gives you full custody of your sponsorship funds and any fee revenue collected via USER_PAYS.