DOCUMENTATION
Everything you need to understand how Harns works.
OVERVIEW
Harns is a TX failure insurance protocol for Solana. When a transaction fails, the user loses the priority fee with no recourse. Harns changes this: pay a small premium before your swap, and if the TX fails, your fee is refunded automatically. No claims. No waiting. No middleman.
HOW IT WORKS
Pay Premium
Before your swap, a small premium (a fraction of your priority fee) is deposited into the insurance pool.
Pool Accumulates
Premiums from successful transactions grow the insurance pool reserve.
Failure Detection
Helius webhooks monitor the chain in real time. A failed TX triggers the refund pipeline automatically.
Auto Refund
The pool authority processes the refund on-chain. Your priority fee is returned to your wallet. No action required.
ARCHITECTURE
Origin
User Wallet
Interface
Chrome Extension / SDK
User Action
DEX Swap TX
Jupiter / Raydium / pump.fun
On-Chain
deposit_premium
→ Insurance Pool PDA
Monitoring
Helius Webhook
Detects TX failure automatically
Server
Backend API
process_refund instruction
On-Chain
Refund Record PDA
1:1 with Policy — no duplicates
Result
SOL Refunded to User Wallet
INSURANCE POOL
The insurance pool is a Solana PDA (Program Derived Address) that holds premiums from insured transactions. It operates on actuarial principles:
Pool Economics
premium = max(tx_fee * rate_bps / 10000, MIN_PREMIUM)
where rate_bps = 250 (2.5% default), MIN_PREMIUM = 5000 lamports
Pool Growth Condition
total_premiums > total_refunds
Holds as long as failure_rate < rate_bps / 10000
The pool tracks: total premiums collected, total refunds paid, active policy count, base rate in basis points, and creation/update timestamps.
$HARNS TOKEN UTILITY
Holding $HARNS tokens unlocks tiered benefits. The insurance works for everyone -- tokens make it better.
| Tier | Holding | Discount | Refund | LP Boost |
|---|---|---|---|---|
| WHALE | 0.1%+ | -50% | Instant | 3x |
| ELITE | 0.05%+ | -40% | Instant | 2x |
| PRO | 0.01%+ | -25% | 1 min | 1.5x |
| BASIC | 0.001%+ | -10% | 5 min | -- |
| FREE | 0 | Base | 10 min | -- |
BUYBACK & BURN
Every week, 50% of insurance pool profits are used to buy back $HARNS tokens from the open market and burn them permanently. All buyback transactions are posted publicly on-chain.
Buyback Formula
profit = total_premiums - total_refunds - operating_costs
buyback_amount = profit * 0.50
Executed weekly. On-chain verifiable.
More insured transactions = larger pool = more buyback pressure. The protocol creates sustained demand for $HARNS through usage, not speculation.
SMART CONTRACT
Cck2LDmweju8pYBQ9dRqyowqCYctxC9esm1LVg4ry1qX
Solana Devnet
Anchor 0.31.1
PDA Seeds
InsurancePool = ["insurance_pool", authority, pool_seed]
Policy = ["policy", pool, depositor, tx_sig[0..32]]
RefundRecord = ["refund", policy]
Instructions
- initialize_poolCreate a new insurance pool with base rate
- deposit_premiumPay premium and create a policy for a TX
- process_refundAuthority refunds a failed TX from the pool
SDK
The Harns TypeScript SDK provides programmatic access to insurance pool operations.
import { HarnsClient } from "@harns/sdk";
const client = new HarnsClient({
rpcUrl: "https://api.harns.fun/api/rpc",
});
// Derive pool address
const [poolAddr] = await client.findPoolAddress(
authority,
new BN(1)
);
// Fetch pool state
const pool = await client.getPool(poolAddr);
console.log("Total premiums:", pool.totalPremiums.toString());
console.log("Active policies:", pool.activePolicies);
// Calculate premium for a 0.015 SOL fee
const premium = client.calculatePremium(15_000_000, 250);
// -> 375000 lamports (0.000375 SOL)Source code: github.com/harns-labs/harns-core
FAQ
What happens if my transaction succeeds?
Your premium funds the insurance pool. No refund is needed -- the pool grows from successful premiums.
How fast is the refund?
Depends on your $HARNS tier. WHALE/ELITE get instant refunds. PRO gets 1 minute. BASIC gets 5 minutes. Free tier gets 10 minutes.
Do I need $HARNS tokens to use the insurance?
No. Everyone can use Harns at the base rate. Holding $HARNS gives you discounted premiums, faster refunds, and LP boost multipliers.
Is the insurance pool sustainable?
Yes. The pool is actuarially modeled. Premiums from successful TXs fund refunds for failed ones. As long as the failure rate stays within expected bounds, the pool grows.
What DEXs are supported?
Jupiter, Raydium, pump.fun, and Orca. Any Solana transaction can be insured through the SDK.
Where is the smart contract?
Deployed on Solana. Program ID: Cck2LDmweju8pYBQ9dRqyowqCYctxC9esm1LVg4ry1qX. Fully open source at github.com/harns-labs/harns-core.