TonCenter.com API

Your bridge to Telegram Open Network
Contact me

Methods

last

‘last’ returns last tip of masterchain (-1 chain)
No params.
Example request:

curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "id": 1, "method": "last", "params": []}' \
https://toncenter.com/api/test/v1

Example response:

{
  "jsonrpc": "2.0",
  "result": {
    "height": 611793,
    "chain_id": -1,
    "root_hash": "76A0D56557DD0A7C4130BE4C65488E4A22142E4F33DD0D56468132FCDECA650A",
    "file_hash": "111E3B5075AF5F218DC6A4090A7BA6D214EEE2918FE2472181D96889461E3716",
    "prefix": "8000000000000000",
    "full_id": "(-1,8000000000000000,611793):76A0D56557DD0A7C4130BE4C65488E4A22142E4F33DD0D56468132FCDECA650A:111E3B5075AF5F218DC6A4090A7BA6D214EEE2918FE2472181D96889461E3716"
  },
  "id": 1
}

time

‘time’ returns server time
No params.
Example request:

curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "id": 1, "method": "time", "params": []}' \
https://toncenter.com/api/test/v1

Example response:

{
  "jsonrpc": "2.0",
  "result": "2019-07-10 08:06:28",
  "id": 1
}

getblock

‘getblock’ returns information about block. By default ‘getblock’ tries to find block in database of already downloaded blocks, if it fails and full id is provided it tries to download block directly. Information is returned in json format obtained by parsing of lite client output. Important: json scheme in block representation may change over time.
Parameters:

Example request:

curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "id": 1, "method": "getblock", "params": ["-1,8000000000000000,30"]}' \
https://toncenter.com/api/test/v1

Example response:
It contains block, vm and header sections
Tip header's content most likely will not change over time and has enough information to navigate through blockchain.

{
  "jsonrpc": "2.0",
  "result": {
    "block": { ... },
    "vm": "..."
    "header": { ... },
  }
  "id": 1
}

shardsinfo

‘shardsinfo’ returns information about shard tips: height and generation time. Shards are named by chain_id:prefix scheme, for instance -1:8000000000000000 or 0:6000000000000000.
No params.
Example request:

curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "id": 1, "method": "shardsinfo", "params": []}' \
https://toncenter.com/api/test/v1

Example response:

{
  "jsonrpc": "2.0",
  "result": {
    "-1:8000000000000000": {
      "height": 613202,
      "gen_time": 1562748343
    },
    "0:2000000000000000": {
      "height": 613319,
      "gen_time": 1562724926
    },
    "0:6000000000000000": {
      "height": 613295,
      "gen_time": 1562724632
    },
    "0:a000000000000000": {
      "height": 613346,
      "gen_time": 1562724687
    },
    "0:e000000000000000": {
      "height": 613300,
      "gen_time": 1562724147
    }
  },
  "id": 1
}

getaccount

‘getaccount’ returns information about account. Information is returned in json format obtained by parsing of lite client output. Important: json scheme in account representation may change over time.
Tip: response also contains meta section, it contains easy to use important data about account. It is expected that meta scheme will be updated in addition only manner. Currently it has information about contract_type, contract_state, balance and seq_no.

raw_account contains raw data obtained from lite client.
Params:

curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "id": 1, "method": "getaccount", "params": ["-1:8156775b79325e5d62e742d9b96c30b6515a5cd2f1f64c5da4b193c03f070e0d"]}' \
https://toncenter.com/api/test/v1

Example response:

{
  "jsonrpc": "2.0",
  "result": {
    "success": true,
    "raw_account": {
      "account": " ... ",
      "vm": " ... ",
      "last_transaction_logical_time": 675938000001,
      "last_transaction_hash": "E47AD0AB72F7EBDBD7CAC2CFAC812110321D388E7745CF721B9A3809659F9686"
    },
    "account": { ... },
    "meta": {
      "balance": 988270.543,
      "seq_no": 1232,
      "contract_type": "test giver",
      "contract_state": "active account"
    }
  },
  "id": 1
}

getaccountforms

‘getaccountforms’ gets account in any form and returns representation in all forms. It also contains information about input account form: it’s type and is it test-only or not.
Forms:

Params:

Example request:

curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "id": 1, "method": "getaccountforms", "params": ["-1:8156775b79325e5d62e742d9b96c30b6515a5cd2f1f64c5da4b193c03f070e0d"]}' \
https://toncenter.com/api/test/v1

Example response:

{
  "jsonrpc": "2.0",
  "result": {
    "raw_form": "-1:8156775b79325e5d62e742d9b96c30b6515a5cd2f1f64c5da4b193c03f070e0d",
    "bounceable": {
      "b64": "Ef+BVndbeTJeXWLnQtm5bDC2UVpc0vH2TF2ksZPAPwcODSkb",
      "b64url": "Ef-BVndbeTJeXWLnQtm5bDC2UVpc0vH2TF2ksZPAPwcODSkb"
    },
    "non-bounceable": {
      "b64": "Uf+BVndbeTJeXWLnQtm5bDC2UVpc0vH2TF2ksZPAPwcODXTe",
      "b64url": "Uf-BVndbeTJeXWLnQtm5bDC2UVpc0vH2TF2ksZPAPwcODXTe"
    },
    "given_type": "raw_form",
    "test_only": false
  },
  "id": 1
}

sendboc

‘sendboc’ sends bag-of-cells
Params:

curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "id": 1, "method": "sendboc", "params": ["te6cckEEAgEAAAAAZgABT4n/AqzutvJkvLrFzoWzcthhbKK0uaXj7Ji7SWMngH4OHBoAAAAmoAwBAHJiAECrO628mS8usXOhbNy2GFsorS5pePsmLtJYy+Afg4cGqBKgXyAAAAAAAAAAAAAAAAAAAEdJRlQlXaGY"]}' \
https://toncenter.com/api/test/v1

Example response:

{"jsonrpc": "2.0", "result": {"result": "Ok"}, "id": 1}