This week we released an update to the StarkNet streams to support sending pending blocks to clients that wish to receive them. Clients receive pending blocks in between regular blocks, notice that clients can receive multiple pending blocks one after the other.
This new feature is used in the Python SDK to implement optimistic updates. You can update the state of your dapp before its state changes on chain!
This is incredibly useful for applications that require low-latency updates to improve their user experience:
- NFT drops, showing the number of NFTs left to mint in real time.
- On-chain games, updating the state of the game as soon as a player moves.
- Social, showing posts and comments in real-time.
- DeFi, showing more up-to-date prices.
If you want to implement optimistic updates in your indexer, head over to the Python SDK documentation to learn how to get started.