EOSIO

Available on:

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

Six Things Every Developer Should Know Before Starting to Build on EOSIO

Apr 18, 2019 2:01:42 PM / by dfuse

Any developer looking to build a blockchain application knows that getting started can be a daunting task. That’s where dfuse shines, providing simple and powerful interfaces, ensuring that you have all the tools you’ll need. To make it easier, we highlighted these six tips for getting started with dfuse.

Get Your Free API Key and Get Started in Less Than Two Minutes

Our onboarding process couldn’t be simpler, with our self-serve portal offering 3 methods to create your account: you can create your account using GitHub, Google, or email. Once you’ve verified your account, walk through our wizard and generate your first API key.

There are three types of API keys to choose between, depending on your use case:

  • Web: You want to embed your API key in the client-side of a Web application. Specify an Origin for such keys.
  • Mobile: You want to embed your API key in a mobile application deployed on an app store.
  • Server: You want to connect your server backend directly with our service.

Easily Generate JWT Tokens From Your API Keys

Now that you have your long-lived API key, you’ll need to generate JWT tokens for your API calls. If you use our latest library, this will be handled automatically for you. Otherwise, you can just call the https://auth.dfuse.io/v1/auth/issue endpoint, as outlined in our documentation. You should cache these tokens and refresh them as necessary.

Quick tips about JWT tokens:

  • Creating a new token will not affect any tokens that are already in use. Each one will have a 24-hour life span.
  • If a WebSocket connection is opened, it can remain open past 24 hours. However, know that we purposefully close connections every few hours, so make sure your code can gracefully deal with reconnecting and picking up from your last known point.

Never Miss a Beat When Doing WebSocket Calls

WebSocket connections are never eternal, and as such we wanted to ensure that it was as simple as possible to pick up from your last known response. If you include the parameter with_progress, you will receive a progress response at a requested interval. This will allow you to keep track of where you last got a returned value so that you can pick back up from there by opening a new WebSocket connection with a relevant start_block.

Quick tips about start_block:

  • A negative value will start your connection that many blocks behind the head block
  • A value of 0 requests to start from the head block
  • A positive value will start you from that block height
    • Standard keys can start from 3600 blocks in the past
    • If you require more than this, reach out to us and we’ll discuss how we can provide you with what you need

dfuse Helps You Navigate the Eventually Consistent Data

Due to the nature of EOSIO blockchains requiring 15 of 21 Block Producers to validate a block before it becomes irreversible, it’s possible that a response you receive will need to be reversed. To help navigate the microforks that can occur at the tip of the chain, dfuse will emit undo and redo responses to keep you in sync with the longest chain.

This, plus being able to track the lifecycle of a transaction, allow you to easily keep tabs on the information that is important to you. It will also allow you to define the amount of assurance you need to balance the integrity of the data on which you take action, and the user experience of your application.

Use Our Powerful Search Query Language to Pick Out the Relevant Data

With dfuse, we have introduced a search query language that allows you to really drill down through the chain’s information and pick out what is relevant to you. Easily search through the entire history of the chain in mere seconds, without the need to set up a secondary database.

Quick tips for the search query language:

  • There is an implicit AND between each field, unless specified otherwise
  • To pass an OR operator, the field options must be within parentheses and have an explicit OR between them
  • There are dozens of indexed data.sub.fields to help lead you directly to the relevant actions
  • Easily search through database operations (all values name-encoded) to quickly find the specific actions you need

Where Can I Go to Learn More About dfuse?

Here’s a list of the important places to be aware of to get the most out of your blockchain development experience:

  • dfuse home page - The main hub for all things dfuse. Easily run sample queries that we have embedded within a runkit on the homepage to see just how simple it is to use dfuse.
  • dfuse GitHub repository - Explore the available libraries, code snippets, and examples we’ve included to demonstrate how to utilize dfuse.
  • dfuse docs - Our docs are the best place to find up-to-date information about everything you need to know for crafting your API calls, to handling token generation, to debugging errors you may encounter.
  • dfuse blog - We use our blog as a single point where you can go to read about all of the new releases we at dfuse put out. We have a quick pace, so make sure you keep up with all of our exciting changes. We also love to highlight developers from the community to help share their wisdom and experience for new developers in our “In the Eyes of a Blockchain Developer” series. Our blog is also available in Chinese.
  • dfuse Telegram channel - Chat directly with the dfuse developers and other dfuse users to help you get started, debug any issues you may have, or learn how dfuse can best serve your needs.
  • dfuse self-serve portal - Generate and manage your API keys as needed. As we introduce new tools to dfuse, they will all be easily managed from this simple-to-use portal.
  • dfuse Labs - Walk through examples of tools you can build on EOSIO with the help of dfuse.

You should also look to these places for general EOSIO questions:

There has never been a more exciting to get started in the blockchain space. Thanks to tools like dfuse, there has also never been an easier time to get started. Try out our samples to see the power that is now easily within reach for anyone to use. All that’s missing is your great idea!

Get Free API Key

topics EOSIO, dfuse API, developer, Use case