๐ง Jot
October 6, 2025 ยท View on GitHub
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
| Module | Description |
|---|---|
| jot | SCALE codec, metadata, crypto, rpc, signing, extrinsics, etc. |
| jot-examples | 50+ ready-to-run usage examples |
| jot-docs | Jot 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.