Counter Program Setup
Learn how to setup your first Solana program
Here, you will scaffold a new Rust project for your counter program.
To create a Solana program, you have to start by initializing a new Rust project by running the command below:
cargo init counter_program --lib
cd
into the created project directory and run the command below to install the required crates:
cargo add solana-program@2.3.0 solana-system-interface@1.0.0 borsh
The dependencies you installed with the command above include:
solana-program
: This crate includes the core runtime API for writing Solana programs. You need it to access Solana-specific types, macros, and functions required to write and run programs on-chain.solana-system-interface
: This crate contains instructions and constructors for interacting with the System program. You need it to create new accounts, allocate account data, assign accounts to owning programs, etc.borsh
: This crate provides a fast and compact binary serialization format. You need it to serialize and deserialize instruction data and account state for efficient storage and communication within your program.
Now that you have set up your program dependencies, you are ready to define your program’s state.
Last updated on