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.
- Account ownership and lamport rent
- Serializing and deserializing account data
From this directory (basics/account-data/anchor/):
anchor buildPrerequisites: Agave CLI (version in Anchor.toml [toolchain]), Anchor.
Tests run in-process with LiteSVM. No local validator.
anchor testThis runs cargo test as configured in Anchor.toml. Tests call instruction handlers and check onchain state.
Read the program programs/ source and Anchor.toml for deployed program IDs. For deployment, use anchor build && anchor deploy against your target cluster.