It is assumed vagrant and VirtualBox are already installed on Mac OS
Make sure vagrant
has the following plugins (version at the time of writing):
- vagrant-bindfs: 1.1.9
- vagrant-hostmanager: 1.8.9
- vagrant-vagrant-notify-forwarder: 0.5.0
- vagrant-vbguest: 0.30.0
After booting up the VM, the required components such as nodejs
, rust
, solana
will be available.
For completeness:
nodejs
version:16.14.2
rust
version: the latest availablesolana
version:1.9.5
Preferred editor is Visual Studio Code (from here onward VSCode). Add extension Remote Development
.
Connect to the VM using SSH from inside VSCode. If the VM is not listed on host file $HOME/.ssh/config
,
add to it from VSCode itself, or manually and then refresh the list.
Open folder to $HOME/project
and install Rust
and any other helpful extension from inside the VM.
From inside the VM, run Solana commands for checking and updating the configuration.
$ # solana configuration
$ solana config get
Config File: /home/vagrant/.config/solana/cli/config.yml
RPC URL: https://api.mainnet-beta.solana.com
WebSocket URL: wss://api.mainnet-beta.solana.com/ (computed)
Keypair Path: /home/vagrant/.config/solana/id.json
Commitment: confirmed
$ # set localhost network
$ solana config set --url localhost
Config File: /home/vagrant/.config/solana/cli/config.yml
RPC URL: http://localhost:8899
WebSocket URL: ws://localhost:8900/ (computed)
Keypair Path: /home/vagrant/.config/solana/id.json
Commitment: confirmed
$ # current local wallet
$ solana address
Error: No default signer found, run "solana-keygen new -o /home/vagrant/.config/solana/id.json" to create a new one
$ solana-keygen new
Generating a new keypair
For added security, enter a BIP39 passphrase
NOTE! This passphrase improves security of the recovery seed phrase NOT the
keypair file itself, which is stored as insecure plain text
BIP39 Passphrase (empty for none):
Wrote new keypair to id-devnet.json
=======================================================================
pubkey: 4hFkodSHRQ5pbQ1RB6BhF4aLHb3mFj8K2oPp8EGk7iCe
=======================================================================
Save this seed phrase and your BIP39 passphrase to recover your new keypair:
actual cause spider robot evoke oven police hunt syrup social rice stem
=======================================================================
$ solana address
BxDS9s2YRihS61kkciUTN5B92z1oNqPEyi7J4BfgSGcc
$ # DON'T run solana-test-validator from inside `project` folder
$ solana-test-validator
From another terminal:
$ solana airdrop 100
Requesting airdrop of 100 SOL
Signature: 21eGD3RAJvChZhUYLm9KV7732MukqFNYe93wi3UG1bQFk61kBNZ71oVH9Ub2BMSnn5WjPivKFoaDKYVtCGpeTyd4
500000100 SOL
$ solana balance
500000100 SOL
solana-keygen pubkey prompt://
[seed phrase]
[BIP39 passphrase]
Exercises source code from the speaker repo:
GM program
completed code repositoryToken program
completed code repository
Exercises source code from the speaker repo:
GM anchor
completed code repositorySolana social
completed code repositorySolana chainlink
completed code repository
NOTE
- anchor makes use of yarn, replace
npm install
withyarn add
- it is preferred to keep keypairs together, use folder
anchor
and generate a new keypair likesolana-keygen new -o ./anchor/id.json
orsolana-keygen new -o ./anchor/id-devnet.json
.- when requested to export the wallet, go into the folder anchor and run
export ANCHOR_WALLET="$(pwd)/id.json"
- https://solanacookbook.com
- https://soldev.app
- https://solana.com/developers
- https://book.anchor-lang.com
- https://github.com/smartcontractkit/solana-starter-kit
- https://chain.link/hackathon
-
NFS is reporting that your exports file is invalid. Vagrant does this check before making any changes to the file. Please correct the issues below and execute "vagrant reload"
.Solution
(Workaround) Remove entries from
/etc/exports
.