Skip to main content

Overview

Onchain Points enable you to maintain a blockchain-based ERC-20 representation of any loyalty currency in Snag. When enabled, user point balances are automatically synchronized on-chain at configurable intervals, allowing your loyalty program to integrate seamlessly with smart contracts, DEXs, and other on-chain applications. You have two ways to get started:
  • Deploy New — Snag deploys a SnagHybridERC20 contract for you from your relayer address.
  • Import Existing — Bring your own ERC-20 contract that already has batchAdminMint and batchAdminBurn functions. Snag verifies the relayer has the right permissions and then starts syncing.
Onchain points are perfect for projects that want to combine the flexibility of off-chain loyalty systems with the composability and transparency of blockchain technology.

How It Works

Snag’s onchain points system uses a hybrid approach that combines the best of both worlds:
  1. Off-chain tracking: User balances are tracked in Snag’s high-performance database
  2. Periodic synchronization: Balance changes are batched and synced on-chain at regular intervals
  3. Efficient execution: Batch operations minimize gas costs and maximize throughput

Synchronization Process

1

Balance calculation

Snag calculates the delta (difference) between off-chain balances and on-chain balances for all users since the last sync.
2

Batch preparation

Users requiring mints or burns are grouped into optimized batches. If the dataset is too large for a single transaction, it’s automatically split into multiple batches.
3

On-chain execution

The relayer executes batchMint or batchBurn transactions to update balances on-chain.
4

Confirmation

Once confirmed on-chain, the sync is complete and balances are updated. The cycle repeats at your configured interval.
Setting a faster sync interval will result in more frequent on-chain updates but will also increase your overall gas costs proportionally.

Contract Requirements

Select Deploy New in the onchain token modal and Snag will deploy a SnagHybridERC20 contract for you. This is a fully-featured, upgradeable ERC20 token optimized for loyalty programs:
  • Batch operations: batchAdminMint and batchAdminBurn for efficient multi-user updates
  • Permission system: Granular control over who can send/receive tokens
  • Role-based access: Separate roles for balance updates, admin, and upgrades
  • Upgradeable: UUPS proxy pattern for future enhancements
No extra setup is needed — Snag deploys the contract from your relayer address and configures all permissions automatically.
The contract source code is available in our GitHub repository.

Option 2: Import Existing Contract

If you already have an ERC-20 contract deployed, you can import it by selecting Import Existing in the onchain token modal. Your contract must expose the following functions:
// Required functions for Snag integration
function batchAdminMint(address[] calldata to, uint256[] calldata amounts) external;
function batchAdminBurn(address[] calldata from, uint256[] calldata amounts) external;

Prerequisites

Before importing, you must grant your Snag relayer address the role that permits calling batchAdminMint and batchAdminBurn. You can find your relayer’s EOA address in the relayer settings.
If the relayer does not have mint and burn permissions on the contract, the import will fail during verification.

Verification Process

When you import a contract, Snag runs an automated verification to confirm everything is configured correctly:
1

Contract check

Snag verifies that a contract exists at the address you provided on the correct chain.
2

Test mint

A test mint of 1 wei is sent to the relayer address to confirm it has minting permissions.
3

Test burn

A test burn of 1 wei is sent from the relayer address to confirm it has burning permissions.
4

Record creation

Once both transactions succeed, the contract is linked to your loyalty currency and an initial balance sync is triggered.
The test mint and burn are for 1 wei (the smallest possible unit) and cancel each other out, so there is no net change to any balances.

Auto-detection

When importing, Snag will automatically read the contract’s name() and symbol() functions and pre-fill those fields for you. If the contract doesn’t expose name() or symbol() (some contracts don’t), Snag falls back to the name and symbol of the loyalty currency you selected. You can always override either value before confirming.

Permissions & Security

To enable Snag to update balances on your token contract, the relayer must have permission to call the batch mint and burn functions.

Granting Permissions

  • Deploy New: Permissions are configured automatically during deployment — no action required.
  • Import Existing: You must grant your relayer address the appropriate role before importing. Your contract should implement role-based access control (such as OpenZeppelin’s AccessControl).
For SnagHybridERC20, this is the BALANCE_UPDATER_ROLE. For custom contracts, grant whichever role allows calling your batchAdminMint and batchAdminBurn functions.
Relayers are standard EOAs (not contract wallets), making execution straightforward and fully compatible with your existing role system.

