Scale or Die 2025: No-strings-attached programs w/ Pinocchio
Discover how Pinocchio is revolutionizing Solana program development with improved efficiency and performance
Solana developers, get ready for a game-changer! Fernando Otero from ANZA's dev tooling team unveils Pinocchio, a revolutionary new SDK set to transform how we write and optimize Solana programs. With promises of drastically reduced compute units, smaller binary sizes, and improved performance, Pinocchio is poised to take Solana development to the next level.
Summary
Fernando Otero, also known as Febo, introduces Pinocchio, a new dependency-free SDK designed to help developers write more efficient Solana programs. Born out of a conversation at the Hackinghouse in London, Pinocchio aims to be a "program first" SDK that prioritizes on-chain program performance.
The SDK follows key principles, including avoiding external dependencies in the main crate, focusing on performance through zero-copy data access and no dynamic memory allocation, and providing both safe and unsafe variants of functions. Pinocchio offers significant improvements in areas such as entry point efficiency, lightweight view types, and program logging.
Otero presents two case studies demonstrating Pinocchio's effectiveness: a reimplementation of the SPL token program (dubbed "Pitoken") and an optimized version of the memo program. Both examples show substantial reductions in compute unit usage and binary size while maintaining the same functionality.
Key Points:
Origins and Principles of Pinocchio
Pinocchio was conceived as a solution to the dependency issues plaguing the Solana program crate. The idea of a dependency-free SDK emerged from a conversation between Fernando Otero and John at the Hackinghouse in London. Pinocchio's core principles include:
- No external dependencies in the main crate
- Focus on performance
- No dynamic memory allocation
- Zero-copy data access when possible
- Provision of both safe and unsafe function variants
These principles aim to create an SDK that is tailored specifically for on-chain programs, offering improved performance and mitigating dependency issues that often arise in Solana development.
Efficiency Improvements
Pinocchio introduces several key improvements to enhance program efficiency:
- A more efficient entry point that uses a single pointer to reference account information directly from the input, resulting in an order of magnitude improvement in performance.
- A new "lazy" entry point type that delays reading input, giving developers more control over when and what to read. This is particularly useful for programs with a single instruction or very few instructions.
- Lightweight view types that redefine account info, account meta, and instruction to use references instead of owning data. This reduces cloning and improves efficiency, especially in cross-program invocations (CPIs).
- An optimized approach to program logging, featuring a lighter way to format messages without allocations or external dependencies. This can lead to significant reductions in compute unit usage for logging operations.
These improvements collectively contribute to more efficient Solana programs, reducing compute unit usage and improving overall performance.
Case Studies: Pitoken and Memo Program
Otero presented two compelling case studies to demonstrate Pinocchio's effectiveness:
- Pitoken: A reimplementation of the SPL token program using Pinocchio. This new version achieved a 88-95% reduction in compute unit usage and a 40% reduction in binary size while maintaining the same behavior and output. Notably, 70% of the reduction came from changing the entry point and implementing zero-copy account data access.
- Memo Program: An optimized version of the memo program using Pinocchio's lazy entry point. This implementation resulted in an 80-87% reduction in compute unit usage, achieved through the efficient entry point, optimized logging, and an improved method for converting public keys to base58 format.
These case studies provide concrete evidence of Pinocchio's potential to significantly improve the efficiency of Solana programs across various use cases.
Facts + Figures
- Pinocchio achieves an order of magnitude improvement in entry point efficiency compared to traditional methods
- The SDK offers a 5x reduction in compute unit usage for cross-program invocations (CPIs)
- Pitoken, the Pinocchio implementation of the SPL token program, reduces compute unit usage by 88-95%
- Pitoken's binary size is 40% smaller than the original SPL token program
- 70% of Pitoken's efficiency gains come from changing the entry point and implementing zero-copy account data access
- The optimized memo program using Pinocchio reduces compute unit usage by 80-87%
- Pinocchio's logging system can achieve up to an order of magnitude improvement in formatting cost for program logs
- The SDK is designed to be used as a drop-in replacement for the Solana program crate
- Pinocchio is a no-std crate, meaning it doesn't use any of the standard library types
- The ANZA team is working on integrating Pinocchio's new types into the Solana SDK
- Future plans include optimizing the Associated Token Account (ATA) program and Token22 program using Pinocchio
Top quotes
- "Pinocchio is to be a program first SDK that is going to follow what works best for on-chain programs."
- "The idea of Pinocchio is to be a program first SDK that is going to follow what works best for on-chain programs."
- "It's possible to write a Pinocchio program without any unsafe code."
- "We managed to reduce the CU's used by the token program by 88% to 95% depending on the instruction that you are executing."
- "70% of their reduction is achieved by changing the entry point to use Pinocchio entry point and doing zero-copy account data access."
Questions Answered
What is Pinocchio and why was it created?
Pinocchio is a new dependency-free SDK for writing efficient Solana programs. It was created in response to the dependency issues plaguing the Solana program crate. The idea emerged from a conversation between Fernando Otero and John at the Hackinghouse in London, with the goal of creating an SDK that prioritizes on-chain program performance and mitigates dependency problems.
How does Pinocchio improve program efficiency?
Pinocchio improves program efficiency through several key features. It offers a more efficient entry point that uses a single pointer to reference account information directly from the input. It also introduces lightweight view types that reduce cloning, especially in cross-program invocations. Additionally, Pinocchio provides an optimized approach to program logging, which can significantly reduce compute unit usage for logging operations.
What are the main principles behind Pinocchio's design?
The main principles behind Pinocchio's design include avoiding external dependencies in the main crate, focusing on performance, using no dynamic memory allocation, implementing zero-copy data access when possible, and providing both safe and unsafe function variants. These principles aim to create an SDK that is tailored specifically for on-chain programs and offers improved performance.
How effective is Pinocchio in reducing compute unit usage?
Pinocchio has shown impressive results in reducing compute unit usage. In the case of Pitoken, a reimplementation of the SPL token program, compute unit usage was reduced by 88-95% depending on the instruction. For the optimized memo program, Pinocchio achieved an 80-87% reduction in compute unit usage. These significant reductions demonstrate Pinocchio's effectiveness in improving program efficiency.
Can Pinocchio be used as a drop-in replacement for the Solana program crate?
Yes, Pinocchio is designed to be used as a drop-in replacement for the Solana program crate. Developers can use Pinocchio in the same way they would use the Solana program crate, making it easy to integrate into existing projects and workflows.
What are the future plans for Pinocchio?
The ANZA team is currently working on integrating Pinocchio's new types into the Solana SDK to make it easier for developers to write code that can be used in both off-chain clients and on-chain programs. Future plans also include optimizing other programs such as the Associated Token Account (ATA) program and potentially creating a "Pitoken 22" version of the Token22 program using Pinocchio's optimizations.
Is it safe to use Pinocchio for Solana program development?
Yes, it is safe to use Pinocchio for Solana program development. While the SDK offers unsafe variants of functions for improved performance, Fernando Otero emphasizes that it's entirely possible to write a Pinocchio program without any unsafe code. The unsafe variants are provided as options for cases where developers can guarantee safety constraints and want to achieve extra performance.
Comments
Please login to leave a comment.
On this page
- Summary
- Key Points:
- Facts + Figures
- Top quotes
-
Questions Answered
- What is Pinocchio and why was it created?
- How does Pinocchio improve program efficiency?
- What are the main principles behind Pinocchio's design?
- How effective is Pinocchio in reducing compute unit usage?
- Can Pinocchio be used as a drop-in replacement for the Solana program crate?
- What are the future plans for Pinocchio?
- Is it safe to use Pinocchio for Solana program development?
Related Content
Solana Changelog: Colosseum Hackathon Success, Builder Interest Surge, and Developer Experience Improvements
Anchor: Today and Tomorrow
Solana Changelog October 23
Compass: Ensuring SPL-Token Stays Safe on Pinocchio Runtime Verification
Solana Changelog Oct 23
Scale or Die at Accelerate 2025: Writing Optimized Solana Programs
Solana Changelog Nov 6th
The Great Online Game with Packy McCormick
Product Keynote: Blueshift
Solana Changelog Jun 19 - Test validator fix, new Syscall, RPC updates, and more
Solana Changelog November 6th
Building StarAtlas, the blockchain game and economy with Michael Wagner, CEO - Solfate Podcast #29
Solana Changelog - Mar 19: Anza's Agave Client, Compute, and create-solana-program
Breakpoint 2025: Security Block: Asymmetric Research
Solforge Fusion: Combining Physical Card Games With Web3 Primitives | Justin Gary
Latest news
Solana Foundation CPO: $3B in RWAs Is 0.001% of What's Possible
PiggyBank's LAB Basis Trade Unwinds, Cutting Vault NAVs by Up to 15%
Kazakhstan Stock Exchange Becomes Country's First Registered Digital Asset Platform Operator on Solana
DFDV Co-Founder Parker White Departs to Lead Apyx as Solana Treasury Pioneer Holds 2.3M SOL
SOL Strategies Sells 65,001 SOL to Retire Debt and Restructures Related-Party Credit Facility
Morgan Stanley and Galaxy Digital Let HNW Clients Lend BTC, ETH, and SOL for ETP Shares
Solana Reaches 10% of Global USDC Supply as Circle Mints $500M in a Single Day
SIMD-547 Would Multiply Solana's Daily SOL Burns Up to 100x Through Resource-Based Fees
Pump.fun Launches GO, a Bounty Marketplace Where Users Pay Anyone to Do Anything
Solana's May 2026 Ecosystem Roundup: RWA Hits $2.8B ATH, Stablecoins Reach $16.4B, ETFs Post Best Month Since Launch
Solana Token Markets
