Getting started with developing for blockchain can seem like a difficult task. Thankfully, there are many resources out there to help guide you along your development journey. As the most popular data access provider for developers, dfuse wanted to ensure that we offered many examples to help you get started developing on EOSIO as quickly as possible.

Basic Examples of Using dfuse

Once you have already signed up for your free API key and you’re ready to get started, we recommend starting out with our Basic Examples. These examples are all written in TypeScript. There are four examples in this section:

Advanced Examples of Using dfuse

Now that you’ve run through the basic examples above, you should take a look through our more advanced examples. Again, these are all written in TypeScript.

Reference Code Samples

There is also a reference folder, which has nearly 20 working samples of simple calls. These include actions like generating a new JWT token, fetching a transaction by ID, and streaming the head info from the chain, to name a few. These are great pieces of code to drop into your application to save you time when dealing with some of the more straightforward tasks. These examples will all return JSON payloads, allowing you to easily and quickly view what an unformatted response looks like. From there, you can format the response to meet your specific needs.

Feel the Power of GraphQL

Now that you’ve mastered the above basic, advanced, and reference examples, it’s time to take the next step into GraphQL. While many developers are familiar with REST and WebSocket APIs, we have been blown away by the power of GraphQL (and know that you will be too). You can utilize it for either queries (similar to REST) or subscriptions (similar to WebSocket), and use them both in combination to start from any point in the chain, catch up to the head block and continue listening from there. You will also be able to tailor the payload that is returned to ensure that you aren’t bombarded by lots of information that isn’t pertinent to your needs.

Connect over the Apollo transport layer - There is a basic example that simply streams in the next 10 transfer actions, and an advanced example that uses a `cursor to mark your progress. Fetch different chain statistics - token.ts provides token transaction, action, and notification counts for a given block range, while account-creation.ts provides account creation statistics for a given block range. Connect over gRPC - This is the same as the basic example of the Apollo transport layer example, however it is all done over gRPC and uses Golang. Example in Python - Connect over gRPC to stream the next 10 EOS token transfers. If Python is your preferred language, this is a great place to get started. Use dfuse GraphQL in a React Application - Stream all the latest actions of the chain and filter them by smart contract. EOS/REX price feed - Consume real-time data about EOS mainnet’s REX.

Utilizing dfuse in Your Language of Choice

While we have given you examples to get started in multiple languages (such as JavaScript, Golang and Python), dfuse will work within whichever language you are most comfortable. If you’ve created any sample code that you feel would be helpful for other developers, please reach out to us and we’d love to add your example to the repository.

Continue Diving Into dfuse Examples

The above examples are a non-exhaustive list from the dfuse GitHub repository. Once you’ve gone through these, you can now consider yourself a dfuse Pro! Let us know which examples have helped you the most, or if there are any others that you’d like to see! You can always reach us through our dfuse Telegram Channel. We love to see what you’re working on, so please let us know what you’re building!