A simple hello world program for Solana in Zig.
First, you need a zig compiler built with Solana's LLVM fork. See the README of solana-zig-bootstrap on how to build it, or you can download it from the GitHub releases page.
There is also a helper script which will install it to the current directory:
./install-solana-zig.shThis project opts for the zig package manager and the package declared at solana-program-sdk-zig.
zig fetch --save https://github.com/joncinque/base58-zig/archive/refs/tags/v0.15.0.tar.gz
zig fetch --save https://github.com/joncinque/solana-sdk-zig/archive/refs/tags/v0.17.0.tar.gzYou can build the program by running:
./solana-zig/zig buildWith the Solana tools, run:
solana program deploy zig-out/lib/helloworld.soThe repo has a simple CLI to send instructions to the program:
cd cli
./test.shThe CLI requires a Rust compiler to run, and the test script requires the Solana CLI to startup a test validator.
There are also integration tests run against the Agave runtime using the
solana-program-test crate.
You can run these tests using the test.sh script:
cd program-test/
./test.shThese tests require a Rust compiler along with the solana-zig compiler.