{"id":13457083,"url":"https://github.com/lithdew/solana-zig","last_synced_at":"2026-01-23T12:17:00.889Z","repository":{"id":50519061,"uuid":"519311033","full_name":"lithdew/solana-zig","owner":"lithdew","description":"Write Solana programs in Zig.","archived":false,"fork":false,"pushed_at":"2023-01-26T10:54:48.000Z","size":40,"stargazers_count":29,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T22:03:58.695Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lithdew.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-29T18:18:44.000Z","updated_at":"2024-12-23T15:39:48.000Z","dependencies_parsed_at":"2023-02-14T16:31:50.996Z","dependency_job_id":null,"html_url":"https://github.com/lithdew/solana-zig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lithdew/solana-zig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fsolana-zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fsolana-zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fsolana-zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fsolana-zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lithdew","download_url":"https://codeload.github.com/lithdew/solana-zig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fsolana-zig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28690944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:01:32.889Z","updated_at":"2026-01-23T12:17:00.869Z","avatar_url":"https://github.com/lithdew.png","language":"Zig","funding_links":[],"categories":["Zig"],"sub_categories":[],"readme":"# solana-zig\n\n## Setup\n\n1. Add this repository as a submodule to your project:\n\n```console\ngit submodule init\ngit submodule add https://github.com/lithdew/solana-zig.git sol\ngit submodule update --init --recursive\n```\n\n2. In build.zig:\n\n```zig\nconst std = @import(\"std\");\nconst sol = @import(\"sol/build.zig\");\n\n// Assume 'step' is a *std.build.LibExeObjStep, and 'sol/' is the directory in\n// which this repository is located within your project.\n\nconst sol_pkgs = sol.Packages(\"sol/\");\n\ninline for (@typeInfo(sol_pkgs).Struct.decls) |field| {\n    step.addPackage(@field(sol_pkgs, field.name));\n}\n```\n\n## Example\n\n1. Setup build.zig:\n\n```zig\nconst std = @import(\"std\");\nconst sol = @import(\"sol/build.zig\");\n\nconst sol_pkgs = sol.Packages(\"sol/\");\n\npub fn build(b: *std.build.Builder) !void {\n    const program = b.addSharedLibrary(\"helloworld\", \"main.zig\", .unversioned);\n    inline for (@typeInfo(sol_pkgs).Struct.decls) |field| {\n        program.addPackage(@field(sol_pkgs, field.name));\n    }\n    program.install();\n\n    try sol.linkSolanaProgram(b, program);\n    try sol.generateProgramKeypair(b, program);\n}\n```\n\n2. Setup main.zig:\n\n```zig\nconst sol = @import(\"sol\");\n\nexport fn entrypoint(_: [*]u8) callconv(.C) u64 {\n    sol.print(\"Hello world!\", .{});\n    return 0;\n}\n```\n\n3. Build and deploy your program on Solana devnet:\n\n```console\n$ zig build\nProgram ID: FHGeakPPYgDWomQT6Embr4mVW5DSoygX6TaxQXdgwDYU\n\n$ solana airdrop -ud 1\nRequesting airdrop of 1 SOL\n\nSignature: 52rgcLosCjRySoQq5MQLpoKg4JacCdidPNXPWbJhTE1LJR2uzFgp93Q7Dq1hQrcyc6nwrNrieoN54GpyNe8H4j3T\n\n882.4039166 SOL\n\n$ solana program deploy -ud zig-out/lib/libhelloworld.so\nProgram Id: FHGeakPPYgDWomQT6Embr4mVW5DSoygX6TaxQXdgwDYU\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithdew%2Fsolana-zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flithdew%2Fsolana-zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithdew%2Fsolana-zig/lists"}