{"id":49435812,"url":"https://github.com/vitorpy/zignocchio","last_synced_at":"2026-04-29T16:41:49.031Z","repository":{"id":321168476,"uuid":"1079936106","full_name":"vitorpy/zignocchio","owner":"vitorpy","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-06T13:48:51.000Z","size":120,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-06T15:16:20.536Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/vitorpy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-20T16:01:52.000Z","updated_at":"2025-11-06T13:48:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"b331d9e9-1233-4319-b2cd-aebc538c37b9","html_url":"https://github.com/vitorpy/zignocchio","commit_stats":null,"previous_names":["vitorpy/zignocchio"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vitorpy/zignocchio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fzignocchio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fzignocchio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fzignocchio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fzignocchio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitorpy","download_url":"https://codeload.github.com/vitorpy/zignocchio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitorpy%2Fzignocchio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32435120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: 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":"2026-04-29T16:41:48.321Z","updated_at":"2026-04-29T16:41:49.018Z","avatar_url":"https://github.com/vitorpy.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solana BPF Programs with Zig + sbpf-linker\n\nBuild Solana programs in Zig using the standard BPF target and [sbpf-linker](https://github.com/blueshift-gg/sbpf-linker).\n\n## Features\n\n- ✅ Uses standard Zig BPF target (no custom forks)\n- ✅ Zero external dependencies\n- ✅ **Zignocchio SDK** - Full-featured Zig SDK for Solana\n- ✅ LLVM bitcode generation via `-femit-llvm-bc`\n- ✅ Direct syscall invocation via function pointers\n- ✅ Auto-generated syscall bindings with MurmurHash3\n- ✅ Automated build pipeline with `zig build`\n- ✅ Jest-based integration tests with solana-test-validator\n\n## Prerequisites\n\n```bash\n# Install sbpf-linker from master (includes latest fixes)\ncargo install --git https://github.com/blueshift-gg/sbpf-linker.git\n\n# Install Zig 0.15.2 or later\n# Install Node.js for testing\n```\n\n**Note:** SPL Token support requires [sbpf-linker PR #14](https://github.com/blueshift-gg/sbpf-linker/pull/14) to be merged (adds `.rodata.cst32` section support for 32-byte constants).\n\n## Building\n\n```bash\nzig build\n```\n\nThis generates:\n1. `entrypoint.bc` - LLVM bitcode from Zig source\n2. `zig-out/lib/program_name.so` - Final Solana program\n\n## Testing\n\n```bash\nnpm install\nnpm test\n```\n\nTests will:\n- Build the program\n- Start solana-test-validator\n- Deploy the program\n- Execute and verify \"Hello world!\" log output\n\n## How It Works\n\n### 1. Auto-Generated Syscall Bindings\n\nAll Solana syscalls are auto-generated from definitions using MurmurHash3-32:\n\n```bash\nzig run tools/gen_syscalls.zig -- src/syscalls.zig\n```\n\nThis creates function pointers for all syscalls:\n\n```zig\nconst syscalls = @import(\"syscalls.zig\");\nsyscalls.log(\u0026message);  // Calls sol_log_ with hash 0x207559bd\n```\n\nThe hash `0x207559bd` is computed as `murmur3_32(\"sol_log_\", 0)` and resolved by Solana VM at runtime via `call -0x1`.\n\n### 2. Inline String Data\n\nTo prevent sbpf-linker from stripping .rodata, we inline string data:\n\n```zig\nconst message = [_]u8{'H','e','l','l','o',' ','w','o','r','l','d','!'};\n```\n\n### 3. LLVM Bitcode Pipeline\n\nsbpf-linker is an LTO compiler, not a traditional linker. It needs LLVM IR:\n\n```bash\nzig build-lib -target bpfel-freestanding -femit-llvm-bc=entrypoint.bc\nsbpf-linker --cpu v3 --export entrypoint -o program.so entrypoint.bc\n```\n\n## Zignocchio SDK\n\nThis project includes **Zignocchio**, a zero-dependency SDK for building Solana programs in Zig, inspired by [Pinocchio](https://github.com/anza-xyz/pinocchio).\n\n### Quick Example\n\n```zig\nconst sdk = @import(\"sdk/zignocchio.zig\");\n\nexport fn entrypoint(input: [*]u8) u64 {\n    return @call(.always_inline, sdk.createEntrypoint(processInstruction), .{input});\n}\n\nfn processInstruction(\n    program_id: *const sdk.Pubkey,\n    accounts: []sdk.AccountInfo,\n    instruction_data: []const u8,\n) sdk.ProgramResult {\n    sdk.logMsg(\"Hello from Zignocchio!\");\n\n    const account = accounts[0];\n    var data = try account.tryBorrowMutData();\n    defer data.release();\n\n    data.value[0] = 42;\n\n    return .{};\n}\n```\n\n### SDK Features\n\n- **Zero-copy input deserialization** - Direct memory access to Solana's input buffer\n- **RAII borrow tracking** - Safe mutable access with automatic cleanup\n- **Type-safe API** - Strong typing for all Solana primitives\n- **PDAs** - Program Derived Address functions\n- **CPI** - Cross-program invocation support\n- **Efficient** - Bit-packed borrow state, optimized syscalls\n\nSee [`sdk/README.md`](sdk/README.md) for complete documentation and [`examples/`](examples/) for working programs.\n\n## Project Structure\n\n```\n.\n├── build.zig              # Automated build pipeline\n├── build.zig.zon          # Zero dependencies\n├── sdk/                   # Zignocchio SDK\n│   ├── zignocchio.zig     # Main SDK module\n│   ├── types.zig          # Core types (Pubkey, AccountInfo)\n│   ├── entrypoint.zig     # Input deserialization\n│   ├── syscalls.zig       # Auto-generated syscalls\n│   ├── pda.zig            # Program Derived Addresses\n│   ├── cpi.zig            # Cross-program invocation\n│   ├── allocator.zig      # BumpAllocator\n│   ├── log.zig            # Logging utilities\n│   └── errors.zig         # Error types\n├── examples/              # Example programs\n│   ├── hello.zig          # Minimal example (default build target)\n│   ├── counter.zig        # Full-featured example\n│   ├── hello.test.ts      # Tests for hello program\n│   ├── counter.test.ts    # Tests for counter program\n│   └── README.md          # Examples documentation\n└── tools/\n    ├── murmur3.zig        # MurmurHash3-32 implementation\n    ├── syscall_defs.zig   # Syscall definitions\n    └── gen_syscalls.zig   # Syscall generator\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitorpy%2Fzignocchio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitorpy%2Fzignocchio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitorpy%2Fzignocchio/lists"}