- node: 17.0.1
- homebrew: 3.3.2
- npm: 8.1.0
- solana-cli: 1.9.0
Install rust
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
Clone solana from source
git clone https://github.com/solana-labs/solana.git
cd solana
Switch to the current tag version to build off of
git fetch --all --tags --prune
git checkout tags/v1.8.2 -b v1.8.2
Install coreutils - this fixed the greadit (sp?) error
brew install coreutils
Install Solana from source
./scripts/cargo-install-all.sh .
export PATH=$PWD/bin:$PATH
Add the above export (replace PWD with the result from echo $PWD
) to
your bashrc or zshrc for persistence.
solana-test-validator --no-bpf-jit
should run at this point!
Gossip Address: 127.0.0.1:1024
TPU Address: 127.0.0.1:1027
JSON RPC URL: http://127.0.0.1:8899
In a new shell tab
solana config set --url localhost
# Verify its set to your local config
solana config get
solana-keygen new
solana airdrop 10
Install Mocha for Anchor
npm install -g mocha
Install anchor
cargo install --git https://github.com/project-serum/anchor anchor-cli --locked
Now use anchor to init a new app! Use any name, just be sure to change the below commands with the project name
anchor init helloworld --javascript
cd helloworld/
And test!
anchor test --skip-local-validator
Error: failed to send transaction: Transaction simulation failed: Attempt to load a program that does not exist
Mine failed the first time, if this happens grab the program_id
from target/deploy/helloworld-keypair.json
by running
solana address -k target/deploy/helloworld-keypair.json
Place this address in programs/helloworld/src/lib.rs
Here -> declare_id!(ADDRESS_HERE)
Place the address in Anchor.toml
as well
And test... again!
anchor test --skip-local-validator
Program Id: EHyhQcq2wU6Vtavi8eJBUis4PnfcAuKU2tMNzG7LK7hy
Deploy success
helloworld
Your transaction signature bc12xE1JXwgXnYDLkm5mrXnSxpz39NyoR5rZpUy5FR92NYjZHyoBysvoAiC3bDgJEgSMSZCSTMDExvnGHkR9MTm
✔ Is initialized! (559ms)
1 passing (5
Happy Hacking on Solana! :D