VREN
Developer Documentation

Build with
VREN

Everything you need to add permissionless, blockchain-native subscriptions to your product — from SDK to smart contracts to webhooks.

01 — Quickstart

Install and integrate in minutes

Add VREN to any React or Node.js project with a single package. The SDK handles all blockchain complexity so your team ships features, not infrastructure.

bash
npm install @vren/sdk
02 — Provider Setup

Wrap your app with VrenProvider

The VrenProvider initializes your configuration once at the root of your application, making your appId and contract address available to all child components via React context.

tsx
import { VrenProvider } from "@vren/sdk/react";

export default function App({ children }) {
  return (
    <VrenProvider
      config={{
        appId: "0xYOUR_APP_ID",
        network: "polygon",
      }}
    >
      {children}
    </VrenProvider>
  );
}
03 — Access Gating

Gate any feature with useGate()

The useGate hook checks the connected wallet's subscription status against the VREN smart contract in real time. It caches the result for 30 seconds to prevent redundant RPC calls.

tsx
import { useGate } from "@vren/sdk/react";

export function PremiumFeature() {
  const { data, isLoading } = useGate("premium");

  if (isLoading) return <Spinner />;
  if (!data?.access) return <UpgradePrompt />;

  return <YourPremiumContent />;
}
04 — Subscribe

Accept payments with useSubscribe()

Trigger a USDC subscription directly from your UI. The hook manages wallet confirmation and transaction state, exposing isPending, isConfirming, and isConfirmed flags.

tsx
import { useSubscribe } from "@vren/sdk/react";

export function SubscribeButton({ planId }) {
  const { subscribe, isPending, isConfirmed } = useSubscribe();

  return (
    <button
      onClick={() => subscribe(planId)}
      disabled={isPending}
    >
      {isPending ? "Confirming…" : "Subscribe"}
    </button>
  );
}
05 — Smart Contracts

Deployed, audited Solidity core

VREN consists of two EVM contracts: VrenRegistry (app identity and payout routing) and VrenSubscription (ERC-1155 minting and USDC payment splitting). Both are open source.

VrenRegistry.solApp registration and ownership
VrenSubscription.solERC-1155 · SafeERC20 · Pausable · ReentrancyGuard
Target networkPolygon PoS Mainnet (chainId 137)
Fee1.5% platform fee, max ceiling 10%, configurable
06 — REST API

HTTP Endpoints

For server-side access checks and receiving on-chain events in your backend, VREN exposes a minimal REST surface.

GET/api/v1/subscription/:wallet
Check access status
POST/api/webhooks/polygon
Relayer event sink (HMAC verified)
Back to countdownVREN Protocol — Pre-release docs v0.2.0