Solana for Developers

Voting Program Setup

Create the files and install the dependencies required to complete your voting program.

Initialize a new Rust project by running the command below:

shell
cargo init voting_program --lib

cd into the created project directory and run the commands create the files and folders required for this project:

shell
mkdir state enums
touch instructions.rs errors.rs processor.rs

Run the command below to install the required crates:

shell
cargo add solana-program@2.3.0 solana-system-interface@1.0.0 borsh@1.5.7 thiserror@2.0.12

The unfamiliar dependencies you installed above include:

  • thiserror : This crate the creation of custom error types. You will need it because this program will feature some custom errors.

Last updated on

On this page

No Headings
Edit on GitHub