This is a simple Solana program that implements a scoreboard built for Elusiv's Bootcamp Project. It is intended to be used as a reference for how to write Solana programs.
initialize_scoreboard
- Initializes the scoreboard that can hold a max of 20 scores. Uses seeds:scoreboard
&signer.key().as_ref()
add_score
- Adds a score (player, score, timestamp) to the scoreboard with the signer as player, requires inputsscore
×tamp
reset_scoreboard
- Resets the scoreboard to an empty state, requires signer to be the authority
- run
yarn install
to install dependencies. - change wallet path in
Cargo.toml
to your CLI wallet path, you can access this by runningsolana config get
. - make sure your Solana CLI is set to local host by running
solana config set --url localhost
- Build the program by running
anchor build
(this will generate a/target
folder). - Open second terminal and run
solana-test-validator
to start a local Solana cluster. - back in the first terminal window, run
anchor deploy
to deploy program to your local validator, this will produce aProgram Id
in your terminal. - Copy the
Program Id
and paste it into theProgramId
variable inAnchor.toml
:[programs.localnet] scoreboard = "3uj1ZssrUsXA5rMJRj9M5tq4smLdyjNFAvTknvGKBX21"
- Run
anchor build
andanchor deploy
again for ProgramId to take effect. - Run
anchor test --skip-local-validator
to run the tests.