Earn 5.75% APY staking with Solana Compass + help grow Solana's ecosystem

Stake natively or with our LST compassSOL to earn a market leading APY

Conference Talk Accelerate 25

Scale or Die 2025: No-strings-attached programs w/ Pinocchio

Solana 🧭 Compass By Solana 🧭 Compass May 20, 2025 7 min read

Discover how Pinocchio is revolutionizing Solana program development with improved efficiency and performance

The notes below are AI generated and may not be 100% accurate. Watch the video to be sure!

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.

Keep up to date with the Solana eco
Follow us on Google News

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:

  1. No external dependencies in the main crate
  2. Focus on performance
  3. No dynamic memory allocation
  4. Zero-copy data access when possible
  5. 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:

  1. 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.
  1. 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.
  1. 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).
  1. 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:

  1. 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.
  1. 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

  1. "Pinocchio is to be a program first SDK that is going to follow what works best for on-chain programs."
  2. "The idea of Pinocchio is to be a program first SDK that is going to follow what works best for on-chain programs."
  3. "It's possible to write a Pinocchio program without any unsafe code."
  4. "We managed to reduce the CU's used by the token program by 88% to 95% depending on the instruction that you are executing."
  5. "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.


Solana tokens

Solana Token Markets

Explore all tokens →