All Products
Search
Document Center

Java SDK Introduction

Last Updated: Jan 10, 2020

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. See download instructions.

Download instructions

  • If you are using the test blockchain, download the SDK from the overview page in the BaaS console.sdk

  • In other cases, download the SDK from the management page in the BaaS console.121

Netty packages

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:
  1. //Install the SDK in the local repository.
  2. 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 -DpomFile=pom.xml
  3. //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.
  4. 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
  1. <dependencies>
  2. <dependency>
  3. <groupId>com.alipay.mychainx</groupId>
  4. <artifactId>mychainx-sdk</artifactId>
  5. <!--Use the latest SDK -->
  6. <version>0.10.2.6</version>
  7. </dependency>
  8. </dependencies>
  9. <build>
  10. <extensions>
  11. <extension>
  12. <groupId>kr.motd.maven</groupId>
  13. <artifactId>os-maven-plugin</artifactId>
  14. <version>1.6.1</version>
  15. </extension>
  16. </extensions>
  17. </build>