Pinocchio Basics
10 examples to get you started with Pinocchio - 7 basic and 3 intermediate.
Search across all documentation pages
10 examples to get you started with Pinocchio - 7 basic and 3 intermediate.
Pinocchio replaces solana-program entry for minimal overhead.
[dependencies]
pinocchio = "0.8"#![no_std] on-chain.Pinocchio provides entrypoint wiring.
use pinocchio::{account_info::AccountInfo, entrypoint, pubkey::Pubkey, ProgramResult};
entrypoint!(process_instruction);Read signer and writable flags.
if !account.is_signer() { return Err(ProgramError::MissingRequiredSignature); }Optional allocator patterns.
#![no_std]
extern crate alloc;Pinocchio pubkey types align with SDK bytes.
let key = account.key();ProgramResult pattern unchanged.
return Err(ProgramError::InvalidArgument);Invoke helpers with similar semantics.
pinocchio::program::invoke(&ix, &accounts)?;Manual or Borsh dispatch.
let (tag, rest) = data.split_at(1);
match tag[0] { 0 => init(rest), 1 => swap(rest), _ => Err(...) }Related: Building a Program with Pinocchio
Avoid fmt and logs in hot paths.
// no msg in loopRelated: CU & Binary-Size Wins
LiteSVM 0.6.x runs pinocchio binaries.
// deploy .so in test fixtureRelated: LiteSVM
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.
Reviewed by Chris St. John·Last updated Jul 16, 2026