Download OpenAPI specification:Download
A REST layer over the TrueBlocks application. With chifra serve
, you can run this on your own machine, and make calls to localhost
.
This API's endpoints are exact translations of the commands used by the chifra CLI application, and the query parameters mirror the commands' options and flags. If you want details, the commands have their own documentation page. For detailed descriptions of fields, see the data model reference.
chifra serve
By default, all calls are to localhost:8080
.
All options and flags are passed through query parameters.
For example, to get block 100
, make a call to /blocks
and specify
the block you want in the query parameter:
curl "http://localhost:8080/blocks?blocks=100"
Some parameters support ranges:
curl "http://localhost:8080/blocks?blocks=100-120"
Other parameters let you filter your responses. For example, to get only the unique addresses from that block range:
curl "http://localhost:8080/blocks?blocks=100-110&uniq=true"
You might want to cache queries on your local machine.
"http://localhost:8080/blocks?blocks=100-110&cache=true"
Cacheing speeds up repeat queries significantly. The cache options are particularly useful for calls to data-rich endpoints, like most endpoints in the "Accounts" collection.
Of course, caches occupy local storage. So cache wisely.
List every appearance of an address anywhere on the chain.
addrs required | Array of strings <address> one or more addresses (0x...) to list |
count | boolean display only the count of records for each monitor |
appearances | boolean export each monitor's list of appearances (the default) |
silent | boolean freshen the monitor only (no reporting) |
{- "data": [
- {
- "blockNumber": 8854723,
- "transactionIndex": 61,
- "address": "0xf503017d7baf7fbc0fff7492b751025c6a78179b",
- "name": "TrueBlocks 2020 Wallet 0xf503"
}, - {
- "blockNumber": 8855603,
- "transactionIndex": 121,
- "address": "0xf503017d7baf7fbc0fff7492b751025c6a78179b",
- "name": "TrueBlocks 2020 Wallet 0xf503"
}, - {
- "...": "..."
}
]
}
Export full detail of transactions for one or more addresses.
addrs required | Array of strings <address> one or more addresses (0x...) to export |
topics | Array of strings <topic> filter by one or more log topics (only for --logs option) |
fourbytes | Array of strings <fourbyte> filter by one or more fourbytes (only for transactions and trace options) |
appearances | boolean export a list of appearances |
receipts | boolean export receipts instead of transactional data |
logs | boolean export logs instead of transactional data |
traces | boolean export traces instead of transactional data |
statements | boolean export reconciliations instead of transactional data (requires --accounting option) |
neighbors | boolean export the neighbors of the given address |
accounting | boolean attach accounting records to the exported data (applies to transactions export only) |
articulate | boolean articulate transactions, traces, logs, and outputs |
cache | boolean write transactions to the cache (see notes) |
cacheTraces | boolean write traces to the cache (see notes) |
count | boolean only available for --appearances mode, if present, return only the number of records |
firstRecord | number the first record to process |
maxRecords | number the maximum number of records to process before reporting |
relevant | boolean for log and accounting export only, export only logs relevant to one of the given export addresses |
emitter | Array of strings <address> for log export only, export only logs if emitted by one of these address(es) |
topic | Array of strings <topic> for log export only, export only logs with this topic(s) |
asset | Array of strings <address> for the statements option only, export only reconciliations for this asset |
staging | boolean export transactions labeled staging (i.e. older than 28 blocks but not yet consolidated) |
unripe | boolean export transactions labeled upripe (i.e. less than 28 blocks old) |
firstBlock | number first block to process (inclusive) |
lastBlock | number last block to process (inclusive) |
{- "data": [
- {
- "hash": "0x1a898c5448b37f693343917ea40b7ad1c43b28a4ddd37af1bd6d0bb4a0c99891",
- "blockHash": "0x1d7f60b34bad8ce0ba5e49e3845c7a62ba8db440b81f8df98ec6349c4d28ca8e",
- "blockNumber": 8854723,
- "transactionIndex": 61,
- "timestamp": 1572639538,
- "from": "0xbb984f85bd52d78eb2fbf2c5598bae7abb98c5bc",
- "to": "0xf503017d7baf7fbc0fff7492b751025c6a78179b",
- "value": 5000000000000000000,
- "gas": 21000,
- "gasPrice": 10000000000,
- "maxFeePerGas": 0,
- "maxPriorityFeePerGas": 0,
- "isError": 0,
- "hasToken": 0,
- "receipt": {
- "contractAddress": "0x0",
- "gasUsed": 21000,
- "effectiveGasPrice": 10000000000,
- "status": 1
}, - "compressedTx": "0x ( )",
- "gasCost": 210000000000000,
- "gasUsed": 21000,
- "date": "2019-11-01 20:18:58 UTC",
- "ether": 5
}
]
}
Add, remove, clean, and list address monitors.
addrs | Array of strings <address> one or more addresses (0x...) to process |
clean | boolean clean (i.e. remove duplicate appearances) from monitors |
watch | boolean continually scan for new blocks and extract data for monitored addresses |
sleep | number seconds to sleep between monitor passes |
delete | boolean delete the item, but do not remove it |
undelete | boolean undelete a previously deleted item |
remove | boolean remove a previously deleted item |
{- "data": [
- {
- "nApps": 0,
- "firstApp": 0,
- "latestApp": 0,
- "sizeInBytes": 0,
- "tags": "string",
- "address": "string",
- "name": "string",
- "isCustom": true,
- "deleted": true,
- "symbol": "string",
- "source": "string",
- "decimals": 0,
- "isContract": true
}
]
}
Query addresses or names of well known accounts.
terms required | Array of strings <string> a space separated list of one or more search terms |
expand | boolean expand search to include all fields (search name, address, and symbol otherwise) |
matchCase | boolean do case-sensitive search |
all | boolean include all accounts in the search |
custom | boolean include your custom named accounts |
prefund | boolean include prefund accounts |
named | boolean include well know token and airdrop addresses in the search |
addr | boolean display only addresses in the results (useful for scripting) |
collections | boolean display collections data |
tags | boolean export the list of tags and subtags only |
delete | boolean delete the item, but do not remove it |
undelete | boolean undelete a previously deleted item |
remove | boolean remove a previously deleted item |
[- {
- "tags": "50-Tokens:ERC20",
- "address": "0xfe5f141bf94fe84bc28ded0ab966c16b17490657",
- "name": "LibraToken",
- "symbol": "LBA",
- "source": "On chain",
- "decimals": 18,
- "description": "Decentralized lending infrastructure facilitating open access to credit networks on Ethereum."
}
]
Fetches the ABI for a smart contract.
addrs required | Array of strings <address> a list of one or more smart contracts whose ABIs to display |
known | boolean load common 'known' ABIs from cache |
sol | boolean extract the abi definition from the provided .sol file(s) |
find | Array of strings <string> search for function or event declarations given a four- or 32-byte code(s) |
{- "data": [
- {
- "name": "PairCreated",
- "type": "event",
- "stateMutability": "nonpayable",
- "signature": "PairCreated(address,address,address,uint256)",
- "encoding": "0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9",
- "inputs": [
- {
- "type": "address",
- "name": "token0",
- "indexed": true,
- "internalType": "address"
}, - {
- "type": "address",
- "name": "token1",
- "indexed": true,
- "internalType": "address"
}, - {
- "type": "address",
- "name": "pair",
- "internalType": "address"
}, - {
- "type": "uint256",
- "name": "val_0",
- "internalType": "uint256"
}
]
}
]
}
Retrieve one or more blocks from the chain or local cache.
blocks required | Array of strings <blknum> a space-separated list of one or more block identifiers |
hashes | boolean display only transaction hashes, default is to display full transaction detail |
uncles | boolean display uncle blocks (if any) instead of the requested block |
trace | boolean export the traces from the block as opposed to the block data |
apps | boolean display a list of uniq address appearances in the block |