This example DApp demonstrates how two or more peers can connect and securely sell/purchase commercial content together without the need for a central server.
The example is only made of static js/css/html and uses ReactJS framework.
The first step is to configure a fully synced Lightstreams Node responsible for storing files in SmartVault, managing accounts and performing the blockchain Calls/TXs.
We encourage you to run your own local node. By default, the app connects to our public gateway on the Sirius Testnet.
Create your Lightstreams account or login using an existing one. The password will be used to encrypt, lock the
keystorefile on the node's disk.
After you configure your account, you enter a general dashboard where you can see all the eShops created by our community, the content being sold and how to buy it.
For simplicity of the demo, the metadata such as smart contract addresses of all the shops created by Lightstreams community are stored and aggregated in a real-time Firebase DB but when developing your own application, you can store them however you find appropriate. Smart contract? MySQL Database? IPFS?
Creating a shop using the UI will create and deploy a new smart contract keeping track of the digital content you will be selling. This is possible thanks to the Leth SDK
shopmodule booted on Lightstreams Node launch and exposed over CLI and HTTPS. For full documentation about the internals, visit our getting started with e-commerce guide.
Content on sale is stored in the configured node's SmartVault.
E.g, you can purchase a picture of a fountain I took in Mallorca for 15 Sirius test network PHTs. Behind the scenes, the SmartVault will grant you a permission to access this picture, securely stored in Lightstreams enhanced permissioned IPFS, the moment the Shop's Smart Contract receives the funds.
Thanks to Lightstreams SDK, Leth, creating DApps and monetizing commercial content was never easier!