EOSIO

Available on:

  • EOS Mainnet
  • Worbli
  • CryptoKylin Testnet
  • Jungle 2.0 Testnet
  • Your own network

Ethereum (Alpha)

Available on:

  • Ethereum Mainnet
  • Ropsten

Use dfuse Events to Easily Find Your Transactions

May 8, 2019 11:53:06 AM / by dfuse

In our continual effort to index everything you need on the blockchain, we are thrilled to announce dfuse Events. This will allow a developer to choose which actions of their contract they would like to have indexed by dfuse, and which fields they would like to index.

For a developer, being able to sift through massive amounts of transactions is extremely valuable. So after many requests, we have developed custom indexing through dfuse Events, allowing you to choose which fields you want indexed. This brings a greater depth of understanding, and increased queryability for you and your users.

What dfuse Currently Indexes

As of now, we currently index almost all data fields for the system contracts. This means that if you want to search for a transaction in which account1 transferred EOS tokens to account2, you could use the query:

receiver:eosio.token account:eosio.token action:transfer data.from:account1 data.to:account2

Since we index the data fields from and to, a user will be able to query this information from our endpoints. If your contract happens to utilize the same names for a field that we index, then you’re in luck! But if you want to have data fields that make sense with your contract, then dfuse Events is for you.

Another important aspect of dfuse Events, is you can output some calculations, or data that is inside the contract, and not in the action parameters. See the documentation for some concrete examples of this.

How to Use dfuse Events

dfuse Events works by sending an inline action from their contract to dfuseiohooks:event(auth_key, data). The auth_key field will either be blank (for general free access), or a token provided through our Portal (if you require a larger number of custom fields to be indexed). The data field will contain the key/value pairs to index, as a URL encoded string.

Once that is set up, you or your users will be able to utilize the dfuse Search Query Language to query the chain for the information they seek. This SQE language is used on eosq, giving you and your users a great UI in which to fetch the data. For the moment, we have included 3 custom fields for free, and if you would like more fields, please reach out to us to discuss.

This would be the query structure used when using dfuse Events:

event.[field]:[value] action:[action_name] receiver:[your_contract] account:[your_contract]

Examples of How to Use dfuse Events

We’ve included an example smart contract that utilizes dfuse Events to ensure that you have everything you need to get started right away. For a more technical explanation, be sure to go through our documentation. Here’s an example of a search done on eosq, which fetches the transaction that matches pet_kind:dog from the example implementation given in the docs.

If you’re looking to give your users the best experience, while having access to data on how they interact with your contract, then dfuse is the right platform for you. Get started today by signing up for your free API key and start building in minutes. Join us in our Telegram channel if you any questions or feedback, and please let us know what you’d like to see next!

topics EOSIO, developer, Release, dfuse Events