5IVE DSL
Tear down the mainnet wall. Build the moat.
5IVE is a DSL and VM toolchain for secure Solana applications. Contracts can compose with other 5IVE bytecode accounts through a native external-call path without CPI, while still supporting interface-based CPI for non-5IVE programs.
Product thesis: make mainnet deployable apps economically accessible, then compound defensibility through a template moat and app-store-style distribution surface.
External bytecode call (non-CPI)
Use address imports and call imported public functions directly through 5IVE's external composition path (non-CPI).
Interface CPI call
Use interface definitions with @program when invoking non-5IVE Solana programs through CPI semantics.
Quick Start
Start with an account schema, an initializer, and explicit authority checks.
Language Essentials
These examples reflect real usage across 5IVE templates and BPF-CU runtime harness scripts.
Data Types
Core Patterns
Accounts
Use account blocks to define state layout and runtime constraints.
Instructions
Use pub instructions for entrypoints and module helpers for shared logic.
Constraints
@signer, @mut, and @init enforce account behavior and initialization safety.
Stdlib Patterns
Prefer canonical stdlib imports and explicit interface segments. Use std::builtinsfor runtime helpers and std::interfaces::* for CPI-capable interfaces.
Imports + External Bytecode Calls
Use use with a deployed 5IVE bytecode account address. Imported functions can be called unqualified through 5IVE's non-CPI external-call path. For non-5IVE programs like SPL Token, use the interface/CPI path below.
Import verification
5IVE embeds import verification metadata at compile time and validates account identity at runtime before external execution. Unauthorized bytecode substitution is rejected.
Compile time: import metadata stored in script bytecode.
Runtime: account address checked before external call dispatch.
Failure mode: unauthorized substitution returns runtime error.
Interfaces + CPI
Standard Interface
Interfaces declare non-5IVE program methods and discriminators. Use this path when true Solana CPI is required.
Anchor Interface
Use @anchor to automatically handle 8-byte discriminators andAccount type mappings for Anchor programs.
Custom Serializers
Use @serializer(borsh) or @serializer(bincode)to control parameter encoding. You can also specify explicit discriminator bytes.
Session-Enabled Flows
Build session logic as normal instruction auth: keep signer checks, nonce checks, and replay protection explicit in DSL. For CLI execution, pass all required session-related accounts with --accounts.
CLI session execution
$# session-enabled function execution requires explicit account metas$5ive deploy-and-execute ./build/main.five -f 0 -p '[0]' -a '["<session_state>","<authority_signer>"]' --target devnet --program-id 55555SyrYLzydvDMBhAL8uo6h4WETHTm81z8btf6nAVJ --debug
Security Model
Constraint checks
Use signer and mutability constraints on instruction parameters. Gate privileged actions with explicit authority checks.
External call security
- Imported external calls are resolved by the VM using import metadata.
- Constraint enforcement still applies when entering external bytecode functions.
- Prefer explicit bytecode account parameters for predictable binding.
Execution + Cost Model
External bytecode calls avoid CPI framing costs but are not free. They still pay for runtime validation, stack management, and account handling.
Use CU measurements from the runtime harness to compare internal calls, external bytecode calls, and interface CPI for your exact workload.
Long-term direction: package richer app surfaces and template libraries into compact on-chain footprints, including the 10MB account form factor target.
Try snippets in the IDE5ive SDK
Use the SDK to load .five artifacts, build typed instruction payloads, and send transactions with explicit account wiring.
Install
$npm install @5ive-tech/sdk @solana/web3.js
Interaction Flow
import { readFile } from "node:fs/promises";
import { Connection, PublicKey, Transaction, TransactionInstruction, sendAndConfirmTransaction } from "@solana/web3.js";
import { FiveSDK, FiveProgram } from "@5ive-tech/sdk";
const connection = new Connection(process.env.RPC_URL!, "confirmed");
const fiveFileText = await readFile("./build/counter.five", "utf8");
const { abi } = await FiveSDK.loadFiveFile(fiveFileText);
const program = FiveProgram.fromABI(process.env.SCRIPT_ACCOUNT!, abi, {
fiveVMProgramId: process.env.FIVE_VM_PROGRAM_ID!,
vmStateAccount: process.env.FIVE_VM_STATE!,
feeReceiverAccount: process.env.FIVE_FEE_RECEIVER!,
});
const serializedIx = await program
.function("transfer")
.accounts({
from: fromTokenAccount,
to: toTokenAccount,
authority: wallet.publicKey,
})
.args({ amount: 100 })
.instruction();
const ix = new TransactionInstruction({
programId: new PublicKey(serializedIx.programId),
keys: serializedIx.keys.map((key) => ({
pubkey: new PublicKey(key.pubkey),
isSigner: key.isSigner,
isWritable: key.isWritable,
})),
data: Buffer.from(serializedIx.data, "base64"),
});
const tx = new Transaction().add(ix);
await sendAndConfirmTransaction(connection, tx, [wallet], { skipPreflight: false });5ive CLI
Use the CLI for project scaffolding, build/test loops, and deployment. Keep the command surface focused on stable workflows.
Install
$npm install -g @5ive-tech/cli
Core Workflow
$5ive init my-app$cd my-app$5ive config set --program-id 55555SyrYLzydvDMBhAL8uo6h4WETHTm81z8btf6nAVJ --target devnet$5ive build$5ive test --sdk-runner$5ive deploy ./build/my-app.five --target devnet$5ive deploy-and-execute ./build/my-app.five -f 0 -p '[]' -a '["<state_account>","<authority_signer>"]' --target devnet --debug