KAGURA 神楽

KAGURA is a continuous-time DeFi primitive on Solana. Two on-chain Anchor programs: a tick-attestation registry, and a USDC funding vault that compounds yield every block instead of every hour.

contact: hello@kagura.network
神楽KAGURA/ docs
v0.1.0 · pre-deployment← back to sitegithub →
introduction·quickstart

quickstart

clone the repo, build the two anchor programs, bootstrap a vault, and watch the principal tick up against a local validator. about 10 minutes if your toolchain is already warm.

prerequisites

  • WSL Ubuntuif you're on windows. solana toolchain does not build on native windows.
  • rust 1.85+ (host) — rustup default 1.85.0.
  • agave 3.1.13 — bundles platform-tools v1.52 / rustc 1.89 for sbf.
  • anchor 0.31.1 — via avm install 0.31.1.
  • node 20+ and yarn 1.22+ for the ts client and scripts.

1. clone and build

terminalbash
1git clone https://github.com/Kagura-block/kagura2cd kagura3anchor build

The build produces two on-chain programs and their idls + ts types. Expected output sizes: kagura_core.so ≈ 242kb, kagura_vault.so ≈ 397kb. The first build downloads platform-tools and the dependency graph; allow ~5 minutes.

2. run the test suite

This step is optional for getting a vault running but mandatory for trusting the vault math.

terminalbash
1yarn install2anchor test3# 10 passing (11s) — config init, register, deposit, ticks, withdraw, pause, ceiling

If anchor test turns green you have proof that on a fresh local validator: a vault is initialized, treasury is topped up, a user deposits, the ticker advances funding three times, and the user withdraws strictly more usdc than they put in.

3. bring up the live demo

The repo ships a one-command orchestration script that spawns a local validator, bootstraps the vault, deposits 10k mock USDC as a user, starts a ticker bot, and serves the live web counter at http://127.0.0.1:5173.

terminalbash
1bash scripts/demo-up.sh2 3# in your browser, open4# http://127.0.0.1:51735#6# stop with: bash scripts/demo-down.sh

In another terminal, watch the ticker log:

terminalbash
1tail -f /tmp/kagura-ticker.log2 3# [#  45] principal=10000.010297 treasury=99999.99 lifetime+0.010297 took=222ms ...

4. deploy to devnet

Fund your wallet (need ~1.7 SOL for both programs), then deploy:

terminalbash
1solana config set --url https://api.devnet.solana.com2solana airdrop 2          # may rate-limit; use the web faucet if blocked3 4bash scripts/deploy-devnet.sh5# anchor deploy --provider.cluster devnet6# Program Id: DbHae1rzcf5U8Jbrp5X9NFTcZfk4z12R2qMNgesmXNnC7# Program Id: HQYVFcbezorwCqPK69keUAoe4p1zgPzCVDfJq4XWymk8

Then bootstrap a vault on devnet (creates a mock USDC mint, registers the protocol, initializes the vault, tops up the treasury):

terminalbash
1ANCHOR_PROVIDER_URL=https://api.devnet.solana.com \2ANCHOR_WALLET=$HOME/.config/solana/id.json \3FUNDING_RATE_BPS=2200 \4TICK_INTERVAL_MS=1000 \5INITIAL_TREASURY_USDC=100000 \6yarn ts-node scripts/init-vault.ts

5. deposit and tick

terminalbash
1# deposit 10,000 mock USDC as the connected wallet2ANCHOR_PROVIDER_URL=https://api.devnet.solana.com \3ANCHOR_WALLET=$HOME/.config/solana/id.json \4DEPOSIT_USDC=10000 \5yarn ts-node scripts/user-deposit.ts6 7# start a long-running ticker bot8ANCHOR_PROVIDER_URL=https://api.devnet.solana.com \9ANCHOR_WALLET=$HOME/.config/solana/id.json \10TICK_LOOP_MS=1500 \11yarn ts-node scripts/tick-loop.ts

Anyone can verify the vault state directly on-chain:

verificationbash
1# the principal-account balance grows every tick2spl-token account-info --address <principal_pda> -u devnet3 4# /api/health publishes the same program ids the docs reference5curl https://kagura.network/api/health6# {7#   "programs": {8#     "core":  "DbHae1rzcf5U8Jbrp5X9NFTcZfk4z12R2qMNgesmXNnC",9#     "vault": "HQYVFcbezorwCqPK69keUAoe4p1zgPzCVDfJq4XWymk8"10#   }11# }

next