Encrypted Transaction Notification System

Encrypted Transaction Notification System

Introduction

When it comes to a fully private blockchain, part of the process of achieving this privacy is encrypting the data that is stored on the blockchain. The data model of encrypted UTXO, referred to as the Records Model on Aleo, has prevailed as the best data storage model when it comes to preserving privacy and allowing state to be changed concurrently. This causes a problem when it comes to how fast a user gets access to their money and data. In this blog we will explain how we have solved this problem using an encrypted transaction notification system we built into Avail.


The Problem of Scanning

On a fully private blockchain, like Aleo, a user has to continuously scan the transactions inside of every block to check if they received anything in that transaction.

How do you check if you received money or data from a transaction ?
A transaction outputs the private tokens or data on Aleo as records, so a user when they are scanning will be trying to decrypt these outputs to see if they can decrypt them. If they can decrypt an output record this means that they own this record and thus have to take a note of this transaction and the record that they have found. This is done in our pointer system described here https://avail.gitbook.io/encrypted-record-pointers


But trying to decrypt all of these outputs, all the transactions that have taken place on the Aleo blockchain can take some time and will only get worse as more users use the network since there will be more to scan.


A Simple Scenario:
I have an Avail wallet but have not logged in for 3 days. Then my friend sends me some tokens privately and I go on my wallet to see if I have received the tokens. I will have to scan the past 3 days of transactions until I get to the tokens my friend has sent which can take quite some time and like this I don't have instant access to my funds : (


Although we are always working on making scanning itself faster through optimising the code and data we have found a more efficient solution.

The Solution

On Avail when a user sends a private transaction to another Avail user and it confirms on the Aleo blockchain. The sender will then encrypt a message that only the recipient can decrypt with their viewing key. This message includes the transaction id and block height, so the recipient can just go and check that transaction id in the block referenced by the block height, if they can decrypt it then they register the pointers as they would normally and now they have instant access to the tokens or data they received. We call this the encrypted transaction notification system, because it notifies the recipient with a pointer to the transaction you have sent to them. Upon being received and checked by the recipient the encrypted transaction messages are deleted.


So the scenario given above would then be as follows:

I have an Avail wallet but have not logged in for 3 days. Then my friend sends me some tokens privately and I go on my wallet to see if I have received the tokens. I will instantly see the tokens he sent me and the transaction and my Avail wallet will continue to scan the past 3 days, but now I can go and use my tokens as I see fit : )


Conclusion

So to summarise the above using the encrypted transaction notification system makes using web3 privately easier because it gives you instant access to your funds and data when interacting with someone else on Avail. This also brings us closer to more real world use cases and as transaction confirmation times on the Aleo blockchain get better we will see more adoption because of a better user experience.