Java SDK for OKTC: A Comprehensive Developer Guide

·

Introduction to OKTC Java SDK

The Java SDK for OKTC provides developers with tools to interact with the OKTC blockchain efficiently. This guide covers key functionalities, from cryptographic operations to transaction messaging.

Package Utils

Class Utils

Complement 18-bit Accuracy

Ensures numeric precision for blockchain calculations by maintaining 18 decimal places.

Convert BigInteger to Bytes

Facilitates data formatting by converting BigInteger values into byte arrays.

Package Crypto

Class AddressUtil

Generate Bech32 Address from Pubkey

Converts public keys into human-readable Bech32 addresses.

Convert Pubkey to Bech32 Pubkey

Transforms standard public keys into Bech32-encoded versions.

Address Conversion Utilities

Class Crypto

Key Management

Validator Operations

Generates Bech32 validator operator addresses from hex-encoded public keys.

Class PrivateKey

new PrivateKey(String mnemonicOrHexKey) // Accepts mnemonics or hex private keys

Package Msg

Transaction Messaging Framework

Defines OKTC module-specific message types with practical examples.

Transfer Token Example

  1. Environment Setup
    Configure network parameters and credentials.
  2. Token Transfer
    Implement cross-account transactions using MsgSend class.

FAQ Section

Q: How do I generate a new wallet?

A: Use Crypto.generatePrivateKey() for random key generation or PrivateKey constructor with a mnemonic phrase.

Q: What address formats does OKTC support?

A: The SDK handles both hex-encoded addresses and Bech32 formats with conversion utilities.

Q: Where can I find implementation examples?

A: Refer to main functions in message classes like 👉 MsgSend implementation for practical samples.

Q: How are validator addresses different?

A: Validator operator addresses use specialized Bech32 prefixes generated from public keys.

Integration Tips

For advanced implementations, explore our 👉 GitHub repository containing the complete SDK source code and additional samples.