A high-performance implementation of the JAM (Join-Accumulate Machine) protocol in Go with Rust cryptographic primitives.
# Build
./build.sh
# Run the server
./bin/jamzilla-tiny
# In another terminal, run conformance tests
cd src/go
go test ./cmd/fuzzer/fuzzclient -run TestConformanceVectors -v-
Go (1.21 or later)
brew install go
-
Rust (latest stable)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Go (1.21 or later)
- Rust (latest stable)
- GCC (for CGO compilation)
sudo apt-get install build-essential
./build.shThis will build bin/jamzilla-tiny for your current platform.
cd src/go/cmd/fuzzer/fuzzserver
go build -o jamzilla./bin/jamzilla-tinyDefault socket: /tmp/jam_target.sock
./bin/jamzilla-tiny --socket /path/to/custom.sock./bin/jamzilla-tiny --helpThe jamzilla server communicates via Unix socket using a binary protocol. Messages are framed with a 4-byte little-endian length prefix followed by the message payload.
Example using the fuzzclient:
# Start the server in one terminal
./bin/jamzilla-tiny
# In another terminal, run conformance tests
cd src/go
go test ./cmd/fuzzer/fuzzclient -run TestConformanceVectors -vThe fuzzclient can send various message types to test the server:
- PeerInfo: Handshake and version negotiation
- SetState: Initialize blockchain state
- ImportBlock: Process and validate blocks
- GetState: Retrieve current state
See src/go/cmd/fuzzer/fuzzclient/main.go for protocol details and message formats.
jam/
├── bin/ # Compiled binaries (gitignored)
├── src/
│ ├── bandersnatch_ffi/ # Rust cryptographic library
│ └── go/
│ ├── cmd/
│ │ └── fuzzer/
│ │ ├── fuzzserver/ # Main jamzilla server
│ │ └── fuzzclient/ # Test client
│ └── pkg/ # Core JAM implementation
├── jam-conformance/ # Conformance test vectors (submodule)
├── build.sh # Cross-platform build script
└── README.md # This file
The project includes VS Code launch configurations for debugging:
- JAM Fuzzserver: Debug the main server
- TestFuzzerVersion: Run version compatibility tests
- TestStateTransitions: Run state transition conformance tests
CPU profiling is available via the fuzzer interface. Profiles are written to cpu.prof and can be analyzed with:
go tool pprof -http=:8080 cpu.profThe build system supports two network configurations:
- tiny: Minimal validator set for testing (default)
- full: Full production validator set (commented out in build.sh)
To switch configurations, edit build.sh and uncomment the desired variant.
- Language: Go with Rust FFI for cryptographic operations
- Database: Pebble (LevelDB-compatible key-value store)
- Networking: QUIC-based protocol (JAMNP-S)
- VM: Custom PVM (Polkadot Virtual Machine) implementation
See LICENSE file for details.