Skip to main content

Onchain Integration

Reward users for on-chain actions — token transfers, NFT mints, swaps, staking, and any smart contract event on Soneium.

How It Works

The Onchain integration uses the same reward pipeline as Discord, Telegram, and Shopify. A dedicated Contract Reader Worker polls the Soneium blockchain every minute, detects matching contract events, resolves the acting wallet to a Resonance user, and fires a reward through the existing Event Handler.

Soneium RPC (eth_getLogs)

Contract Reader Worker (1-min cron)

Detect matching events → Resolve wallet → Resonance user

Event Handler API ← same entry point as all other integrations

Credits, streaks, leaderboards, perks — same pipeline

Key Features

FeatureDetails
ChainSoneium Mainnet (Chain ID: 1868)
DetectionAny EVM event log from any contract
PollingEvery 1 minute via Cloudflare Cron
DeduplicationBlock cursor + tx hash + log index
Reorg SafetyConfigurable confirmation depth (default: 3 blocks)
User ResolutionMatches Privy wallets and linked external wallets

Quick Start

  1. Open the Partner Portal and go to the Rewards tab
  2. Create a new event and select "Onchain / Contract"
  3. Enter the contract address you want to watch
  4. Specify the event signature (e.g., Transfer(address,address,uint256))
  5. Choose the wallet field — which parameter contains the wallet to reward (from, to, etc.)
  6. Set reward amount and cooldown — same as any other event
  7. Save — the Contract Reader will start watching on the next cron tick

User Identification

The Contract Reader resolves on-chain wallet addresses to Resonance users by checking:

  1. Privy-generated wallets — wallets created via OAuth pregeneration (Discord, Telegram, etc.)
  2. Linked external wallets — wallets users connected via account linking
  3. Email-based wallets — wallets associated with email accounts

If a wallet can't be matched to a known user, the event is skipped.

Supported Event Types

Any standard EVM event log is supported. Common examples:

  • Token TransfersTransfer(address,address,uint256)
  • NFT MintsTransfer(address,address,uint256) where from is 0x0
  • SwapsSwap(address,uint256,uint256,uint256,uint256,address)
  • StakingStaked(address,uint256) or Deposit(address,uint256)
  • Custom events — any event emitted by your contract