Note: We're expecting you have both
rust
andsolana cli
installed. If you are running on the MacOS M1 and encounter issues, we suggest NOT to use brew to install rust, instead use curl or install from source.
-
Install and build - creates binary files for each of the examples in
examples_baremtal/
creates insidetarget/
npm i npm run build
-
Set your config to localhost
solana config set --url localhost
-
Run in separate terminal window. This will spin up local solana cluster for you with RPC endpoint defaulted to
localhost:8899
, same as runningsolana-test-validator --reset
npm run start-local-cluster
-
Monitor the logs in separate window by running
solana logs
-
For each example run the following commands. The program would be deployed to the network specified in solana config
npm run deploy:n
where
n
is example number from 1 to 7 what this script does in the backgroundsolana program deploy ./examples_baremetal/target/deploy/nameOfExampleProgram.so
-
To interact with the contract, we'll be running the typescript code located in
client/
within each examplenpm run call:n
where n is example number from 1 to 7
-
If you want to use devnet run:
solana config set --url https://api.devnet.solana.com # or solana config set --url devnet