Scale or Die 2025: No-strings-attached programs w/ Pinocchio
By accelerate-25
Published on 2025-05-20
Fernando Otero introduces Pinocchio, a new dependency-free SDK for writing efficient Solana programs
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.
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
Ship or Die 2025: Enterprise Adoption of Stablecoins
Exploring the future of stablecoins and their impact on global financial systems
Breakpoint 2023: On-Chain Fantasy Leagues
Brandon Brown introduces on-chain fantasy leagues for F1, aiming to onboard new crypto users through engaging games.
5 Pro-Tips to Win The Solana Hackathon
Discover 5 essential pro-tips to increase your chances of winning a Solana hackathon, including problem-solving, Solana-specific development, and effective presentation techniques.
Breakpoint 2023: Program Runtime v2
The latest updates on Solana's Program Runtime v2 aim to enhance efficiency, composability, and ease of use for developers.
Why DePIN Matters: Powering The Crypto Economy | Jon Victor
Explore the world of Decentralized Physical Infrastructure Networks (DePIN) and how Filecoin is revolutionizing data storage and retrieval in the crypto economy.
Ship or Die at Accelerate 2025: Time Is Money (Kawz - Time.fun)
Kawz introduces Time.fun, a platform that tokenizes time and creates new capital markets on Solana
Breakpoint 2023: Ensuring the Safety of SBF Programs Through Formal Verification
A deep dive into making Solana contracts safer with Sertora's formal verification tool.
xNFTs and Solana Phone ft. Armani Ferrante
Discover how xNFTs and the Solana Phone are revolutionizing Web3 mobile experiences with Coral founder Armani Ferrante.
Scale or Die at Accelerate 2025: Writing Optimized Solana Programs
Dean Little from Blueshift delivers an in-depth exploration of Solana program optimization techniques at Accelerate 2025.
Breakpoint 2023: Creating Great Content
Content creator Solandy shares insights on producing engaging and educational content, specifically for Solana development.
Breakpoint 2023: Solana and AWS
AWS announces infrastructure for running Solana nodes and focuses on cost optimization for blockchain applications.
Breakpoint 2023: DeFi/Insti Panel Discussion Highlights
Insights from financial technology experts on DeFi's impact on traditional finance and institutional capital deployment.
Breakpoint 2023: Fuzzing, Formal Methods, and the State of Solana Security
An exploration of how fuzzing and formal verification techniques contribute to the security of the Solana blockchain.
Breakpoint 2023: Water from a Stone: Liquid Staking on Solana
A deep dive into the evolving landscape of liquid staking on the Solana blockchain featuring key industry players.
Breakpoint 2023: Removing the Risk from DeFi
Former CEO of Amulet addresses the risks in DeFi and proposes a solution inspired by successful FinTech models.
- Borrow / Lend
- Liquidity Pools
- Token Swaps & Trading
- Yield Farming
- Solana Explained
- Is Solana an Ethereum killer?
- Transaction Fees
- Why Is Solana Going Up?
- Solana's History
- What makes Solana Unique?
- What Is Solana?
- How To Buy Solana
- Solana's Best Projects: Dapps, Defi & NFTs
- Choosing The Best Solana Validator
- Staking Rewards Calculator
- Liquid Staking
- Can You Mine Solana?
- Solana Staking Pools
- Stake with us
- How To Unstake Solana
- How validators earn
- Best Wallets For Solana