← Retour au fil
P-Token : le prochain gain d'efficacité majeur de Solana
Helius8 sept., 18h · il y a 10 mois

P-Token : le prochain gain d'efficacité majeur de Solana

Le programme P-Token d'Anza divise par 19 la consommation de compute units des transactions SPL, libérant 9,5% de capacité de bloc additionnelle sur Solana.

Solana repose depuis ses débuts sur le SPL Token Program, un programme standardisé et audité qui a permis une explosion de l'activité token : 200 000 à 300 000 nouveaux tokens créés chaque semaine, et jusqu'à 867 millions de transferts hebdomadaires. Mais ce programme monopolise aujourd'hui environ 10% de la consommation totale de compute units (CU) des blocs.

Proposé par Anza via le SIMD-0266, P-Token est un remplaçant direct basé sur la bibliothèque Pinocchio. Il réduit la consommation de CU d'environ 95% sur les instructions standard, sans casser la compatibilité avec les tokens SPL existants. Ce n'est pas un nouveau standard mais une optimisation : aucun ajustement côté applications ou utilisateurs. La part de CU du Token Program passerait de 10% à 0,5%, libérant de l'espace pour davantage de transactions par bloc et améliorant la composabilité des programmes.

Solana

Détails

Source
Helius
Publication
8 sept. à 18h18

Contenu source (brut)

