curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
sh -c "$(curl -sSfL https://release.solana.com/beta/install)"
You can also replace beta with stable or any version number.
solana config set --url localhost
Generate your local key-pair:
Store the seed phrase somewhere, if you ever need to recover them.
Anchor provides several convenient developer tools.
cargo install --git https://github.com/project-serum/anchor anchor-cli --locked
npm install -g yarn
Create a project
Anchor will scaffold a project.
cd ~/Workspace anchor init solana-project
Run local ledger
Since during development we will not run on mainnet, we need to run a local ledger/validator. Keep it running.
Build and deploy
This will build and output in /target/deploy/. To find the program address, you can run:
solana address -k target/deploy/solana_project-keypair.json
Update this program address for
Anchor.toml solana_project and
Build again, and deploy this time.
anchor build anchor deploy
anchor run test
At this point, if you have build and deployed correctly, the tests will pass.