Transactions

APIs to obtain transaction related details

Transaction type

Value

Type

Description

208

int

deploy smart contract

209

int

invoke neovm smart contract

210

int

invoke wasmvm smart contract

Description

Value

Type

Description

transfer

String

transfer

gasconsume

String

consumed gas

ontId-

String

Ont ID

claimRecord-

String

claim Record

auth

String

authorization

{"NeedStorage":true, ...}

String

If the transaction type is 208, the filed content is the description of the contract

Event Type

Value

Type

Description

0

int

others

1

int

deploy contract

2

int

gas consumed

3

int

transfer

4

int

ONT ID

5

int

claim record

6

int

authorization

1. Get latest transaction list

url: /v2/latest-transactions?count=10, 
method: GET, 
params: {
}, 
successResponse: {
    "code":0, 
    "msg":"SUCCESS", 
    "result":[
        {
            "tx_hash":"9762458cd30612509f7c...a010ccc7b347057eb5", 
            "tx_type":209, 
            "tx_time":1522210288, 
            "block_height":1212, 
            "confirm_flag":1, 
            "block_index":1, 
            "fee":"0.01"
        }
    ]
}

Url RequestField

Type

Description

count

int

number of latest transactions (count is limited between 1 and 50)

ResponseField

Type

Description

tx_hash

String

transaction hash

tx_type

int

transaction type (208/209/210)

tx_time

int

UNIX time of the transaction

block_height

int

block height

confirm_flag

int

transaction state on the blockchain, 0:failure 1:success

block_index

int

The index of transactions within a block

fee

String

fee

2. Get transaction list by page

url:/v2/transactions?page_size=10&page_number=1, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
        "records":[
            {
                "tx_hash":"9762458cd30612509f7c...a010ccc7b347057eb5", 
                "tx_type":209, 
                "tx_time":1522210288, 
                "block_height":1212, 
                "confirm_flag":1, 
                "block_index":1, 
                "fee":"0.01"
            }
        ], 
        "total":23449
    }
}

Url RequestField

Type

Description

page_size

int

number of records in one page (limited between 1 and 20)

page_number

int

page number (atleast 1 or greater)

ResponseField

Type

Description

total

int

total transactions

tx_hash

String

transaction hash

tx_type

int

transaction type (208/209/210)

tx_time

int

UNIX time of the transaction

block_height

int

block height

confirm_flag

int

transaction state on the blockchain, 0:failure 1:success

block_index

int

The index of transactions within a block

fee

String

transaction fee

3. Get latest non-ontid transaction list

url: /v2/latest-nonontid-transactions?count=10, 
method: GET, 
params: {
}, 
successResponse: {
    "code":0, 
    "msg":"SUCCESS", 
    "result":[
        {
            "tx_hash":"9762458cd30612509f7c...a010ccc7b347057eb5", 
            "tx_type":209, 
            "tx_time":1522210288, 
            "block_height":1212, 
            "confirm_flag":1, 
            "block_index":1, 
            "fee":"0.01"
        }
    ]
}

Url RequestField

Type

Description

count

int

number of latest non-ontid transactions (limited between 1 and 50)

ResponseField

Type

Description

tx_hash

String

transaction hash

tx_type

int

transaction type (209/210)

tx_time

int

UNIX time of the transaction

block_height

int

block height

confirm_flag

int

transaction state on the blockchain, 0:failure 1:success

block_index

int

The index of transactions within a block

fee

String

transaction fee

4. Get non-ontid transaction list by page

url:/v2/nonontid-transactions?page_size=1&page_number=10, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
        "records":[
            {
                "tx_hash":"9762458cd30612509f7c...a010ccc7b347057eb5", 
                "tx_type":209, 
                "tx_time":1522210288, 
                "block_height":1212, 
                "confirm_flag":1, 
                "block_index":1, 
                "fee":"0.01"
            }
        ], 
        "total":23449
    }
}

Url RequestField

Type

Description

page_size

int

number of records in one page (limited between 1 and 20)

page_number

int

page number (atleast 1 or greater)

ResponseField

Type

Description

total

int

total transactions

tx_hash

String

transaction hash

tx_type

int

transaction type (208/209/210)

tx_time

int

UNIX time of the transaction

block_height

int

block height

confirm_flag

int

transaction state on the blockchain, 0:failure 1:success

block_index

int

The index of transactions within a block

fee

String

fee

5. Get transaction detail by txhash

