Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug Report
about: Report a bug in eth.zig
title: ''
labels: bug
assignees: ''
---

**Describe the bug**
A clear and concise description of what the bug is.

**To reproduce**
Steps to reproduce the behavior:
1. Code snippet or minimal reproduction
2. Expected output vs actual output

**Expected behavior**
What you expected to happen.

**Environment**
- Zig version: [e.g. 0.15.2]
- OS: [e.g. Ubuntu 24.04, macOS 15]
- eth.zig version: [e.g. 0.1.0]

**Additional context**
Any other context, stack traces, or error messages.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature Request
about: Suggest a new feature for eth.zig
title: ''
labels: enhancement
assignees: ''
---

**What problem does this solve?**
A clear description of the use case or pain point.

**Proposed solution**
How you think this could be implemented.

**Alternatives considered**
Any alternative solutions or workarounds you've considered.

**Additional context**
Any other context, references to EIPs, or examples from other libraries.
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Changelog

All notable changes to eth.zig will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - 2026-02-26

Initial release of eth.zig -- a feature-complete, pure Zig Ethereum client library.

### Added

**Primitives**
- `Address` (20 bytes), `Hash` (32 bytes), `Bytes32` types with hex conversions
- EIP-55 checksummed address formatting
- `u256` helpers: `fromBigEndianBytes`, `toBigEndianBytes`, `fromHex`, `toHex`
- Hex encode/decode utilities

**Encoding**
- RLP encoding/decoding per Ethereum Yellow Paper (structs, tuples, slices, integers)
- ABI encoding: all Solidity types (uint8..uint256, address, bool, bytes, string, arrays, tuples)
- ABI decoding: typed decoding of return values and event data
- Comptime ABI: compile-time function selector and event topic computation
- JSON ABI parser: parse Solidity JSON ABI files into eth.zig types

**Crypto**
- Keccak-256 hashing (wraps `std.crypto.hash.sha3.Keccak256`)
- secp256k1 ECDSA signing with recovery ID (RFC 6979, EIP-2 low-S)
- Signature types with compact format support
- EIP-155 replay protection

**Transaction Types**
- Legacy, EIP-2930, EIP-1559, EIP-4844 transaction types
- Transaction serialization (unsigned and signed)
- Receipt, block header, log, and access list types
- EIP-4844 blob types and sidecar construction helpers

**Accounts**
- BIP-39 mnemonic generation and validation (2048-word English wordlist)
- BIP-32/44 HD wallet key derivation
- Private key signing: messages (EIP-191) and transactions

**Transport**
- HTTP JSON-RPC transport (`std.http.Client`)
- WebSocket JSON-RPC transport with TLS support
- Subscription management (newHeads, logs, newPendingTransactions)
- JSON-RPC 2.0 request/response types with batch support

**Client**
- Provider: 24+ read-only RPC methods (getBalance, getBlock, call, estimateGas, getLogs, etc.)
- Wallet: signing client with sendTransaction, waitForReceipt, auto nonce/gas
- Contract: high-level read/write helpers with ABI encoding
- Multicall3: batched contract calls in a single RPC round-trip
- Event log decoding and filtering

**Standards**
- EIP-712 typed structured data hashing and signing
- ENS resolution: forward (name -> address), reverse (address -> name), namehash
- ERC-20 and ERC-721 contract interaction helpers

**Chains**
- Chain definitions: Ethereum, Arbitrum, Optimism, Base, Polygon (mainnet + testnets)
- Includes Multicall3 addresses, ENS registries, block explorer URLs

**Utilities**
- Wei/Gwei/Ether unit conversions
- Common constants (zero address, max uint256, etc.)
93 changes: 93 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Contributing to eth.zig

Thanks for your interest in contributing to eth.zig! This document covers everything you need to get started.

## Prerequisites

- [Zig >= 0.15.2](https://ziglang.org/download/)
- Git

## Getting Started

```bash
git clone https://github.com/StrobeLabs/eth.zig.git
cd eth.zig

# Build
zig build

# Run tests
zig build test

# Check formatting
zig fmt --check src/ tests/

# Format code
zig fmt src/ tests/
```

## Architecture

eth.zig uses a layered architecture where each layer only depends on layers below it. This makes every layer independently testable.

```
Layer 1: Primitives (zero deps, no allocator needed)
primitives.zig, uint256.zig, hex.zig

Layer 2: Encoding (-> primitives)
rlp.zig, abi_encode.zig, abi_decode.zig, abi_types.zig, abi_comptime.zig

Layer 3: Crypto (-> primitives)
keccak.zig, secp256k1.zig, signature.zig

Layer 4: Types (-> primitives, encoding, crypto)
transaction.zig, receipt.zig, block.zig, log.zig, access_list.zig, blob.zig

Layer 5: Signer (-> crypto, types)
signer.zig, eip155.zig, hd_wallet.zig, mnemonic.zig

Layer 6: Transport (-> types)
http_transport.zig, ws_transport.zig, json_rpc.zig, subscription.zig

Layer 7: Client (-> transport, types, encoding)
provider.zig, wallet.zig

Layer 8: Contract (-> client, encoding, signer)
contract.zig, event.zig, multicall.zig

Layer 9: Standards (-> client, contract, crypto)
eip712.zig, ens/

Layer 10: Chains (pure data, zero deps)
chains/
```

Layers 1-3 have zero I/O. Layers 1-5 have zero network dependencies.

## Pull Requests

1. Fork the repo and create a branch from `main`
2. Write your code -- follow existing patterns in the codebase
3. Add tests for new functionality
4. Run `zig fmt src/ tests/` to format your code
5. Run `zig build test` to make sure all tests pass
6. Open a PR against `main`

## Code Style

- Follow `zig fmt` formatting (enforced by CI)
- Use descriptive variable names
- Keep functions focused and small
- Add doc comments (`///`) to public functions
- Prefer comptime over runtime where possible -- this is a core design principle
- No external dependencies -- everything builds on Zig's standard library

## Reporting Issues

- Use the bug report template for bugs
- Use the feature request template for new features
- Include Zig version, OS, and steps to reproduce

## License

By contributing, you agree that your contributions will be licensed under the MIT License.
Loading