The anon0mesh BLE mesh network implements a relayer fee system to incentivize nodes to forward transactions. Each device that relays a transaction through the mesh network gets compensated with a small fee.
When creating an offline durable transaction, the sender specifies:
- Transfer amount: The SOL to send to the recipient
- Relayer fee per hop: How much each relayer earns (default: 0.0001 SOL)
- Max hops: Maximum number of relay hops (default: 10)
const offlineTx = await createOfflineDurableTransaction({
connection,
senderKeypair,
recipientPubKey: new PublicKey('recipient_address'),
amountSOL: 1.0,
senderNickname: 'Alice',
relayerFeePerHop: 0.0001, // 0.0001 SOL per hop
maxHops: 10,
});Each relay device that forwards the transaction:
- Receives the transaction via BLE
- Adds their public key to the relayer list
- Increments the hop count
- Forwards to neighboring devices
bleManager.on('transaction_received', async (buffer) => {
const payload = deserializeFromBLE(buffer);
if (shouldRelayViaBLE(payload)) {
// Add this device's public key to get compensated
const relayedPayload = incrementHopCount(
payload,
relayerKeypair.publicKey.toBase58()
);
await bleManager.broadcast(serializeForBLE(relayedPayload));
}
});When any device with internet connectivity receives the transaction:
- Submits the main transaction to Solana
- Automatically pays all relayers who forwarded it
// Submit main transaction
const signature = await submitOfflineTransaction(connection, receivedPayload);
// Pay all relayers automatically
const paymentSignatures = await submitRelayerPayments(
connection,
senderKeypair,
receivedPayload
);- Relayer fee per hop: 0.0001 SOL (~$0.01 at $100/SOL)
- Maximum hops: 10
- Maximum total relayer fees: 0.001 SOL (~$0.10)
Before creating a transaction, estimate total costs:
const costEstimate = estimateTotalTransactionCost(
1.0, // Transfer amount
10, // Max hops
0.0001 // Fee per hop
);
console.log('Transfer Amount:', costEstimate.transferAmount, 'SOL');
console.log('Max Relayer Fees:', costEstimate.maxRelayerFees, 'SOL');
console.log('Network Fees:', costEstimate.networkFees, 'SOL');
console.log('Total Max Cost:', costEstimate.totalMaxCost, 'SOL');
// Output:
// Transfer Amount: 1.0 SOL
// Max Relayer Fees: 0.001 SOL
// Network Fees: 0.000005 SOL
// Total Max Cost: 1.001005 SOLThe sender pays for actual hops, not maximum:
| Scenario | Hops | Fee per Hop | Total Fees |
|---|---|---|---|
| Direct connection | 0 | 0.0001 SOL | 0 SOL |
| 1 relay | 1 | 0.0001 SOL | 0.0001 SOL |
| 5 relays | 5 | 0.0001 SOL | 0.0005 SOL |
| Maximum (10 relays) | 10 | 0.0001 SOL | 0.001 SOL |
Each transaction tracks relayer information:
interface OfflineTransactionPayload {
// ... other fields ...
relayMetadata: {
hopCount: number; // Current hop count
maxHops: number; // Maximum allowed hops
isDurable: true; // Transaction never expires
protocol: 'BLE' | 'NOSTR'; // Relay protocol
relayerFeePerHop: number; // Fee in lamports
relayers: string[]; // Public keys of all relayers
};
}Check relayer information after transaction is relayed:
const feeInfo = getRelayerFeeInfo(receivedPayload);
console.log('Actual relayers:', feeInfo.actualRelayers);
console.log('Fee per hop:', feeInfo.feePerHop, 'SOL');
console.log('Total fees:', feeInfo.totalFees, 'SOL');
console.log('Max possible fees:', feeInfo.maxPossibleFees, 'SOL');
// Output example:
// Actual relayers: 3
// Fee per hop: 0.0001 SOL
// Total fees: 0.0003 SOL
// Max possible fees: 0.001 SOL- Predictable maximum cost: Know upfront the max you'll pay
- Pay only for actual service: Only charged for devices that relayed
- Configurable fees: Adjust fee per hop based on urgency
- Passive income: Earn fees for forwarding transactions
- No upfront cost: Just keep BLE enabled and relay
- Cumulative earnings: Earn from multiple transactions
- Incentivized participation: Nodes are rewarded for staying online
- Mesh resilience: More nodes = more reliable network
- Self-sustaining: Economic model encourages network growth
1. Sender creates transaction (offline)
↓
2. Transaction relayed through BLE mesh
- Device A forwards → adds public key
- Device B forwards → adds public key
- Device C forwards → adds public key
↓
3. Device with internet receives transaction
↓
4. Submit main transaction to Solana
↓
5. Pay relayers automatically:
- Device A receives 0.0001 SOL
- Device B receives 0.0001 SOL
- Device C receives 0.0001 SOL
- Max hops limit: Prevents infinite relay loops
- Unique relayer tracking: Each public key added once
- Signature verification: All relayers must be legitimate
- Hop count validation: Cannot exceed maxHops
Each relay device:
- Must have a valid keypair
- Must sign relay metadata (future enhancement)
- Cannot add duplicate entries
- Cannot modify transaction amount
Adjust fees based on your use case:
// Urgent transaction - higher fee incentivizes relaying
const urgentTx = await createOfflineDurableTransaction({
// ...
relayerFeePerHop: 0.001, // 10x normal fee
maxHops: 5, // Fewer hops for speed
});
// Low-priority transaction - minimal cost
const lowPriorityTx = await createOfflineDurableTransaction({
// ...
relayerFeePerHop: 0.00001, // 10% of normal fee
maxHops: 20, // More hops allowed
});Track relayer performance:
// Analyze received transaction
const payload = deserializeFromBLE(buffer);
console.log('Transaction ID:', payload.id);
console.log('Hops traveled:', payload.relayMetadata.hopCount);
console.log('Relayers:', payload.relayMetadata.relayers);
console.log('Time in transit:', Date.now() - payload.createdAt, 'ms');
// Calculate efficiency
const efficiency = (payload.amount / calculateTotalRelayerFees(payload)) * 100;
console.log('Transfer efficiency:', efficiency, '%');- ✅ Estimate costs before sending
- ✅ Set reasonable maxHops (10 is good default)
- ✅ Use higher fees for urgent transactions
- ✅ Monitor actual vs expected hop counts
- ✅ Keep BLE enabled and discoverable
- ✅ Ensure sufficient battery/power
- ✅ Store keypair securely
- ✅ Track earnings over time
- ✅ Monitor average hop counts
- ✅ Analyze relay patterns
- ✅ Identify bottleneck nodes
- ✅ Encourage strategic node placement
- Dynamic fee adjustment based on network congestion
- Relayer reputation system to reward reliable nodes
- Batch relayer payments to reduce transaction fees
- Fee escrow to guarantee relayer payments
- Relayer statistics dashboard for monitoring earnings
- Variable fees based on hop position (first hop more expensive)
- Relayer staking for priority status
- Geographic-based fee multipliers
- Time-decay fees (older transactions pay more)
Setup:
- Alice (sender, offline)
- 5 relay nodes (villagers with phones)
- Bob (recipient, online in city)
Flow:
Alice → Node1 → Node2 → Node3 → Node4 → Node5 → Bob
Costs:
- Transfer: 10 SOL
- Relayer fees: 5 × 0.0001 = 0.0005 SOL
- Network fee: 0.000005 SOL
- Total: 10.000505 SOL
Earnings per relayer: 0.0001 SOL
Setup:
- 100 festival attendees
- Average 3 hops per transaction
- 1000 transactions per day
Daily volume:
- Transfers: Varies
- Relayer fees: 1000 tx × 3 hops × 0.0001 = 0.3 SOL
- Average per active relayer: 0.003 SOL/day
If SOL = $100:
- $0.30/day per active relayer
- $9/month passive income
Q: What if a relayer goes offline after being paid? A: Payments are immediate after main transaction confirms. Relayers are paid based on work already done.
Q: Can relayers steal or modify transactions? A: No. Transactions are signed and cryptographically verified. Relayers can only forward, not modify.
Q: What if no one relays my transaction?
A: If no relayers are available, the transaction waits in the mesh until a path opens. You can increase relayerFeePerHop to incentivize relaying.
Q: Do I pay if the transaction fails? A: No. Relayer payments only occur after the main transaction successfully confirms on Solana.
Q: Can I be both sender and relayer? A: Yes! You can send transactions and relay others' transactions to earn fees.
The relayer fee system creates a self-sustaining mesh network where:
- 📱 Senders pay small fees for offline transaction capability
- 💰 Relayers earn passive income for network participation
- 🌐 Network becomes more resilient with economic incentives
- 🔒 Security maintained through cryptographic verification
This economic model enables truly decentralized, offline-capable payments that work even in areas with poor internet connectivity.