Skip to content

This is a Hello World Solana Program using Anchor Framework

License

Notifications You must be signed in to change notification settings

kathodler/hello-anchor

 
 

Repository files navigation

⚓︎ Hello Anchor

This repository contains the a basic Solana program made using the Anchor Framework. The code contains all the necessary workflow to develop a Solana Program, from development, deployment, to testing.

Table of Contents

🎉 Deployed Programs

🛠️ Getting Started

This project assumes your local machine have Node and Cargo installed.

1. Solana CLI

MacOS & Linux

sh -c "$(curl -sSfL https://release.solana.com/v1.9.5/install)"

Windows

curl https://release.solana.com/v1.9.5/solana-install-init-x86_64-pc-windows-msvc.exe --output C:\solana-install-tmp\solana-install-init.exe --create-dirs

2. Anchor CLI

npm i -g @project-serum/anchor-cli

3. Solana Wallet

For this tutorial, we're going to use a Filesystem wallet. This is sufficient for testing, but not recommended for production purpose.

solana-keygen new --no-outfile

🏗️ Development

Open lib.rs and edit the file to your needs. After completing the program, compile it to produce IDL.

anchor build

Once the IDL is generated, get the program id.

solana address -k target/deploy/hello_anchor-keypair.json

After the program id is generated, open Anchor.toml and add the following in it.

[programs.localnet]
hello_anchor = "program-id"
[programs.devnet]
hello_anchor = "program-id"
[programs.testnet]
hello_anchor = "program-id"

🚀 Deployment

To deploy the program to a chosen cluster,

anchor deploy --provider.cluster <cluster-name>

where cluster-name could be localhost, testnet, devnet, and mainnet.

⚗️ Testing

Once the program is deployed, you can test it with the following command.

anchor test

📜 License

GNU Affero General Public License v3.0

About

This is a Hello World Solana Program using Anchor Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 75.6%
  • Rust 24.4%