The Anchor workflow
Create a workspace
anchor init scaffolds a workspace with programs/, tests/ and an Anchor.toml that names the cluster and wallet.
anchor init my_program
cd my_programBuild and sync the program ID
anchor build compiles the program and generates the IDL. anchor keys sync writes the program keypair's address into declare_id! and Anchor.toml.
anchor build
anchor keys syncDesign accounts first
Write the #[derive(Accounts)] structs and constraints before handler logic. The Account constraints lesson shows how real projects do it.
Use the IDL on the client
The generated IDL in target/idl drives typed clients. Check the Anchor docs for the client package that matches your Anchor version.
Commands and APIs change, so the official Solana docs and Anchor docs are the source of truth.