POST /state/abi/bin_to_json

Decode binary rows (in hexadecimal string) for a given table against the ABI of a given contract account, at any block height.


Sample request:

curl -X POST -H "Authorization: Bearer eyJhbGciOiJLTVNFUzI1Ni..." \
    -d '{"account":"eosio.token","table":"accounts","block_num":2500000,"hex_rows":["aa2c0b010000000004454f5300000000"]}' \

fetch("", {
  method: "POST",
  body: JSON.stringify({
    account: "eosio.token",
    table: "accounts",
    block_num: 2500000,
    hex_rows: ["aa2c0b010000000004454f5300000000"]
  headers: {
    Authorization: "Bearer eyJhbGciOiJLTVNFUzI1Ni...",
    "Content-Type": "application/x-www-form-urlencoded"

import requests

headers = { 'Authorization': 'Bearer eyJhbGciOiJLTVNFUzI1Ni…', }

data = '{"account":"eosio.token","table":"accounts","block_num":2500000,"hex_rows":["aa2c0b010000000004454f5300000000"]}'

response ='', headers=headers, data=data)

package main

import ( "fmt" "io/ioutil" "log" "net/http" )

func main() { client := &http.Client{} var data = []byte(</span><span style="color:#75715e">{{</span><span style="color:#e6db74">&#34;account&#34;</span><span style="color:#960050;background-color:#1e0010">:</span><span style="color:#e6db74">&#34;eosio.token&#34;</span><span style="color:#f92672">,</span><span style="color:#e6db74">&#34;table&#34;</span><span style="color:#960050;background-color:#1e0010">:</span><span style="color:#e6db74">&#34;accounts&#34;</span><span style="color:#f92672">,</span><span style="color:#e6db74">&#34;block_num&#34;</span><span style="color:#960050;background-color:#1e0010">:</span><span style="color:#a6e22e">2500000</span><span style="color:#f92672">,</span><span style="color:#e6db74">&#34;hex_rows&#34;</span><span style="color:#960050;background-color:#1e0010">:[</span><span style="color:#e6db74">&#34;aa2c0b010000000004454f5300000000&#34;</span><span style="color:#960050;background-color:#1e0010">]</span><span style="color:#75715e">}}</span><span style="color:#e6db74">) req, err := http.NewRequest("POST", "", data) if err != nil { log.Fatal(err) } req.Header.Set("Authorization", "Bearer eyJhbGciOiJLTVNFUzI1Ni…") resp, err := client.Do(req) if err != nil { log.Fatal(err) } bodyText, err := ioutil.ReadAll(resp.Body) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", bodyText) }

Requesting past blocks

The block_num parameter determines for which block you want to decode rows against. This can be anywhere in the chain’s history.

If the requested block_num is irreversible, decoding will be performed against an immutable ABI. If the ABI has changed while still in a reversible chain, decoding will be performed against this new ABI, but it is not guaranteed to be the view that will pass irreversibility. Inspect the returned block_num parameter of the response to understand from which longest chain the returned ABI is from.

Input Parameters

The input body must be a valid JSON object. Here are the fields accepted in this JSON object.

AccountName     Contract account targeted by the action.
TableName     The name-encoded table name you want to retrieve. For example, user balances for tokens live in the accounts table. Refer to the contract’s ABI for a list of available tables. This is contract dependent.
Array<string>     An array of hexadecimal rows to decode. Each row must be a valid hexadecimal string representation of the row to decode against the ABI.
Number     Defaults to head block num. The block number for which you want to retrieve the ABI. The returned ABI will be the one that was active at this given block_num.


String     Block number closest to block_num at which the ABI was put on chain. For example, if ABI was last changed at block 1000 and you used a block_num of 20000 in the request, the response block_num will be 1000.
AccountName     Contract account this ABI is active for.
TableName     Contract table the rows were decoded against.
Array<object>     An array of decoded rows. Each element in the array is the decoded JSON representation of the encoded data against the active ABI at the requested block_num. Order of hex_rows request parameter is preserved.

Here is a sample response, for a request at block_num: 8000:

  "block_num": 181,
  "account": "eosio.token",
  "table": "accounts",
  "rows": [
      "balance": "1750.9546 EOS"