Skip to content

joncinque/solana-helloworld-zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

solana-helloworld-zig

A simple hello world program for Solana in Zig.

Getting started

Compiler

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.

Submodules

Since zig's package manager is still in development, this project opts for directly including the upstream Solana package requirements, hosted at solana-sdk-zig.

This repo uses git submodules:

$ git submodule update --init --recursive

Build

You can build the program by running:

$ /path/to/your/zig build

Deploy

With the Solana tools, run:

$ solana program deploy zig-out/lib/helloworld.so
Program Id: <YOUR_PROGRAM_ADDRESS>

Command-line Interface

The repo has a simple CLI to send instructions to the program:

$ cd cli
$ ./test.sh

The CLI requires a Rust compiler to run, and the test script requires the Solana CLI to startup a test validator.

Program Tests

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.sh

These tests require a Rust compiler along with the solana-zig compiler.

About

A simple hello world program for Solana in Zig

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published