5IVE

5IVE DSL

The safest way to build on Solana.

5IVE is a domain-specific language designed for writing secure, predictable, and efficient smart contracts on the Solana blockchain. It abstracts away low-level complexity while enforcing strict security boundaries at compile time.

Quick Start

Here is a simple counter program. It defines a state account and instructions to modify it.

counter.v
Loading...
Loading code...

Language Reference

Data Types

example.v
Loading...
Loading code...

Account Architecture

Program + State Accounts (Recommended)

In this pattern, the program logic is stateless. Users invoke the program to create and modify separate state accounts. This allows one program to manage millions of user accounts.

standard_pattern.v
Loading...
Loading code...

Accounts & Instructions

Account Definition

Define the structure of your on-chain data accounts.

state.v
Loading...
Loading code...

Instructions

Use pub to expose instructions. Helpers can be private.

instructions.v
Loading...
Loading code...

Interfaces & CPI

Define interfaces to interact with external programs via Cross-Program Invocation (CPI).

interfaces.v
Loading...
Loading code...

Constraints & Safety

@mutMutable Account

Required to modify an account's data. Without this, accounts are read-only.

mutability.v
Loading...
Loading code...

@signerSigner Check

Ensures the transaction was signed by this account. Essential for authority checks.

signer.v
Loading...
Loading code...

@initInitialize Account

Creates a new account. Typically requires a funded @signer to pay for rent.

init.v
Loading...
Loading code...

On-Chain Fees

Deploy and execute can include native SOL fees configured by the VM admin (basis points of rent and the standard Solana tx fee). The IDE cost estimate includes this deploy fee when it can read the on-chain configuration.

@requiresPre-condition

Runtime check. If the condition is false, the transaction aborts.

requires.v
Loading...
Loading code...

Zero-Cost Imports & Import Verification

Importing Other Bytecode

Importing other Five bytecode accounts allows you to call their internal functions directly, without the overhead of CPI (Cross-Program Invocation). This is much cheaper and faster than traditional Solana program calls.

imports.v
Loading...
Loading code...

đź”’ Import Verification (Security Feature)

When you declare an import, Five automatically embeds verification metadata in your bytecode. At runtime, the Five VM verifies that the account being called matches your declared import address—preventing attackers from substituting a different bytecode account.

Compile-time: Import address stored in bytecode metadata with FEATURE_IMPORT_VERIFICATION flag

Runtime: VM verifies account address matches before CALL_EXTERNAL execution

Result: Unauthorized bytecode invocation rejected with error

import_verification.v
Loading...
Loading code...

Why Import Verification Matters

  • âś“Prevents Bytecode Substitution Attacks: Attacker cannot swap your imported bytecode for a malicious one
  • âś“Zero Runtime Cost for Valid Imports: Single 32-byte address comparison (<1ÎĽs)
  • âś“Transparent Security: Verification happens automatically—no code changes needed
  • âś“Backward Compatible: Existing bytecode without imports continues to work
  • âś“Future PDA Support: Metadata format supports PDA-derived bytecode accounts

Security Rules

5IVE enforces strict security rules at compile time to prevent common exploits.

01

Read-Only External Fields

You can read fields from imported contracts, but you cannot modify them directly. This prevents unauthorized state changes.

❌ Incorrectbalance = 100;
âś… Correctlet x = balance;
02

Explicit Function Calls

To modify an external contract's state, you must call one of its public instructions.

token.transfer(recipient, amount);