User Identification
How to identify users when sending events to the Resonance API.
The Pattern
{platform}_{user_id}@rsnc.network
This creates a deterministic wallet for each user.
Platform Examples
| Platform | Pattern | Example |
|---|---|---|
| Discord | discord_{user_id}@rsnc.network | discord_123456789@rsnc.network |
| Telegram | telegram_{user_id}@rsnc.network | telegram_987654321@rsnc.network |
| Your Game | yourgame_{player_id}@rsnc.network | mygame_player42@rsnc.network |
| Your App | myapp_{user_id}@rsnc.network | myapp_user_abc123@rsnc.network |
| Website | mysite_{user_id}@rsnc.network | mysite_visitor_xyz@rsnc.network |
| Direct Email | user@example.com | john@example.com |
Deterministic Wallets
The same identifier always maps to the same wallet:
player_123@mygame.rsnc.network → 0xABC...
player_123@mygame.rsnc.network → 0xABC... (same wallet)
This means:
- Users accumulate rewards over time
- No registration required
- Wallets created automatically on first reward
Best Practices
1. Use Stable Identifiers
Good:
discord_123456789@rsnc.network (immutable Discord ID)
mygame_player_42@rsnc.network (database primary key)
Bad:
discord_CoolUsername@rsnc.network (usernames can change)
mygame_session_abc123@rsnc.network (sessions are temporary)
2. Keep Platform Prefix Consistent
Always use the same prefix for your platform:
// Good - consistent prefix
const userEmail = `mygame_${playerId}@rsnc.network`;
// Bad - inconsistent prefixes
const userEmail1 = `mygame_${playerId}@rsnc.network`;
const userEmail2 = `game_${playerId}@rsnc.network`; // Different prefix!
3. Handle Special Characters
URL-encode special characters in user IDs:
// If user ID contains special characters
const safeId = encodeURIComponent(userId);
const userEmail = `myplatform_${safeId}@rsnc.network`;
4. Consider Cross-Platform Users
If a user might be on multiple platforms:
discord_123456789@rsnc.network → Wallet A
telegram_987654321@rsnc.network → Wallet B (different wallet!)
If you want unified wallets, use a consistent identifier:
myplatform_user_abc@rsnc.network → Same wallet everywhere
Direct Email Support
You can also use real email addresses:
john@example.com
This works when:
- User has an email on file
- You want users to access via email login
Wallet Access
Users can access their wallets via:
- perks.rsnc.network — Login with Discord/Telegram OAuth
- Email magic link — For direct email identifiers
- Partner Portal — For brand admins to view
Code Examples
Node.js
function getUserEmail(platform, userId) {
// Normalize the user ID
const normalizedId = String(userId).toLowerCase().trim();
// Create the deterministic email
return `${platform}_${normalizedId}@rsnc.network`;
}
// Usage
const discordUser = getUserEmail('discord', '123456789');
// → discord_123456789@rsnc.network
const gamePlayer = getUserEmail('mygame', 'player_42');
// → mygame_player_42@rsnc.network
Python
def get_user_email(platform: str, user_id: str) -> str:
"""Create deterministic user email for Resonance."""
normalized_id = str(user_id).lower().strip()
return f"{platform}_{normalized_id}@rsnc.network"
# Usage
discord_user = get_user_email('discord', '123456789')
# → discord_123456789@rsnc.network
game_player = get_user_email('mygame', 'player_42')
# → mygame_player_42@rsnc.network
Verification
The API will accept any valid email format. Wallets are created automatically.
To verify a user has received rewards:
- Check balance API (if available)
- Partner Portal Analytics — Search by user email
- Blockchain explorer — Look up wallet address
Migration Considerations
If you change your identifier scheme:
Old: game_player42@rsnc.network
New: mygame_player_42@rsnc.network
These create different wallets. Plan migrations carefully:
- Stick with your original scheme
- Or implement a migration to transfer balances
Security
- User emails are hashed for wallet derivation
- No PII is stored beyond what's needed
- Wallets are non-custodial (user controls)