JAMZIG is a Zig-based implementation of a JAM (Join-Accumulate Machine) node. JAM is a next-generation blockchain protocol designed as a potential successor to the Polkadot Relay Chain, introducing a novel computational model that addresses the size-coherency antagonism in distributed systems.
JamZig account: 14T1UcnoaMND24ubV86FCT4YxJ8q5CKVG7winwZ7umAit8g2
JAM is a decentralized protocol that combines the best of both worlds:
- Global singleton permissionless object environment (like Ethereum's smart contracts)
- Secure sideband computation parallelized over a scalable node network (like Polkadot's approach)
The protocol uses a collect-refine-join-accumulate model that enables massive parallelization while maintaining state coherency. JAM's key innovation is solving the size-coherency antagonism through pipelined computation, separating scalable async work (Refine) from coherent sync work (Accumulate).
src/pvm/- Polka Virtual Machine (RISC-V based VM with gas metering)src/state_*/- State management, encoding/decoding, and merklizationsrc/safrole/- Safrole consensus mechanism for block productionsrc/net/- QUIC-based networking with JAM Simple Networking Protocol (JAMSNP)src/crypto/- Cryptographic primitives (Rust FFI bindings)
src/repl/- Interactive REPL for JAM system interactionsrc/jamtestvectors/- Comprehensive test vectors against reference implementationssrc/pvm_fuzzer.zig- PVM fuzzing tool for testingsrc/jamtestnet_export.zig- Testnet data export utilities
- 17-segment state partitioning for parallel computation (α, β, γ, δ, etc.)
- Service-based architecture replacing traditional account model
- Crypto-economic validation through guaranteeing, assuring, and auditing
- Bandersnatch Ring VRF for validator selection
- Erasure coding for data availability
- Zig 0.14.0
- Rust toolchain (beta channel)
- Cargo for Rust FFI dependencies
JAMZIG includes comprehensive testing infrastructure:
- Unit Tests: Implementation-specific tests (
zig build test) - Test Vectors: Official JAM specification compliance tests (
zig build test-vectors)- Validates against reference test vectors from the JAM community
- Tests both tiny (test) and full (production) parameter sets
- Covers all major components: accumulate, safrole, assurances, etc.
- Includes W3F trace tests for block sequence validation
- JAM Conformance: Community-validated traces for cross-implementation compatibility
- Tests against the
jam-conformance/archive of community-validated block traces - Ensures compatibility across different JAM implementations
- Tests against the
The dedicated test-vectors command provides faster compilation by building only test vector code (~25 files) instead of the entire test suite, making it ideal for continuous compliance checking.
The test runner supports flags passed after --:
--progress: Show colored progress output for each test as it runs--nocapture: Don't capture stderr - shows all debug output during test execution (essential for debugging failures)--exit-on-fail: Exit immediately on first test failure--log-progress: Log detailed test progress totest_progress.logfile (includes timing, pass/fail status, summary stats)
# Build the project
zig build
# Run tests
zig build test
# Run specific test
zig build test -Dtest-filter=<test_name>
# Run tests with progress output
zig build test -Dtest-filter=<test_name> -- --progress
# Run JAM test vectors for specification compliance
zig build test-vectors
# Run only tiny parameter test vectors
zig build test-vectors -Dtest-filter="tiny"
# Run only full parameter test vectors
zig build test-vectors -Dtest-filter="full"
# Run W3F trace tests (block sequence validation)
zig build test-vectors -Dtest-filter="w3f:traces"
# JAM Conformance: View compliance summary
zig build test -Dtest-filter=jam-conformance:summary -- --nocapture
# JAM Conformance: Validate against specific archive
JAM_CONFORMANCE_ARCHIVE=<timestamp> zig build test -Dtest-filter="jam-conformance:archive" -- --nocapture
# Run the node
zig build run
# Run REPL
zig build run
# Run PVM fuzzer
zig build pvm_fuzz && zig build run -- pvm_fuzzFor more information about JAM and JAMZIG, visit: https://jamzig.dev or see the JAM Gray Paper: https://graypaper.com.