Solana program reference

The Kiln program is written in Rust with the Anchor framework. This page lists everything a client needs to talk to it.

Constants

Name Value Meaning
HEARTBEAT_GRACE_SECS 180 Longest gap between heartbeats that still counts
MAX_LEASE_HOURS 2,160 Longest lease (90 days), including top-ups
MAX_FEE_BPS 2,000 Fee ceiling, 20%
MAX_HOST_LEN 128 Longest gateway URL a listing can publish

Addresses (PDAs)

Account Seeds
Config ["config"]
Provider (listing) ["provider", owner, mint]
Lease ["lease", renter, nonce as u64 little-endian]
Escrow token account ["escrow", lease]

One owner can have one listing per payment mint.

Accounts

Config (75 bytes)

Field Type
admin Pubkey Can change fee and treasury
treasury Pubkey Owner of the token accounts fees are paid to
fee_bps u16 Protocol fee, basis points
bump u8

Provider (307 bytes)

Field Type
owner Pubkey Receives payouts, manages the listing
heartbeat_authority Pubkey Key that signs heartbeats
mint Pubkey Payment currency
price_per_hour u64 For the whole listing, in base units
gpu_model [u8; 32] UTF-8, zero-padded
gpu_count u8
region [u8; 16] UTF-8, zero-padded
active bool Accepting new leases
active_leases u32 Open leases
total_verified_secs u64 Lifetime proven time
bump u8
host String (≤ 128) Gateway URL; kept last so the fields above have fixed offsets

Lease (176 bytes)

Field Type
renter Pubkey offset 8 (useful for getProgramAccounts filters)
provider Pubkey offset 40
mint Pubkey
nonce u64 Chosen by the renter; part of the address
price_per_hour u64 Fixed at opening
deposited u64 Total funded
paid u64 Total paid out (provider + fee)
start_ts, end_ts i64 Unix seconds
last_heartbeat_ts i64 0 until the first heartbeat
verified_secs i64 Proven time
heartbeats u32 Count
last_utilization_bps u16 0–10,000
bump, escrow_bump u8

Instructions

Instruction Signer Arguments Effect
init_config admin (once) fee_bps, treasury Creates Config
update_config admin fee_bps, treasury Changes fee/treasury
register_provider owner heartbeat_authority, price_per_hour, gpu_model, gpu_count, region, host Creates a listing
update_provider owner price_per_hour, active, heartbeat_authority, host Edits a listing
open_lease renter nonce, hours Creates lease + escrow, deposits price × hours
top_up renter hours Adds funds and time at the lease's price
heartbeat heartbeat authority utilization_bps Adds verified time (see proof of rental)
settle anyone — Pays verified, unpaid time to owner and treasury
close_lease renter or owner — Settles, refunds the rest, closes escrow and lease

Events

Event Fields
ProviderRegistered provider, owner, mint, price_per_hour
LeaseOpened lease, renter, provider, deposited, end_ts
HeartbeatEvent lease, provider, utilization_bps, verified_secs, ts
Settled lease, amount
LeaseClosed lease, paid_on_close, refunded

Errors

Code Name When
6000 FeeTooHigh Fee above 20%
6001 ZeroPrice Price is 0
6002 ZeroGpus GPU count is 0
6003 BadHours Hours outside 1–2,160, or top-up beyond the maximum
6004 ProviderInactive Listing paused
6005 LeaseEnded Top-up or heartbeat after the end
6006 BadUtilization Utilisation above 10,000 bps
6007 Unauthorized Wrong signer
6008 WrongMint Token account or mint mismatch
6009 WrongProvider Lease belongs to another listing
6010 MathOverflow Arithmetic overflow
6011 BadHost Gateway URL not http(s)://… or longer than 128 characters

Testing

Every build runs unit tests on the payout maths and end-to-end tests that load the compiled program into a local Solana VM. They cover full leases, outages, unauthorised heartbeats, over-long heartbeating, closing rights and listing updates.

Previous← Security and trustNextProvider gateway API →