Installation
Add eth.zig v0.10.0 to a Zig 0.17 project.
Requirements
Zig 0.17.0 (eth.zig's minimum_zig_version). Projects on Zig 0.16 should use eth.zig v0.9.2.
Add the dependency
zig fetch --save "git+https://github.com/StrobeLabs/eth.zig?ref=v0.10.0"This records the dependency as eth_zig in your build.zig.zon. Import its eth module in build.zig:
const eth_dep = b.dependency("eth_zig", .{ .target = target, .optimize = optimize });
exe.root_module.addImport("eth", eth_dep.module("eth"));Then const eth = @import("eth"); in your code. The example on the overview page builds and runs with exactly this setup.
If you also use the PerpCity Zig SDK, it already depends on eth.zig v0.10.0. Pin the same version if you depend on eth.zig directly; two versions in one build fail to link.
For Docker or other generic deployment targets, build with -Dcpu=baseline so the binary does not depend on the build machine's CPU features.
Next steps
- Module reference: ethzig.org/modules
- Examples: ethzig.org/examples