๐Ÿง  Jot

October 6, 2025 ยท View on GitHub

Maven Central Javadoc

Jot is a clean, modular SDK built from the ground up for developers working with Polkadot and Substrate-based chains.

โšก๏ธ Everything you need to build real Substrate connected apps in Java โ€” no outdated libs, no workarounds.


โœจ Features

โœ… Custom SCALE encoding/decoding
โœ… Runtime metadata parsing (v14+)
โœ… Full transaction construction & signing
โœ… Substrate JSON-RPC (HTTP + WSS)
โœ… SS58 address encoding/decoding
โœ… Cryptographic signing via sr25519 and ed25519
โœ… Fee estimation
โœ… Multisig transactions
โœ… Batched extrinsics
โœ… Persistent wallet file abstraction


๐Ÿ“ฆ Technology Stack

  • Java 21+
  • Maven (multi-module)

๐Ÿ”ง Getting Started

Requires Java 21+ and Maven or Gradle.

(If you want to build Jot from source, see Building Jot from Source.)

Import via Maven

<dependency>
  <groupId>com.method5</groupId>
  <artifactId>jot</artifactId>
  <version>1.0.2</version>
</dependency>

Gradle (Kotlin DSL):

implementation("com.method5:jot:1.0.2")

๐Ÿงฐ Modules

ModuleDescription
jotSCALE codec, metadata, crypto, rpc, signing, extrinsics, etc.
jot-examples50+ ready-to-run usage examples
jot-docsJot SDK API docs

๐Ÿš€ Usage Examples

๐Ÿ›ก๏ธ Create or Load Wallet

// Load wallet from file
Wallet wallet = Wallet.fromFile(new File("wallet.key"));

// or load from mnemonic
wallet = Wallet.fromMnemonic("gesture rather obey video awake marine ...");
System.out.println(wallet.getAddress());

// or create new
wallet = Wallet.generate();
wallet.saveToFile(new File("wallet.key"));
System.out.println(wallet.getAddress());

๐Ÿ’ธ Send a Transfer (Balances.transferKeepAlive)

try (PolkadotRpc api = new PolkadotRpc(new String[] { Config.WSS_SERVER }, 10000)) {
    String to = "15..."; // destination address
    BigInteger amount = BigInteger.valueOf(1); // 1 DOT
    
    Call call = api.tx().balances().transferKeepAlive(to, amount);
    
    String hash = call.signAndSend(wallet.getSigner());
    System.out.println("Extrinsic hash: "+ hash);
}

๐Ÿ› ๏ธ Decode a Signed Extrinsic

String hex = "0x..."; // signed extrinsic hex
DecodedExtrinsic decoded = ExtrinsicDecoder.decode(hex, chain);

System.out.println(decoded);

๐Ÿ“ฅ Subscribe to finalized blocks

// Subscribe to finalized blocks
Subscription<BlockHeader> subscription = api.subscribe().finalizedHeads(
    header -> {
        System.out.println("New finalized head: " + header);
    }
);

// Unsubscribe
subscription.unsubscribe();

โš ๏ธ Note: api must be of type PolkadotWs for subscriptions!

๐Ÿ” Query wallet balance

// Account
AccountId account = AccountId.fromSS58("13UVJyLnbVp9RBZYFwFGyDvVd1y27Tt8tkntv6Q7JVPhFsTB");

// Query balance
AccountInfo accountInfo = api.query().storage().accountInfo(account);

System.out.println("Free balance: " + accountInfo.getFree());
System.out.println("Reserved balance: " + accountInfo.getReserved());
System.out.println("Frozen balance: " + accountInfo.getFrozen());

โฑ๏ธ Submit extrinsic and wait for result

Call call = api.tx().system().remark("test");
        
ExtrinsicResult result = call.signAndWaitForResults(wallet.getSigner());

// Result
System.out.println("Successful: " + result.isSuccess());

// Individual events related to extrinsic
System.out.println("Events: " + Arrays.toString(result.getEvents()));

// Failure reason (if it failed)
if (!result.isSuccess()) {
    System.err.println("Failed because: " + result.getError().toHuman());
}

๐Ÿ‘‰ For full setup instructions, see Quick Start Guide.

๐Ÿ‘‰ API reference: Javadoc.

๐Ÿ‘‰ See jot-examples module for 50+ ready to run examples.


๐Ÿ› ๏ธ Building Jot from Source

If you want to build Jot from source, youโ€™ll need:

  • Java 21+
  • Maven 3.9+
  • Rust 1.81.0+

โš ๏ธ After installing Rust, make sure your environment is configured by sourcing ~/.cargo/env:

source ~/.cargo/env

Building Jot:

# Setup environment
export MAVEN_OPTS="--enable-native-access=ALL-UNNAMED"

# Compile Jot
mvn clean package

๐Ÿ“„ License

This project is licensed under the Apache License 2.0.


Built with โค๏ธ to bring Polkadot to the Java ecosystem.