Day 3 of RareSkills Solana Course.
- Configure Solana to run on localhost:
solana config set --url localhost
- Run the test validator node on another terminal:
solana-test-validator
- Run Solana logs on another terminal:
solana logs
- Build Anchor program:
anchor build
- Sync program_id with Anchor key:
anchor keys sync
- Run tests:
anchor test --skip-local-validator
Note:
anchor build
only affectslib.rs
file.To test the
IDL
output ofnon-empty-account.rs
, replace the contents oflib.rs
with the contents fromnon-empty-account.rs
.
- The
Interface Definition Language (IDL)
is a JSON file that describes how to interact with aSolana program
. - The
IDL
is automatically generated by theAnchor framework
. - An
IDL
file in Solana is similar to anABI
file inSolidity
. - Rust functions are
snake_cased
, but Anchor formats the functions tocamelCased
for JavaScript. Initialize
is the default naming of the struct by Anchor, but you can rename it.#[derive(Accounts)]
adds accounts from the struct to theIDL accounts key
.