Skip to content
Java wrapper for TON client
Java C++ CMake Other
Branch: master
Clone or download
iamrespawn Update client to commit 7f3a22a
- V3 wallet support
- fix client connection to lite-server, spec 2019/11/15
Latest commit 8962af3 Nov 22, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
build Add builder container Oct 4, 2019
docker Add builder container Oct 4, 2019
project Initial commit Sep 26, 2019
src/main Update client to commit 7f3a22a Nov 22, 2019
.gitignore Add builder container Oct 4, 2019 Add builder container Oct 4, 2019
build.sbt Initial commit Sep 26, 2019
version.sbt Initial commit Sep 26, 2019

TON Client


This is a java wrapper for telegram open network client. Base on original native-lib.cpp.

Supported OS

  • Linux - build on Ubuntu 18.04 LTS and Java 8.

  • MacOS - build on Sierra and Java 8.

Supported features

  • Keys, create, import and export as seed phrase.

  • Accounts, create wallet, send grams, get statuses.

  • Transactions, account transaction history, messages and binary data.

Example docker and http api

You can find docker example and simple http api here.

Build native-lib

You can use docker container to build native-lib from sources.

# run this commands in repo root

# prepare builder container with all needed dependencies
docker build --tag ton-builder -f docker/Dockerfile .

# now run build process
docker run -ti --rm --mount type=bind,source="$(pwd)/build",target=/workdir/build ton-builder

# copy native lib and updated src
cp build/ton/example/android/build/ src/main/resources/nativelib/
cp build/ton/example/android/src/io/broxus/ton/ src/main/java/io/broxus/ton/


import io.broxus.ton.TonClient;
import io.broxus.ton.TonApi;

class ExampleApp {
    private TonClient client = TonClient.create(
    // lite client config
    private final String config = "{ \"liteservers\": [ { \"ip\": 1137658550, \"port\": 4924, \"id\": { \"@type\": \"pub.ed25519\", \"key\": \"peJTw/arlRfssgTuf9BMypJzqOi7SXEqSPSWiEw2U1M=\" } } ], \"validator\": { \"@type\": \"\", \"zero_state\": { \"workchain\": -1, \"shard\": -9223372036854775808, \"seqno\": 0, \"root_hash\": \"VCSXxDHhTALFxReyTZRd8E4Ya3ySOmpOWAS4rBX9XBY=\", \"file_hash\": \"eh9yveSz1qMdJ7mOsO+I+H77jkLr9NpAuEkoJuseXBo=\" } } }";
    // path to directory with state (keystore and last block)
    private final String keystore = ".";
    public static void main(args String[]) {
        // init ton client first
        client.send(new TonApi.Init(
            new TonApi.Options(
                new TonApi.Config(
                    config, // lite client config
                    "", // chain name
                    false, // network callbacks
                    false // cache usage
                new TonApi.KeyStoreTypeDirectory(keystore) // or new TonApi.KeyStoreTypeInMemory() 
        ), new TonClient.ResultHandler() {
            void onResult(TonApi.Object object) {
                // request giver state
                client.send(new TonApi.TestGiverGetAccountState(), new TonClient.ResultHandler() {
                    void onResult(TonApi.Object object) {

                        if(object instanceof TonApi.Error) {
                            TonApi.Error error = (TonApi.Error) object;
                            System.err.println("Get an error on test giver request state " + error.message);
                        } else if (object instanceof TonApi.TestGiverAccountState) {

                            TonApi.TestGiverAccountState giverState = (TonApi.TestGiverAccountState) object;
                            System.out.println("Giver seq " + giverState.seqno);
                            System.out.println("Giver balance " + giverState.balance);

                            // send gram request to giver
                            client.send(new TonApi.TestGiverSendGrams(
                                new TonApi.AccountAddress(
                                    // your account address
                                5L * 1000000000L, // 5 grams
                        } else {
                            // ...
        // ... 
        // at this moment never close client
        // client.close();


Copyright 2019 FINEX FUTURE LTD

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at [](

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.