All Products
Search
Document Center

Blockchain as a Service:Blockchain as a Service:Java SDK Introduction

Last Updated:Mar 31, 2026

The Java SDK for the Ant Blockchain contract platform lets you submit transactions, query transaction receipts, and subscribe to events on a standard contract blockchain. The SDK covers five service areas: account, contract, event, query, and local services. The SDK supports both synchronous and asynchronous call patterns.

Prerequisites

Before you begin, make sure you have:

  • Java Development Kit (JDK) 7 or later — run java -version to check

  • Maven 3.5.4 or later — run mvn -v to check

Release notes

Java SDK versions

VersionSupported blockchainWhat's includedDownload
0.10.2.6Standard contract blockchainsAll client features of the contract platformDownload SDK

OS-specific Netty packages

The SDK's .jar package depends on a Netty native library. Because Netty ships platform-specific binaries, you need to download the correct package for your operating system. All three packages are bundled with the Java SDK download from the BaaS console management page.

Note: Download the Java SDK from the management page in the BaaS console. The Netty packages listed below are included in that download.
FileOSDownload
netty-tcnative-openssl-static-2.0.17-Final-mychain-linux-x86_64.jarLinuxDownload
netty-tcnative-openssl-static-2.0.17-Final-mychain-windows-x86_64.jarWindowsDownload
netty-tcnative-openssl-static-2.0.17-Final-mychain-osx-x86_64.jarmacOSDownload

Install the SDK with Maven

Because the SDK is not published to Maven Central, install it into your local repository before declaring it as a dependency.

  1. In your terminal, go to the root directory of the downloaded SDK files.

  2. Install the SDK .jar into the local repository:

    mvn install:install-file \
      -Dfile=mychainx-sdk-0.10.2.6.jar \
      -DgroupId=com.alipay.mychainx \
      -DartifactId=mychainx-sdk \
      -Dversion=0.10.2.6 \
      -Dpackaging=jar
  3. Install the Netty package for your operating system. Set the -Dclassifier value to match your OS:

    OSClassifier value
    macOSosx-x86_64
    Linuxlinux-x86_64
    Windowswindows-x86_64

    The following example installs the macOS package:

    mvn install:install-file \
      -Dfile=netty-tcnative-openssl-static-2.0.17-Final-mychain-osx-x86_64.jar \
      -DgroupId=io.netty \
      -DartifactId=netty-tcnative-openssl-static \
      -Dversion=2.0.17-Final-mychain \
      -Dpackaging=jar \
      -Dclassifier=osx-x86_64
  4. Add the SDK dependency and the os-maven-plugin build extension to your pom.xml. The plugin detects the current OS at build time and selects the correct Netty classifier automatically:

    <dependencies>
        <dependency>
            <groupId>com.alipay.mychainx</groupId>
            <artifactId>mychainx-sdk</artifactId>
            <version>0.10.2.6</version>
        </dependency>
    </dependencies>
    
    <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>1.6.1</version>
            </extension>
        </extensions>
    </build>