Official Java SDK for Bytom
Clone or download
wyjDoraemon Merge pull request #4 from Bytom/retireTx
add retire transaction arbitrary
Latest commit 6b70893 Jan 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc delete control_account in file Jun 7, 2018
src add retire setArbitrary Jan 4, 2019
.gitignore add listById() method and listByAccountId() method May 29, 2018 add retire transaction arbitrary Jan 5, 2019
pom.xml add retire transaction arbitrary Jan 5, 2019

Bytom java-sdk

This page will document the API classes and ways to properly use the API. Subsequent new releases also maintain backward compatibility with this class approach. For more information, please see Bytom API reference documentation at Bytom wiki


There are various ways to install and use this sdk. We'll provide three ways to get it. Note that the bytom-sdk requires JAVA 7 or newer.

Apache Maven



compile 'io.bytom:bytom-sdk:1.0.1'

Building from source code

To clone, compile, and install in your local maven repository (or copy the artifacts from the target/ directory to wherever you need them):

git clone
cd java-sdk
mvn package -Dmaven.test.skip=true
mvn install

Basic Usage

public static Client generateClient() throws BytomException {
    String coreURL = Configuration.getValue("bytom.api.url");
    String accessToken = Configuration.getValue("client.access.token");
    if (coreURL == null || coreURL.isEmpty()) {
        coreURL = "";
    return new Client(coreURL, accessToken);

Client client = Client.generateClient();

Note: you can touch a file named in resources folder to config bytom.api.url and client.access.token by custom.


For more details, see API methods

Create a key

String alias = "test";
String password = "123456";

Key.Builder builder = new Key.Builder().setAlias(alias).setPassword(password);
Key key = Key.create(client, builder);

Create an account

String alias = "sender-account";
Integer quorum = 1;
List<String> root_xpubs = new ArrayList<String>();

Account.Builder builder = new Account.Builder().setAlias(alias).setQuorum(quorum).setRootXpub(root_xpubs);

Account account = Account.create(client, builder);

Create an receiver

String alias = receiverAccount.alias;
String id =;

Account.ReceiverBuilder receiverBuilder = new Account.ReceiverBuilder().setAccountAlias(alias).setAccountId(id);
Receiver receiver = receiverBuilder.create(client);

Create an asset

 String alias = "receiver-asset";

List<String> xpubs = receiverAccount.xpubs;

Asset.Builder builder = new Asset.Builder()
receiverAsset = builder.create(client);

Issue asset

For more transaction details, see transactions

Firstly build the transaction

Transaction.Template controlAddress = new Transaction.Builder()
                new Transaction.Action.SpendFromAccount()
                new Transaction.Action.ControlWithAddress()

Secondly sign the transaction

Transaction.Template singer = new Transaction.SignerBuilder().sign(client,
        controlAddress, "123456");

Finally submit the transaction

Transaction.SubmitResponse txs = Transaction.submit(client, singer);

All usage examples

For more details you can see doc. And you can find Test Cases at Junit Test Cases

Support and Feedback

If you find a bug, please submit the issue in Github directly by using Issues


Bytom JAVA SDK is based on the Apache License, Version 2.0 protocol.