url:/v2/transactions/{tx_hash}, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
        "tx_hash":"000004c9903c338...ee5505e171e6d752dbd", 
        "tx_type":209, 
        "tx_time":1522210288, 
        "block_height":1212, 
        "confirm_flag":1, 
        "block_index":1, 
        "fee":"0.01", 
        "description":"transfer", 
        "event_type":3, 
        "detail":{
        
        }
    }
}

Url RequestField

Type

Description

tx_hash

String

transaction hash

ResponseField

Type

Description

tx_hash

String

transaction hash

tx_type

int

transaction type (208/209/210)

tx_time

int

UNIX time of the transaction

block_height

int

block height

confirm_flag

int

transaction state on the blockchain, 0:failure 1:success

block_index

int

The index of transactions within a block

fee

String

fee

description

String

transaction description for given ONT ID

event_type

int

event type reference

detail

Object

transaction detail

detail field

  • Deploy smart contract transaction

Smart contract detail in description filed

{
	"detail":{}
}
  • Transfer transaction

{
	"detail":{
		"transfers": [
			{
				"amount": "0.02", 
				"from_address":"Aege6VvWEiKauFa2ngrtwdXt8FeGkWNPRH", 
				"to_address":"ATUD7W6t6tLPGgd8H9tCN6Kwkb9WKFddch", 
				"asset_name":"ont", 
				"contract_hash":"9762458cd30612509f7c...",
				"description":"transfer"
			}
		]
	}
}

ResponseField

Type

Description

transfers.asset_name

String

asset name

transfers.to_address

String

toaddres

transfers.from_address

String

fromaddress

transfers.amount

String

amount

transfers.description

String

transfer reference

transfers.contract_hash

String

contract hash

  • ONT ID transaction

{
	"detail":{
		"ontid":"did:ont:Ahctt129csbc612enxGTss6", 
		"description":"register OntId"
	}
}

ResponseField

Type

Description

ontid

String

ONT ID

description

String

transaction description for given ONT ID

6. Get transaction input data

Returns input data and contract abi (if exists) for EVM transactions. Returns input data and resolution results of responses (if can be resolved) for naive and neoVM transactions.

url:/v2/transactions/input-data/{txHash}
method:GET
URL Request ParameterTypeDescription

txHash

String

transaction hash

Example Response

Returns from the EVM:

{
    "code": 0,
    "msg": "SUCCESS",
    "result": {
        "original_view": "0xa9059cbb000000000000000000000000d0efc52b329699a071be1b0745fcc0dc5cfd0d600000000000000000000000000000000000000000000000000000000000989680",
        "abi": "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
    }
}

Resolution results of native VM and neoVM transactions:

{
    "code": 0,
    "msg": "SUCCESS",
    "result": {
        "original_view": "00c66b149b27fff7d06c214f4f4ae2e13ec844a9ea7a46636a7cc814a68d0c9ef4806f6e67a5e5b168af3afa1a452be06a7cc80400d8c1426a7cc86c51c10a7472616e7366657256321400000000000000000000000000000000000000010068164f6e746f6c6f67792e4e61746976652e496e766f6b65",
        "default_view": {
            "function": "transferV2(Address from,Address to,Long value)",
            "method_id": "7472616e736665725632",
            "params": [
                "9b27fff7d06c214f4f4ae2e13ec844a9ea7a4663",
                "a68d0c9ef4806f6e67a5e5b168af3afa1a452be0",
                "00d8c142"
            ]
        },
        "decode": [
            {
                "name": "from",
                "type": "Address",
                "data": [
                    "AVvGJULMaKwvJvKpQSN7s5PU7mVz4hKJim"
                ]
            },
            {
                "name": "to",
                "type": "Address",
                "data": [
                    "AWxWncsrqnUL6oWhmpL1QkLL7echaD9JEs"
                ]
            },
            {
                "name": "value",
                "type": "Long",
                "data": [
                    1120000000
                ]
            }
        ]
    }
}

Returns for wasmVM transactions and transactions that can't be resolved:

{
    "code": 0,
    "msg": "SUCCESS",
    "result": {
        "original_view": "438f52b0e107dc0d79f0b7b2ee3fde304a922f6b4e0b6f72633230546f4f657034acae7a1a3ca81df404c312b57a520a52006fc7a79899b83824870f81a4f25879e49f720f266657f000bca0650100000000000000000000000957494e472d57494e47"
    }
}
Response ParameterTypeDescription

original_view

String

original input data

abi

String

contract abi, returns when query is for EVM transactions and contract abi exists, otherwise this field is not returned

default_view

Map

default view of the corresponding page, only returns when resolution is successful

decode

List

resolution result, only returns when resolution is successful

Last updated