Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Account Data (Anchor)

Note

This is the Anchor v1 copy of this example, on Anchor 1.2.0, the current stable Anchor release. Every anchor command on this page needs the v1 CLI: avm install 1.2.0 && avm use 1.2.0. The Anchor v2 version of this example is in ../anchor.

Store and retrieve arbitrary data in a Solana account owned by this program.

See also: the repository catalog.

Major concepts

  • Account ownership and lamport rent
  • Serializing and deserializing account data

Setup

From this directory (basics/account-data/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.