GET /v0/state/abi
stable

Fetches the ABI for a given contract account, at any block height.

Usage

Sample request:


curl -H "Authorization: Bearer eyJhbGciOiJLTVNFUzI1Ni..." \
  "https://eos.dfuse.eosnation.io/v0/state/abi?account=eosio&json=true"

fetch('https://eos.dfuse.eosnation.io/v0/state/abi?account=eosio&json=true', {
  headers: {
    'Authorization': 'Bearer eyJhbGciOiJLTVNFUzI1Ni...'
  }
}).then(console.log)

headers = { 'Authorization' : 'Bearer eyJhbGciOiJLTVNFUzI1Ni...' }
r = requests.get('https://eos.dfuse.eosnation.io/v0/state/abi?account=eosio&json=true', headers=headers, verify=False)
j = json.loads(r.text)
print(json.dumps(j, indent=4))

req, err := http.NewRequest("GET", "https://eos.dfuse.eosnation.io/v0/state/abi?account=eosio&json=true", nil)
if err != nil {
// handle err
}
req.Header.Set("Authorization", "Bearer eyJhbGciOiJLTVNFUzI1Ni...")

resp, err := http.DefaultClient.Do(req)
if err != nil {
// handle err
}
defer resp.Body.Close()

Requesting past blocks

The block_num parameter determines for which block you want the given ABI. This can be anywhere in the chain’s history.

If the requested block_num is irreversible, you will get an immutable ABI. If the ABI has changed while still in a reversible chain, you will get 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.

The returned ABI is the one that was active at the block_num requested.

Input parameters

q
required
String     Search query string. See the dfuse EOSIO Search Terms for more details.
account
required
AccountName     Contract account targeted by the action.
block_num
Optional
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.
json
Optional
Boolean     Defaults to false. Returns the ABI in JSON form if set to true. When set to false, the packed ABI is returned in hexadecimal string form.

Response

block_num
required
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.
account
required
AccountName     Contract account this ABI is active for.
abi
required
Object     A hexadecimal string (or JSON if json=true) representation of the ABI that is stored within the account. It is the ABI in effect at the requested block_num.

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


  "block_num": 8000,
  "account": "eosio.token",
  "abi": {
    "version": "eosio::abi/1.0",
    ...
  }
}