Key Management

Snag uses enterprise-grade security for private key management:
  • GCP Cloud KMS: All private keys are stored in Google Cloud’s Key Management Service
  • Hardware Security Modules (HSM): Signing operations occur inside secure hardware enclaves
  • No key exposure: Private keys never leave the cloud infrastructure

V2 Relayers Only

Onchain points are exclusively supported on V2 relayers, which provide enhanced security with GCP Cloud KMS integration and improved transaction management.
V1 relayers (AWS-based) do not support onchain point synchronization. Please migrate to V2 relayers to use this feature.

Gas & Funding

Relayer Funding

You are responsible for keeping your relayer funded with native tokens (ETH, MATIC, etc.) to pay for gas fees.
1

Copy relayer address

Navigate to your relayer in Snag Admin and copy the EOA address.
2

Send funds

Transfer native tokens from any wallet to the relayer address. Ensure you’re on the correct network.
3

Monitor balance

Regularly check your relayer balance to ensure uninterrupted operation.

Fee Structure

Snag takes zero fees per transaction. You only pay network gas fees to the blockchain.

Performance & Scalability

Snag’s infrastructure is built to handle high-volume operations, supporting hundreds of thousands of accounts per sync cycle. The main constraint is the blockchain itself—specifically, one transaction per EOA per block. Batching operations significantly improves both gas efficiency and throughput. Without batching, on-chain balances could never sync efficiently—each transaction would need to wait for the previous one to confirm.
For extremely high-volume use cases, we’re developing a relayer pool system that distributes load across multiple EOAs using round-robin, effectively removing throughput limits.

Transaction Reliability

All transaction management—including nonce sequencing, gas estimation, and error handling—is handled automatically by the relayer service. If issues arise (such as insufficient funds or permission errors), you’ll be notified to take corrective action.

Migration & Control

Taking Full Control

If you want to manage token minting yourself in the future:
1

Deploy your own relayer

Set up your own signing infrastructure and relayer service.
2

Update permissions

Revoke the balance updater role from Snag’s relayer and grant it to your relayer.
3

Implement sync logic

You can continue using Snag Admin to trigger syncs, or build your own synchronization solution.
When deploying new, the contract is created from your relayer and all configuration is handled for you. If you already have a contract deployed, use the Import Existing flow instead.

Audits

  • Smart contracts: Halborn is currently auditing our airdrop protocol; SnagHybridERC20 audit is expected to follow
  • Infrastructure audit: Completed 4-week white box security audit by Anvil Secure’s lead security researcher
  • Regular audits: Both smart contracts and application infrastructure undergo periodic security reviews

Frequently Asked Questions

Any EVM-compatible chain where you have a V2 relayer. Popular chains include Ethereum, Arbitrum, Polygon, Base, Optimism, Berachain, and more. Solana support is coming soon (keys are managed in GCP but hardware signing is not yet available).
Yes! Select Import Existing when creating an onchain token and paste your contract address. Your contract must expose batchAdminMint and batchAdminBurn functions, and your relayer must already have permission to call them. Snag will verify this with a test mint and burn during import.
Transactions will fail to execute until you refund the relayer. Snag will alert you when balances are low.
This depends on your use case and budget. More frequent syncs provide near real-time updates but cost more in gas fees. Less frequent syncs (hourly or daily) are more cost-effective. You can adjust this anytime in Snag Admin.
V2 relayers use GCP Cloud KMS with hardware signing and support onchain point synchronization. V1 relayers use AWS KMS and do not support onchain points. All new projects should use V2 relayers.
Absolutely! All transactions are public on-chain. You can view them on explorers like Etherscan, Arbiscan, or Polygonscan by searching for your relayer’s address.
Our relayers support EIP-7702 but we haven’t integrated it for hybrid ERC20 yet, as this standard is still propagating and many partner blockchains don’t support it. We’re monitoring adoption and will integrate when appropriate.

Next Steps

Create a Relayer

Set up a V2 relayer to get started with onchain points.

Stratus Overview

Learn more about Snag’s cloud-native blockchain infrastructure.

Loyalty Currencies

Create a loyalty currency to sync on-chain.

Functions

Use Functions to build custom logic for your onchain points.