EOSIO

Available on:

  • EOS Mainnet
  • CryptoKylin Testnet
  • Jungle 2.0 Testnet
  • Your own network
Coming Soon

Kicking off 2019 with a Revolution - Searchability on the Blockchain

Jan 7, 2019 4:26:09 PM / by dfuse

Until now, there has been no way to search through the entire transaction history on a public blockchain with the power of a modern search engine. Block explorers have been limited to looking up individual transactions or accounts by ID. But now, thanks to dfuse, the contents of a blockchain are easy to search.

dfuse Brings Search to a New Level

eosq, the most in-depth and high-precision block explorer, is adding to its growing list of unique capabilities by integrating a new search engine powered by the dfuse Structured Query Engine (SQE). This demonstrates how developers can leverage dfuse SQE to perform powerful and complex searches of blockchain data with a single query, with results available almost instantly in their applications.

These unique capabilities are available to all dapps, mobile and web applications that are powered by the dfuse API.

Let’s take a moment to run through a few examples of searches that a user or developer might want to perform using dfuse SQE and how those queries should be structured.

All Transfers of EOS Between account1 and account2

A common question a dapp might need to answer is “what is the history of transfers from my account to another user’s account?” The query structure would be:
receiver:eosio.token action:transfer data.from:account1 data.to:account2
with an example being: receiver:eosio.token action:transfer data.from:eoscanadacom data.to:eoscanadaops
This is telling dfuse SQE to return all transactions executed by the eosio.token contract code (receiver) that involve a transfer from eoscanadacom to eoscanadaops

 



ProTip: If you wanted to see both transfers from eoscanadacom to eoscanadaops AND transfers from eoscanadaops to eoscanadacom, you could modify the query to this:
receiver:eosio.token action:transfer (data.from:eoscanadacom OR data.from:eoscanadaops) (data.to:eoscanadacom OR data.to:eoscanadaops)

View All Transactions Signed By a Specific Authority

If a user wanted to retrieve a list of all transactions that were authorized by any authority of a given account, they could use the query:
auth:account1 with an example being: auth:eoscanadacom

This will return all transactions that eoscanadacom has authorized, without having to filter through any notifications, messages, transfers, or other actions that the account has received.

ProTip: If you want to filter further down to a specific authority permission of an account (such as owner), you can use the query:
auth:eoscanadacom@owner

Understanding the SQE Language

The SQE language is meant for developers who are using the dfuse API. But we’ve integrated it into eosq so as to make it more widely available to each and every user who is looking to search the EOS blockchain and testnets. Here is a more detailed rundown of the query language.

Prefixes and Fields Available for Query:

action: the name of the action being executed

account: matches the account called on the action. Not to be mixed with receiver. This will match with notifications sent from a contract to another account.

receiver: means the account with code that has executed the action. This is unambiguous.

auth: returns all actions signed with the authority of a specified account. This can be used in two formats

  • auth:account which will return all actions signed by an account, or
  • auth:account@permission which will return only the actions signed by a specific permission within an account

data.sub.fields: a large number of action-specific fields can be matched for equality. Ex: data.from and data.to (present in transfer operations).

  • lists are flattened, and terms matched when the query is present in the list.
  • nested documents fields are separated by a . , so {"data": {"user": {"id": "hello"}}} will match data.user.id:hello

As the dfuse API progresses and improvements are added, the best place to keep up and learn about the SQE language structure is in our documentation.

Adding this kind of search capability to a blockchain is a major innovation we are glad to make accessible to all users.

Please let us know if you have any further feature requests -- we love to get your feedback. Join us in our Telegram channel and get your own free dfuse API key today to enhance your development experience on EOS.

Get Free API Key

topics EOSIO, eosq, Structured Query Engine, dfuse API, Release