Skip to content
Njord GitHub

← Home · How it works

From a click to a settled commission, in seconds.

Njord is a set of Anchor programs on Solana with a TypeScript-first package surface. Here is the full path a conversion takes — funded escrow in, verified attribution, fees split in-contract, commission out. It is the same escrow-verify-settle loop that makes Njord a pay-per-action leg for autonomous agents, not just human affiliates.

Architecture

The flow of value

  COMPANY                     SOLANA (Anchor programs)                 AFFILIATE
  ───────                     ────────────────────────                 ─────────
  fund campaign ─────USDC────▶  ┌───────────────────┐
                                │  Campaign Escrow  │
  define terms ──────────────▶  │  (locked funds)   │
                                └─────────┬─────────┘
                                          │  on conversion
  CUSTOMER                                ▼
  ────────                        ┌───────────────┐    fee split 2.5% + 1%
  clicks link ──▶ BRIDGE ──attr─▶ │  Attribution  │───────────────┐
  completes action  (or SDK)      │   validated   │               ▼
                                  └───────┬───────┘        ┌──────────────┐
                                          │ ~3s            │  net payout  │──▶ wallet
                                          └───────────────▶│   released   │    (USDC)
                                                           └──────────────┘
              @njord/indexer (GraphQL) reads every account above — public + verifiable

Lifecycle

Seven on-chain steps

01

Create campaign

A company defines budget, commission model (percentage / flat / tiered), target action, attribution model (last- or first-click), minimum affiliate tier, and hold period.

02

Fund escrow

USDC or SOL is deposited into a campaign-scoped on-chain escrow. Funds stay locked until distributed on conversion or returned when the campaign ends.

03

Affiliate joins

An affiliate picks a campaign, receives an affiliate ID, and generates tracking links — URL parameter, short link, coupon code, or SDK embed.

04

Customer converts

The customer clicks the affiliate link and completes the target action, paying with a card via a bridge or on-chain directly. No wallet is required of the customer.

05

Attribution submitted

The bridge operator (or the company’s own SDK) submits the conversion on-chain. The contract validates campaign, affiliate, escrow balance, and attribution model.

06

Fees split, escrow releases

The contract subtracts the 2.5% protocol fee and 1% bridge fee, then releases the remaining commission from escrow to the affiliate wallet.

07

Commission lands

USDC arrives in roughly three seconds. Elite-tier affiliates skip the hold; lower tiers wait 24 hours to 7 days.

Code

The whole loop in @njord/sdk

Create and fund a campaign, hand an affiliate a link, and settle a conversion — the SDK wraps the on-chain program in idiomatic TypeScript.

import { NjordClient } from '@njord/sdk';

// A company funds a campaign into on-chain escrow
const client = new NjordClient({ cluster: 'devnet', wallet });

const campaign = await client.createCampaign({
  budget:        5_000,           // USDC into escrow
  commission:    { type: 'percentage', rate: 0.15 },
  attribution:   'last-click',
  minTier:       'verified',
});

// An affiliate generates a tracking link
const link = client.trackingLink(campaign.id, affiliateId);
// → https://njord.cryptuon.com/r/CAMPAIGN/AFFILIATE

// On conversion, attribution is written and escrow releases in ~3s
const payout = await client.submitAttribution({
  campaign: campaign.id, affiliate: affiliateId, amount: 240,
});
// payout.net = amount − 2.5% protocol − 1% bridge, sent to affiliate wallet

Illustrative shape of the SDK surface — see the repo for the current API.

Packages

Four packages, one program

@njord/sdk

Core protocol client

TypeScript SDK for direct interaction — create and fund campaigns, generate links, submit attributions. Use from backends, scripts, and indexers.

@njord/react

Frontend

React hooks and components: connect wallets, browse campaigns, render attribution and payout state in a UI.

@njord/bridge-sdk

Fiat rails

For bridge operators — standardized attribution submission, fee accounting, Docker-friendly deploy patterns.

@njord/indexer

Query layer

GraphQL event indexer over campaigns, conversions, payouts, and affiliate tiers for historical reads.

On-chain programs: Anchor 0.32.1 · devnet program ID Hm5WfS2KL4UPaUqVJ3vadCuPMCftw2oybqvpDr7fn9Hv · mainnet pending

Fees

Where every commission dollar goes

Component Amount Destination
Protocol fee 2.5% of commission Split 50% Treasury / 30% Staking Rewards / 20% Buyback & Burn
Bridge fee 1% of commission To the bridge operator that processed the payment
Campaign creation 0.1 SOL flat One-time fee to the treasury per campaign
Chain cost ~$0.00025 per attribution Solana network fee — not a protocol cut

Governance can adjust the protocol fee within a 0.5%–5% band and rebalance the 50/30/20 split through the public proposal process. See tokenomics.

Build against it today

The quickstart walks from install to a settled devnet payout. Pick your role, or read the tokenomics behind the fee split.