Complete dapp in 1 week!
Welcome to my 1-Week-Aepp-Challange.
The goal is to develop complete decentralized application (dapp) with Aeternity blockchain (aepp).
I’m documenting the whole design and development process.
Feel free to follow the progress.

Day 2: defining concrete technologies and architecture of the Logonity – decentralized logo marketplace.
Day 1: https://pthomann.pl/1-week-aepp-challenge-day-1-idea-and-concept/

Logonity Aepp Architecture

The application consist of 3 main components:
– client – based on Vue.js/Quasar framework;
smart contract – Sophia based smart contract in Aeternity blockchain;
– server – centralized Node.js server with PostgreSQL database;

The Logonity is decentralized logo marketplace. The goal is to give possibility of submitting commissions for logo creation.

Smart contract is responsible for registering the commission, locking the reward (in Aeternity tokens) and in the end – sending the reward to the author of chosen (won) logo.

Interaction with the blockchain smart contract is not for free. The fee must be paid for sending transactions, submitting smart contract to the network or executing the functions of the smart contract (in general operations which change the inner state – which causes a neccessity of saving blockchain transaction).

The fee payment is made in Ae tokens and is tightly connected with the concept of gas, which is the main factor determining the cost of blockchain operations. From the development perspective the existance of the cost during the interaction with the blockchain forces to optimization of the whole interaction. The gas amount is based on the amount of data which will be saved in the blockchain.

The nature of the Blockchain is that it’s not dedicated to store large amounts of data. Most platforms allow to store only simple data types like numbers and text (Integer and String types). Anything like pictures, videos, music files, pdf etc. is not intended to be storred in the Blockchain. Blockchain can be treated as the global computer – such load would not be handled by the global network.

The users (authors) who want to take part in the logo commission can upload their own proposal (as the single file). Since the blockchain is not the place for storing this kind of data – in the Logonity architecture the server side will be responsible for that.

To be clear – centralized server breaks the idea of pure dapp. Since there is centralized component in the whole solution it’s not a 100% dapp anymore. Nevertheless the Logonity server side has completely no influence on the crucial part of the whole solution – choosing the winning logo by the commission author and processing the reward between commission author – logo author. This functionality is covered by the immutable and independent smart contract. Server side is mainly responsible for storing the logo files uploaded by the logo authors. When the commission author will choose the winning logo – he will receive the possibility to download the file from the centralized server.

The client side, similar to server side is also storred on centralized server however in that case server is only responsible for delivering the web page content (data) to the browser. Everything processed on the client is processed on the client’s machine (laptop, smartphone).

Smart contract interaction

The interaction with the Logonity smart contract, like submitting new logo commission, submitting the logo proposal, choosing the winning logo – is made from the client side.

Client web page integrates the Aeternity aepp-sdk (Javascript sdk). It gives the possibility to read blockchain state, send transactions, compile/deploy smart contracts and invoke smart contracts functions.

Submitting the contract to the network and invoking the smart contract functions (which change the state) require to have the account (account in general describes the public and private keys which in the unique way describe the owner of any data storred in the Blockchain).

So far Aeternity doesn’t provide the integration with any bridge software (like Metamask). It means that interacting with the blockchain where public/private keys are required – forces user to provide concrete values to the aepp-sdk API. This issue for sure is addressed and will be changed in the future however in the current state – the Logonity interactions with the blockchain will require users to provide their keys in the browser form fields. Nevertheless the whole process will stay private because these values will be used only in the client side of the application. Critical information will not leave Logonity user device, everything will stay private and safe.

Summary

Decentralized application architecture is more complex than tradional client – server approach, because in most cases third puzzle (the smart contract running in the Blockchain) is added to the solution.
In the next article I will present the Logonity smart contract proposal.


Also published on Medium.