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.
👋 About THE APIS:
The APIS is an indexing protocol for reading and writing to open networks. Making APIs open and accessible to power a decentralized world.