All Products
Search
Document Center

Java SDK Introduction

Last Updated: May 28, 2019

The Java SDK of the smart contract platform of Ant Blockchain provides multiple services, including account services, contract services, event services, query services, and local services. With this SDK, you can call synchronous or asynchronous operations to send transactions, query transactions, or subscribe to events. For synchronous or asynchronous transactions, the SDK enables you to query receipts after the transaction is sent. This allows you to check the transaction results with ease.

Release note

Java SDK’s jar packages depend on Netty, and different operating systems need to select different Netty dependency packages to configure in Maven files.

Java SDK release notes

Version Supported blockchains Updated features Download instructions
0.10.2.4.2 1. Standard smart contract blockchains.
2. CHINA SM-based contract blockchains.
All client features of the smart contract platform. See download instructions.

Download instructions

  • If you are using the test chain, you can download sdk from BaaS console overview page.downloadsdk

  • In other cases, you can go to the blockchain management page to download the sdk.download

Netty Dependency packages

File name Usage Description
netty-tcnative-openssl-static-2.0.17-Final-mychain-linux-x86_64.jar Runtime libraries on which SDK depends under Linux operating system. SDK Dependency packages.
netty-tcnative-openssl-static-2.0.17-Final-mychain-windows-x86_64.jar Runtime libraries on which SDK depends under Windows operating system. SDK Dependency packages.
netty-tcnative-openssl-static-2.0.17-Final-mychain-osx-x86_64.jar Runtime libraries on which SDK depends under MacOS operating system. SDK Dependency packages.

Runtime environment

  • Java development kit (JDK) 7 or later. You can run java -version on the system terminal to check current Java version.
  • Maven 3.5.4 or later. You can run mvn -v on the system terminal to check current Maven version.

Introduce the SDK to Maven files

  1. Install the downloaded .jar package to 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 to the local repository
  2. mvn install:install-file -Dfile=mychainx-sdk-0.10.2.4.2.jar -DgroupId=com.alipay.mychainx -DartifactId=mychainx-sdk -Dversion=0.10.2.4.2 -Dpackaging=jar -DpomFile=pom.xml
  3. //Install the Netty dependency to the local repository
  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. <!--Please use the latest SDK -->
  6. <version>0.10.2.4.2</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>