Day 23 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 --reset
- 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
- There are no concepts of
payable
ormsg.value
in Solana. - Ethereum wallets
pushes ETH
to the contract, while Solana programspull SOL
from the wallet.
- The
system program
transfers SOL from one account to another. - The
system program
has atransfer(cpi_context, amount)
function. - The
system program
needs aContext
that can be built usingCpiContext
. - The
SOL transfer amount
is not part of theContext
. is_ok()
can be used to check if thecross program invocation
succeeded.- Only the signer can be
from
.- The
system program
will reject the call iffrom
is not aSigner
.
- The
ctx.remaining_accounts
accepts an arbitrary number of accounts without having to create multiple keys in theContext struct
.