Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

febo/p-token

Repository files navigation

Important

p-token codebase moved to SPL Token repository.

p-token

p-token

A pinocchio-based Token program.

Overview

This repository contains a proof-of-concept of a reimplementation of the SPL Token program, one of the most used programs on Solana, using pinocchio. The purpose is to have an implementation that optimizes the compute units, while being fully compatible with the original implementation — i.e., support the exact same instruction and account layouts as SPL Token, byte for byte.

Features

  • no_std crate
  • Same instruction and account layout as SPL Token
  • Minimal CU usage

Status

  • Account and Mint
  • Instructions
  • Basic instruction tests
  • Existing SPL Token tests

Compute Units

Instruction Completed CU (p-token) CU (spl-token)
InitializeMint 100 2967
InitializeAccount 185 4527
InitializeMultisig 204 2973
Transfer 155 4645
Approve 122 2904
Revoke 97 2677
SetAuthority 127 3167
MintTo 155 4538
Burn 168 4753
CloseAccount 154 2916
FreezeAccount 136 4265
ThawAccount 136 4267
TransferChecked 204 6201
ApproveChecked 162 4459
MintToChecked 164 4546
BurnChecked 169 4755
InitializeAccount2 164 4388
SyncNative
InitializeAccount3 272 4240
InitializeMultisig2 319 2826
InitializeMint2 234 2827
GetAccountDataSize
InitializeImmutableOwner
AmountToUiAmount 503 2501
UiAmountToAmount 875 3161

Tests were run using Solana v2.1.0.

Building

To build the programs from the root directory of the repository:

pnpm install

to install the required libraries, then:

pnpm programs:build

Testing

To run the tests against both versions of the Token program:

pnpm programs:test

License

The code is licensed under the Apache License Version 2.0

About

A pinocchio-based Token program

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published