A Java implementation of the JAM (Join-Accumulate Machine) blockchain protocol for the JAM Prize Competition.
Third-Party Libraries Used (Allowed per Rule 1):
- SCALE Codec (
io.jam.scale) - For SCALE serialization (vendored from PolkaJ)- Note: Vendored (copied) into
src/main/java/io/jam/scale/because not published to Maven Central - Source: https://github.com/emeraldpay/polkaj (Apache 2.0 License)
- See
src/main/java/io/emeraldpay/NOTICE.txtfor full attribution
- Note: Vendored (copied) into
- Standard Testing (JUnit 5, AssertJ) - For unit testing
- Standard Logging (SLF4J, Logback) - For logging
All JAM-specific business logic is implemented from scratch per competition rules.
Milestone 1 (M1 - IMPORTER) - In Progress
- ✅ Phase 1: Foundation (Project structure, data structures)
- 🚧 Phase 2: Serialization (SCALE codec)
- ⏳ Phase 3: Cryptography (Ed25519, Blake2b, Bandersnatch)
- Java 17 or higher (Java 21 recommended)
- Maven 3.8+
# Build the project
mvn clean install
# Run tests
mvn test
# Run specific test
mvn test -Dtest=CodecRoundTripTest
# Run with verbose output
mvn test -X
# Package as JAR
mvn package# Clean and compile the project
mvn clean compile
# Just compile (faster if you haven't cleaned)
mvn compile# Run linting
mvn spotless:check# Run formatting
mvn spotless:applyThe test suite includes various test categories, including heavy conformance tests that require significant memory. You can control which tests run using Maven profiles or command-line options.
# Run all tests (default, requires 4GB heap)
mvn test
# Run only conformance tests
mvn test -Pconformance-only
# Run fast tests (excludes heavy AllTraceConformanceTest, requires 2GB heap)
mvn test -Pfast
# Run all tests except conformance tests (requires 2GB heap)
mvn test -Pno-conformance
# Run all tests including heavy conformance tests
mvn test -Pall# Run only conformance tests (using includes)
mvn test -Dtest.includes="**/conformance/**/*Test.java"
# Exclude specific test class from command line
mvn test -Dtest.excludes="**/AllTraceConformanceTest.java"
# Exclude multiple test classes (comma-separated)
mvn test -Dtest.excludes="**/AllTraceConformanceTest.java,**/SafroleTransitionRealVrfTest.java"
# Exclude entire package
mvn test -Dtest.excludes="**/conformance/**/*Test.java"# Run a specific test class
mvn test -Dtest=HashTest
# Run multiple specific test classes
mvn test -Dtest=HashTest,BlockTest
# Run tests matching a pattern
mvn test -Dtest="**/storage/*Test"- Default: All tests run with 4GB heap (
-Xmx4g) - Fast profile: Excludes
AllTraceConformanceTest(1000+ test cases), uses 2GB heap - No-conformance profile: Excludes all conformance tests, uses 2GB heap
The heavy AllTraceConformanceTest processes 1000+ trace test vectors and requires significant memory. Use the fast profile for quicker test runs during development.
# Install Java 21 and Maven (Windows with Chocolatey)
choco install openjdk21 maven -y
# Build and test
cd jam
mvn clean testjam/
├── src/main/java/io/jam/
│ ├── core/
│ │ ├── types/ # Primitive types (Hash, BlockNumber, etc.)
│ │ ├── block/ # Block structures (Header, Block, Extrinsic)
│ │ ├── state/ # State structures (ServiceAccount, ValidatorState)
│ │ └── codec/ # SCALE codec implementations
│ └── Main.java # Entry point
└── src/test/java/io/jam/
└── core/ # Unit tests
This implementation follows the JAM specification (Graypaper v0.7.2):
- Immutable Data Structures: Using Java records for safety
- SCALE Codec: Polkadot-compatible serialization
- Clean Separation: Core types, serialization, and business logic decoupled
MIT License - See LICENSE file