<p>Many thanks to Febo, Jacob Creech, and 0xIchigo for reviewing earlier versions of this work.</p><h2>Introduction</h2><p>One of the less appreciated factors behind Solana’s rapid adoption is its safe, straightforward, and standardized approach to tokens. Unlike many other blockchains, creating a token on Solana does not require deploying a custom contract. Instead, everything runs through the heavily <a href="https://cdn.21.co/audits/21BTC_SPL+Token+Audit.pdf"><span style="text-decoration: underline">audited</span></a> and battle-tested <a href="https://github.com/solana-program/token"><span style="text-decoration: underline">SPL token program</span></a> (AKA Tokenkeg) originally deployed by Solana Labs. This approach makes common actions such as minting, burning, and transferring tokens trivial. Deploying a Solana token can be achieved with a single CLI command, for example.</p><p></p><p>The SPL Token Program is the most heavily used program on Solana (aside from the System program). Over the past six months, weekly creation of new fungible tokens through the SPL token program has averaged between 200,000 and 300,000. This represents a 20x increase over two years earlier in September 2023, when weekly new SPL token creations were regularly under 10,000. Overall, except for 2023, every year since Solana’s launch has recorded a significant increase in the number of new tokens issued, as shown by the chart below.</p><p></p><img src="/_next/image?url=/api/media/file/Solana-weekly-fungible-tokens-created.PNG&w=3840&q=90" alt="Solana weekly fungible tokens created" /><p></p><p>The growth in SPL token transfers has been even more pronounced. Over the past three months, weekly transfers have consistently exceeded 650 million, peaking at 867.8 million in late July. This peak represents a 17.5x increase from the low of 49.4 million weekly transfers recorded in early August 2023.</p><p></p><img src="/_next/image?url=/api/media/file/Solana-weekly-token-transfers.PNG&w=3840&q=90" alt="Solana Weekly Token Transfers" /><p></p><h2>Enter P-Token</h2><p>P-token is a compute-optimized, drop-in replacement for the current SPL Token program, first proposed by the Anza team in March through <a href="https://github.com/solana-foundation/solana-improvement-documents/pull/266"><span style="text-decoration: underline">SIMD-0266: Efficient Token Program</span></a>. It offers substantial reductions in compute unit (CU) usage while remaining fully backward compatible with existing SPL tokens. </p><p></p><p>Because p-token mirrors the exact instruction set and account layouts of the SPL Token program, it can be swapped in as a direct substitute. This means<strong> p-token is </strong><em><strong>not</strong></em><strong> a new token standard</strong>. The client code continues to function exactly as before, ensuring that the transition unlocks significant efficiency gains while requiring no adjustments for applications or users.</p><p></p><p>The drive for adoption of p-token aligns with Solana’s broader push for greater program and framework efficiency, which complements work to increase the network’s capacity, most notably through the 2025 goal of <a href="https://www.helius.dev/blog/agave-v22-update--all-you-need-to-know#raise-block-limits-to-60m-cus"><span style="text-decoration: underline">doubling available block space</span></a>.</p><p></p><p>The <a href="https://www.helius.dev/blog/solanas-proprietary-amm-revolution#oracle-updates"><span style="text-decoration: underline">recent success of proprietary AMMs</span></a> on Solana showcases the impact of lower compute costs and the advantages of highly efficient programs. For instance, oracle updates on platforms like HumidiFi have been <a href="https://orb.helius.dev/tx/39dNs4LHnvnxCjy1LhwCqrQ89MMwUf19FLh1v7dmMvNAPkjcnQ7gwxyKtcEiyiQRXKhmTtUzSVCo5CkKcFF3Sz1v?cluster=mainnet-beta&amp;advanced=true&amp;tab=logs"><span style="text-decoration: underline">hyper-optimized down to just 143 CUs</span></a>. Doppler, a new open-source oracle program from BlueShift, <a href="https://github.com/blueshift-gg/doppler?tab=readme-ov-file"><span style="text-decoration: underline">brings costs down even further to just 21 CUs</span></a>.</p><p></p><h3>Pinocchio</h3><p>The “p” in p-token stands for <a href="https://www.helius.dev/blog/pinocchio"><span style="text-decoration: underline">Pinocchio</span></a>, an optimized, performant, zero-dependency library for writing Solana programs developed by Anza. Pinocchio serves as a replacement for the standard <a href="https://crates.io/crates/solana-program"><span style="text-decoration: underline">solana-program crate</span></a>, which makes extensive use of zero-copy types for handling instruction and account data. With zero-copy, data is not duplicated into new memory locations when read or written. Instead, the state is accessed directly through pointers. This design achieves significant compute savings by avoiding unnecessary memory operations, while also reducing runtime overhead.</p><p></p><p>Pinocchio is also <a href="https://docs.rust-embedded.org/book/intro/no-std.html"><span style="text-decoration: underline">no_std</span></a>, meaning it does not rely on Rust’s standard library or heap allocations, since the Solana Virtual Machine (SVM) already provides the runtime environment. This further streamlines execution and reduces dependencies, ensuring leaner, faster programs.</p><h3>Efficiency Gains</h3><p>CUs measure the cost of execution in Solana’s runtime. The smallest operation, such as the addition of two integers or a bitwise operation, consumes 1 CU. Programs are capped at 200 thousand CUs per instruction and 1.4 million CUs per transaction.</p><p></p><p>P-Token delivers dramatic efficiency improvements, reducing CU consumption for standard SPL token transactions by roughly 95% (a 19x gain in efficiency). This faster execution translates to a smoother user experience, while freeing up compute allows more transactions to fit within each block, directly boosting network throughput.</p><p></p><p>Today, Token program instructions <a href="https://github.com/solana-foundation/solana-improvement-documents/pull/266/files#:~:text=About%20%60~10,block%20space%20gain."><span style="text-decoration: underline">account for around 10% of block-wide CU usage</span></a>. By cutting their cost to just 5% of current levels, p-token can lower that share from 10% to 0.5%, unlocking an additional 9.5% of block capacity for other transactions. P-token also benefits downstream programs, offering improved composability by reducing overall CU usage and lowering the cost of cross-program invocations (CPI).</p><p></p><p>Below is data detailing the CU efficiency gained by p-token instructions compared to the current SPL Token program in both chart and table form.</p><p></p><img src="/_next/image?url=/api/media/file/P-token-vs-SPL-token-program-CU-consumption-comparison-1.PNG&w=3840&q=90" alt="P-token vs. SPL token program CU consumption comparison 1" /><p></p><span>unknown node</span><img src="/_next/image?url=/api/media/file/P-token-vs-SPL-token-program-CU-consumption-comparison-2.PNG&w=3840&q=90" alt="P-token vs. SPL token program CU consumption comparison 2" /><p></p><span>unknown node</span><p>Another notable optimization, enabled largely by `no_std`, is the reduction of the program binary size from 131 KB down to 95 KB.</p><h2>Additional Instructions</h2><p>P-token proposes to add three new instructions (`withdraw_excess_lamports`, `batch`, and `unwrap_lamports`) to the token program not present in the original SPL token program.</p><h3>Withdraw Excess Lamports</h3><p>Similar to the current SPL Token-2022 implementation, `<a href="https://github.com/solana-program/token/blob/main/p-token/src/processor/withdraw_excess_lamports.rs"><span style="text-decoration: underline">withdraw_excess_lamports</span></a>` allows for the recovery of excess SOL “bricked” in the mint account. This usually happens when a us