Implementing Instant Payment Notifications for Unconfirmed Transactions

article illustration
#case_studies

Let’s start by clarifying some concepts.

There are confirmed transactions, which are the ones included in blocks. These are transactions that have been confirmed by the network and cannot be reversed in any way.

There are also unconfirmed transactions. These are transactions that enter the mempool – a memory pool where transactions that have not yet been included in blocks are stored.

Miners take these transactions, look for the ones with higher fees, and start forming blocks, usually prioritizing transactions with higher fees.

If a transaction is in the mempool, there is no guarantee that it will be included in the next block or any subsequent ones, and it will be confirmed. There is a possibility that more valuable transactions for miners will be prioritized, but this particular transaction may not be included in a block.

SHKeeper Particularity:

Before this case, SHKeeper only processes transactions that have been confirmed and included in blocks.

Issue:

One of our clients approached us with an issue. He wanted additionally to SHKeeper functionality to recognize unconfirmed transactions and receive information about the change in transaction status when it becomes confirmed.

Due to the nature of their business, our client requires rapid access to information about both confirmed and unconfirmed transactions. This is because their service relies not only on confirmed transactions but also on providing services for unconfirmed transactions. Therefore, it is crucial to monitor both types.

How We Solved This Task:

When a transaction occurs in blockchain, the full node sends a notification about it and its status. Previously, we ignored all transactions except for confirmed ones, as for most businesses, it is important to track only those transactions that have been included in blocks. However, thanks to a custom request, we connected through these services the ability to see in SHKeeper both transactions that are in the mempool, that have not yet been included in a block for some reason.

Also, when there was a change in the transaction status, for example, it was included in a block from the mempool after some time, these services would show the related data in the form of a notification, and SHKeeper would gather this data, and send it on to the SHKeeper user.

Conclusion

We enhanced SHKeeper to send notifications to the client when a transaction is unconfirmed and later when it becomes confirmed.

Details of the Notification:

  • Transaction amount;
  • Coin/network;
  • Transaction address.