Developers December 23, 2020

How-To Build a DApp Using The APIS (Day 259)

Calvin Pak @titans

Writing to blockchain would require some wait time for the "confirmation". On Ethereum, the typical block time is around 15 seconds, and to make sure the transaction is finalized could take up to 6 to 10 blocks, that means each write transaction would take about 1.5 minutes or more.

While the read operations can be indexed and/or cached to speed up, the only way to speed up a write transaction is by paying higher gas fees, but that's not desirable for most users. So when building dapps it is important to handle this properly, and it takes quite some work to manage the transaction states.

There are many ways we can build the experience. The asynchronous nature and the long wait time would make sense for using an event queue. With the queue we can handle the write transaction state updates asynchronously by having the frontend subscribing to the state updates on queue and refresh the UI accordingly. The APIS can handle the transaction state update callbacks for you, with very minimal code.

We are working on a demo dapp that will show you how to do this step-by-step using the APIS, and we will publish the details in a tutorial, so you can build a dapp literally by forking our code!

To learn more about the APIS project, please feel free to PM me on Twitter

  1. 1

    This is interesting Calvin. Love the architecture diagram. Gives a whole perspective. Is it focused on ETH alone? Any pricing indication for the services provided?

    1. 1

      Thanks, Wilson! The APIS project supports Ethereum, Bitcoin, and Solana at the moment. Will switch on Binance Smart Chain soon. We are building a token economy but for now, it's entire free.

      1. 2

        Awesome. I'm always on the lookout for developer-friendly projects and this is really a good one.

        1. 1

          Thank you, Wilson!

Recommended Posts