pinocchio

Build zero-copy Solana programs in Rust using the Pinocchio framework.

1|1|Updated May 21, 2026
One-click install
npx skills add https://github.com/naruto11eth/cryptoskills --skill pinocchio-naruto11eth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pinocchio
Source: https://github.com/naruto11eth/cryptoskills/tree/main/skills/pinocchio
Command: npx skills add https://github.com/naruto11eth/cryptoskills --skill pinocchio-naruto11eth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Writing Solana programs with Anchor or the native solana-program crate consumes excessive compute units and produces large binaries, and LLMs often generate outdated or incorrect low-level Solana code. This Skill provides accurate patterns for building programs with Pinocchio, the zero-dependency, zero-copy framework that reduces compute usage by 88-95% compared to Anchor. ## Core Features & Use Cases - Account Validation Patterns: Implement struct-based, TryFrom, builder, and macro-based account validation with signer, writable, owner, and PDA checks. - CPI Reference: Invoke System Program and Token Program instructions (CreateAccount, Transfer, MintTo, Burn) plus manual CPIs to third-party programs, with PDA signing via invoke_signed. - Anchor Migration: Convert Anchor accounts, constraints, handlers, and tests to Pinocchio equivalents, with Shank for IDL generation and Codama for clients. - Use Case: A developer building a high-throughput DEX on Solana uses this Skill to scaffold a Pinocchio program, define bytemuck account structs with single-byte discriminators, and implement PDA-signed token transfers that fit within tight compute budgets. ## Quick Start Ask the AI to scaffold a new Pinocchio Solana program with a PDA vault that supports initialize, deposit, and withdraw instructions.

Frequently Asked Questions about pinocchio

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a Solana program with Pinocchio?

Add pinocchio, pinocchio-system, pinocchio-token, and bytemuck to Cargo.toml, then define an entrypoint with entrypoint!(process_instruction). Route instructions by a single-byte discriminator, validate accounts manually, and use bytemuck for zero-copy account data access.

Pinocchio vs Anchor: which should I use for Solana programs?

Pinocchio reduces compute units by 88-95% and binary size by about 40% compared to Anchor, suiting high-throughput programs like DEXs and orderbooks. Anchor is better for rapid prototyping, complex account relationships, and teams unfamiliar with low-level Rust.

How do I validate accounts in Pinocchio without Anchor macros?

Implement manual checks using is_signer(), is_writable(), owner comparison, and PDA derivation with Pubkey::find_program_address. Common patterns include struct-based context parsing, TryFrom implementations, builder-pattern validators, and require! macros.

Does Pinocchio support Token-2022 and CPI to other programs?

Yes, pinocchio-token provides Token-2022 instructions like InitializeMetadataPointer and InitializeTokenMetadata, with support under active development. For third-party programs, build instructions manually with AccountMeta and Instruction, then call invoke or invoke_signed.

How do I generate an IDL for a Pinocchio program?

Pinocchio does not auto-generate IDLs, so annotate instructions and accounts with Shank's ShankInstruction and ShankAccount derives, then run shank idl to produce idl.json. Use Codama with the generated IDL for client generation.

Why does my bytemuck struct fail at runtime in Pinocchio?

Bytemuck requires 8-byte alignment, so structs with fields smaller than 8 bytes need explicit padding arrays to reach alignment boundaries. Also verify the discriminator byte and account data length before casting with bytemuck::from_bytes.