This project demonstrates a basic smart contract written in Rust with Anchor. It comes with a smart contract and a test for the contract.
Before you can run the project test cases you will need to install dependencies and setup your keypair.
First make sure you have the Rust programming language installed, you can follow the installation guide here:
Verify that Rust and Cargo were installed correctly by running the following commands.
rustup --version
rustc --version
cargo --version
Follow the installation steps here to install the Solana CLI. This is a necessary step to test contracts locally.
Verify that solana was installed correctly:
solana --version
Run some config commands:
solana config set --url localhost
solana config get
Install Anchor, a popular development framework for Solana. To learn more about Anchor, check out The Anchor Book.
cargo install --git https://github.com/project-serum/anchor anchor-cli --locked
Verify the installation
anchor --version
Install the remaining npm dependencies
npm install
Generate a new keypair
solana-keygen new -o target/deploy/hello-world-solana-keypair.json
Verify that the wallet property in Anchor.toml
is pointing to the keypair we just created
wallet = "target/deploy/hello-world-solana-keypair.json"
anchor
anchor build
anchor test
anchor deploy <project_path>/target/deploy/hello_world_solana.so
When deploying, you can override the project address by passing --program-id
- Let users like/dislike messages
- Emit an event when a message is liked/disliked
- Let users reply to messages
- Explore options like
@solana/web3.js
to make frontend web3 development a breeze