Skip to content

This repository contains the code for Counter Solana Program built using Anchor Framework.

License

Notifications You must be signed in to change notification settings

YosephKS/counter-anchor

Repository files navigation

⚓︎ Counter Anchor

This repository contains the a Counter 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/counter_anchor-keypair.json

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

[programs.localnet]
counter_anchor = "program-id"
[programs.devnet]
counter_anchor = "program-id"
[programs.testnet]
counter_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 repository contains the code for Counter Solana Program built using Anchor Framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages