Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Hello Solana (Anchor)

Note

This is the Anchor v2 copy of this example. Every anchor command on this page needs the v2 CLI: cargo install anchor-cli --version 2.0.0-rc.1 --locked (avm has no prebuilt binary for this pre-release). The Anchor v1 version of this example is in ../anchor-v1.

Minimal program that logs a greeting. Introduces transactions, instructions, and program entrypoints.

See also: Hello Solana overview and the repository catalog.

Major concepts

  • Program entrypoint and instruction data
  • Logging from onchain code

Setup

From this directory (basics/hello-solana/anchor/):

anchor build

Prerequisites: Agave CLI (version in Anchor.toml [toolchain]), Anchor.

Testing

Tests run in-process with LiteSVM. No local validator.

anchor test

This runs cargo test as configured in Anchor.toml. Tests call instruction handlers and check onchain state.

Usage

Read the program programs/ source and Anchor.toml for deployed program IDs. For deployment, use anchor build && anchor deploy against your target cluster.