All Products
Search
Document Center

Blockchain as a Service:Java SDK Introduction

Last Updated:Jul 20, 2023

The Java SDK of the Ant Blockchain contract platform provides a variety of services, such as account services, contract services, event services, query services, and local services. You can use this SDK to call synchronous or asynchronous operations to send transactions, query transactions, or subscribe to events. This SDK allows you to query receipts after transactions are sent. This way, you can check transaction results.

Release notes

The .jar package of the Java SDK depends on Netty packages, and different Netty packages are configured in the Maven file for different operating systems.

Java SDK release notes

Version

Supported blockchain

Improved feature

How to obtain

0.10.2.6

Supports standard contract blockchains.

Supports all client features of the contract platform.

Download SDK

Netty packages

Note

Netty packages provided in the following table are all included in the Java SDK. You need to download the Java SDK from the management page in the BaaS console.

File

Description

Download link

netty-tcnative-openssl-static-2.0.17-Final-mychain-linux-x86_64.jar

The runtime library on which the SDK depends under Linux operating systems.

Click here to download the dependency of the SDK

netty-tcnative-openssl-static-2.0.17-Final-mychain-windows-x86_64.jar

The runtime library on which the SDK depends under Windows operating systems.

Click here to download the dependency of the SDK

netty-tcnative-openssl-static-2.0.17-Final-mychain-osx-x86_64.jar

The runtime library on which the SDK depends under macOS operating systems.

Click here to download the dependency of the SDK

Runtime environment

  • For Java development kit (JDK) 7 or later, you can run java -version on the system terminal to check the current Java version.

  • For Maven 3.5.4 or later, you can run mvn -v on the system terminal to check the current Maven version.

Import the SDK by using a Maven file

  1. Install the downloaded .jar package in a local repository.

  2. Go to the root directory of the downloaded file from the terminal, and run the following commands:

//Install the SDK in 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
//Install the Netty package in the local repository. Note: Select the required Netty package, and set the classifier to osx-x86_64 for macOS, linux-x86_64 for Linux, or windows-x86_64 for Windows.
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
<dependencies>
    <dependency>
        <groupId>com.alipay.mychainx</groupId>
        <artifactId>mychainx-sdk</artifactId>
        <!--Use the latest SDK -->
        <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>