Skip to content
No description, website, or topics provided.
Go C
Branch: master
Clone or download
webresult Merge pull request #38 from mercuryoio/revert-37-revert-32-develop
Revert "Revert "Develop: new ton updates""
Latest commit dd84efc Feb 19, 2020

TONLIB Golang library

Go Report Card GoDoc

TONLIB Golang library for accessing Telegram Open Network with liteclient protocol, which is based itself on tdlib library. Warning: this repository is under active development, not ready for production use


$ go get -u


import ""

Supported methods

  • createNewKey
  • deleteKey
  • exportKey
  • exportPemKey
  • exportEncryptedKey
  • importKey
  • importPemKey
  • importEncryptedKey
  • changeLocalPassword
  • unpackAccountAddress
  • packAccountAddress
  • wallet.init
  • wallet.getAccountAddress
  • [-] wallet.getAccountState
  • [-] wallet.sendGrams
  • raw.sendMessage
  • raw.getTransactions
  • raw.getAccountState
  • generic.sendGrams
  • getLogStream
  • sync
  • CreateAndSendMessage
  • generic.createSendGramsQuery
  • query.send
  • query.forge
  • query.estimateFees
  • query.getInfo
  • smc.load
  • smc.getCode
  • smc.getData
  • smc.getState
  • smc.runGetMethod


Create new client

    options, err := tonlib.ParseConfigFile("path/to/config.json")
    if err != nil {

    // make req
    req := tonlib.TonInitRequest{

    tonClient, err = tonlib.NewClient(
    	&req, // init request
    	tonlib.Config{}, // config
    	10, // timeout in seconds for each (currently only QueryEstimateFees) tonlib.Client`s public method
    if err != nil {
    defer cln.Destroy()

Create new private key

    // prepare data
    loc := SecureBytes("loc_pass")
    mem := SecureBytes("mem_pass")
    seed := SecureBytes("")

    // create new key
    pKey, err := cln.CreateNewKey(&loc, &mem, &seed)
    if err != nil {

Get wallet address

    addrr, err := cln.WalletGetAccountAddress(tonlib.NewWalletInitialAccountState("YourPublicKey"))
    if err != nil {


To install sample cli application:

$ go get -u

To run sample cli app your have to set LD_LIBRARY_PATH:

For linux export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path2repository>/lib/linux

For MacOS export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path2repository>/lib/darwin

Code generation from new *.tl files released by TON team

If you need to update structures and add new methods based on a fresh release of TON`s client you can do it by using code generation command. In order to perform such operation - run the command bellow and provide path of *.tl file to the running command as in the example bellow.

$ go run /path/to/repos/ton/tl/generate/scheme/



PRs are welcome!

You can’t perform that action at this time.