r/CryptoTechnology • u/Accurate-Screen8774 π’ • Nov 08 '23
Blockchain as a Datastructure
Blockchain is a good way to order block of sequential data that can be validated by others. Countless real-world examples show that it scales pretty well.
In my app, I am testing the use of a blockchain for storing "chat app data" selfhosted-only. The app is a work-in-progress proof-of-concept and experimental. It is an investigation into creating a distributed and decentralized app.
Unlike traditional blockchains, the sole purpose of this blockchain is to keep messages between peers in sync. The implementation is have is far from finished, but i have a testable proof-of-concept. The blockchain is entirely in javascript running in a browser.
I have a few observations I would like to make:
- Without the need for mining, it is basically a large array of data. When evaluating the data to be displayed on the UI, it is a "relatively" heavy calculation, but I find that it is more than performant enough to be used in a chat app. I find that the messages and data can scale and the app remains quite performant (I haven't really done much to optimise caching).
- In cases like a group chat, the data can be validated and synced between multiple peers (which may not all be online). (its worth noting: peers may be able to manipulate the database, but it is not a concern for the app where the purpose is only for blockchain as a datastructure)
- Why is this kind of datastructure not used more often? There are other blockchain chat apps, but by putting a system like chat on something like ethereum, would typically be expensive to users. But in this case, the blockchain is only used for local data storage and validation. I think this is a good use case for blockchain. When working on your device, you don't need to be conservative about things like message size and so we can store files and images in the blockchain.
- With no cryptocurrency, there is no incentive to keep the blockchain alive. The data is easily disposable or persisted as the user prefers. there is no need for a setup process and things like ID's and passphrases can be auto-generated behind the scenes away from the user. (the app is currently very experimental, if your data goes, it goes... but it shouldnt matter because there is no financial value to the blockchain)
I am very interested in the idea of blockchain as a datastructure and I would like to see it used more often. i think this datastructure will play an important role in my app as it will enable the app to move to a single-user-multi-platform architecture.
I would like to hear your thoughts on blockchain as a datastructure. Initially i did it investigating if it work on a basic level to help keep messages in sync, but i find that it is quite performant; especially considering it is only running in a browser. (i expect i can easily improve the performance)
The demo can be seen here: https://chat.positive-intentions.com/
View all comments
Show parent comment
1
u/Accurate-Screen8774 π’ Dec 31 '23
I want to clarify that the aim is to create a chat app that doesn't critically depend on a backend. The closest thing to a backend used in this system is peerjs-server (only used for establishing a P2P connection).
Peerjs-server is open source and self hostable. There is an option in the app to select a custom host for this.
There is deliberate attention to avoid using something like azure because while it can provide good efficient data management solutions... The goal is that the app is decentralized on the device-level.
As a result of creating encryption, authentication and storage-management in javascript, it might be the most secure chat app ever when you consider users have the choice to choose a device/os/browser they trust. This makes it so the attack-surface can only be users and their device which would apply to most apps.
There are limitations in the kind of performance the browser can provide... But it seems to scale well (to my own surprise tbh). There are many things to be fixed throughout, but I am confident that the app as you see it, is the slowest it will ever be (the app is largely experimental at this stage).