Client Libraries
Official Java Client
The Java client library is included in the Shamwari QKP distribution.
Maven Dependency
<dependency>
<groupId>network.shamwari</groupId>
<artifactId>shamwariQKP</artifactId>
<version>1.0.0</version>
</dependency>
Gradle Dependency
implementation 'network.shamwari:shamwariQKP:1.0.0'
Usage Example
import nxt.http.APICall;
import nxt.http.callers.*;
import nxt.http.responses.*;
public class ShamwariClient {
public static void main(String[] args) throws Exception {
// Get account
AccountResponse account = GetAccountCall.create("NXT-address")
.includeLessors(true)
.includeTotems(true)
.call();
System.out.println("Balance: " + account.getBalanceFQT());
// Send transaction
SendMoneyCall send = SendMoneyCall.create(
"your_secret_phrase",
"NXT-recipient",
100000000L // 1 QKP in NQT
);
TransactionResponse tx = send.call();
System.out.println("Transaction ID: " + tx.getTransactionId());
}
}
TypeScript/JavaScript Client
Available as npm package:
npm install @shamwari/crypto-ts
import { ShamwariClient } from '@shamwari/crypto-ts';
const client = new ShamwariClient({
host: 'localhost',
port: 6876
});
// Get blockchain status
const status = await client.getBlockchainStatus();
// Get account
const account = await client.getAccount({
account: 'NXT-address',
includeLessors: true
});
// Send transaction
const tx = await client.sendMoney({
secretPhrase: 'your_secret_phrase',
recipient: 'NXT-recipient',
amountNQT: 100000000
});
Python Client
from shamwari import ShamwariClient
client = ShamwariClient('http://localhost:6876')
# Get status
status = client.get_blockchain_status()
# Get account
account = client.get_account('NXT-address')
# Send transaction
tx = client.send_money(
secret_phrase='your_secret_phrase',
recipient='NXT-recipient',
amount_nqt=100000000
)
Go Client
import "github.com/shamwari-crypto/go-shamwari"
client := shamwari.NewClient("http://localhost:6876")
status, _ := client.GetBlockchainStatus()
account, _ := client.GetAccount("NXT-address")
tx, _ := client.SendMoney(&shamwari.SendMoneyParams{
SecretPhrase: "your_secret_phrase",
Recipient: "NXT-recipient",
AmountNQT: 100000000,
})
API Conventions
All clients follow these conventions:
- Request Types: Map directly to Shamwari API endpoints
- Parameters: Named explicitly (no positional args for complex calls)
- Responses: Typed response objects with helper methods
- Errors: Throw on validation/server errors
- Async: Promise/async-await for network operations
Community Libraries
| Language | Repository | Status |
|---|---|---|
| TypeScript | shamwari-crypto-ts | Stable |
| Python | shamwari-py | Beta |
| Go | go-shamwari | Alpha |
| Rust | shamwari-rs | Experimental |
Contributing a Client
Community client libraries are welcome. Please:
- Open an issue in the main repository
- Follow the API specification exactly
- Include comprehensive tests
- Submit PR with documentation