Documente Academic
Documente Profesional
Documente Cultură
CHAPTER 1: INTRODUCTION
1.1 Background
1.1.1 Blockchain
1.1.2 Ethereum
1.2 Objectives
1.3 Purpose, Scope, and Applicability
1.3.1 Purpose
1.3.2 Scope
1.3.3 Applicability
1.4 Achievements
1.5 Organisation of Report
CHAPTER 2: SURVEY OF TECHNOLOGIES CHAPTER
3: REQUIREMENTS AND ANALYSIS
3.1 Problem Definition
3.2 Requirements Specification
3.2.1 Intended Audience And Reading Suggestions
3.2.2 Project Scope
3.2.3 Overall Description
3.2.3.1 Product Perspective
3.2.3.2 Product Features
3.2.3.3 User Class And Characteristics
3.2.3.4 Operating Environment
3.2.4 System Features
3.2.4.1 Description And Priority
3.2.4.2 Stimulus/Response Sequences
3.2.4.3 Functional Requirements
3.2.5 External Interface Requirements
3.2.5.1 User Interfaces
3.2.5.2 Hardware Interfaces
3.2.5.3 Software Interfaces
3.2.5.4 Communication Interfaces
3.2.6 Non Functional Requirements
3.2.6.1 Performance Requirements
3.2.6.1.1 E-R Diagram
3.2.6.1.2 Normalization
3.2.6.2 Safety Requirements
3.2.6.3 Security Requirements
3.2.6.4 Software Quality Attributes
3.3 Planning and Scheduling
3.4 Software and Hardware Requirements
3.5 Preliminary Product Description
3.6 Conceptual Models
CHAPTER 4: SYSTEM DESIGN
4.1 Basic Modules
4.2 Data Design
4.2.1 Schema Design
4.2.2 Data Integrity and Constraints
4.3 Procedural Design
4.3.1 Logic Diagrams
4.3.2 Data Structures
4.3.3 Algorithms Design
4.4 User interface design
4.5 Security Issues
4.6 Test Cases Design
INTRODUNTION
Blockchain is said to be one of the most significant technologies of the last decade,
enabling business transformations in almost every domain. But what is blockchain? It is
referred to as a distributed ledger, append-only database shared between different nodes in
the network. Ledgers were used a long time ago before blockchain appeared. Each sheet
had a unique number, so one could not remove or replace the data in the ledger. Periodical
checks of the ledger state enabled transparency in operations preventing fraud and
tampering. Besides classical ledgers there were also digital ones. Nevertheless,
blockchain brought everything to a new level. Traditional and even digital ledgers could
still be corrupted or lost. Block- chain technology in its turn presented a shared distributed
ledger that is fault tolerant due to its distributed nature and immutability (what is satisfied
by cryptographic algorithms built into blockchain). It means that everybody in the
network holds own copy of the ledger and nobody could change the data without notifying
the rest of the participants.
1.1 Background
In this chapter, we will provide all the necessary background needed for further reading
of this work. We will briefly describe blockchain and Ethereum. Then we will cover
Solidity as a smart contract programming language and provide an example of a smart
contract. Finally, we will introduce Business Process Model and Notation as a tool for
capturing the business processes.
1.1.1 Blockchain
Blockchain is a distributed append-only database that operates in a peer-to-peer network.
It means that every peer in the network owns the full or partial copy of the database [2, 3].
The distributed architecture of the blockchain increases fault tolerance, even if some
nodes will be removed from the network, it still can operate in a usual way. If somebody
wants to change something in blockchain he creates a transaction that is broadcasted to all
nodes and in the network, is verified and only then appended to the blockchain. It takes
some time, so transactions do not come in the order they were generated by users. It may
happen that in two different points in the network the same transaction is created twice,
which is called “double-spend attack” in Bitcoin [5]. Due to distributed nature of
blockchain it should have a mechanism that arranges the order of incoming transactions.
Usually transactions are grouped in blocks and considered to happen at the same moment
of time. However, in this setting different nodes can create blocks consisting of different
set of transactions and add it to blockchain, so which block should be considered as the
last one and valid? Hence, blockchain protocol introduces a concept called “Proof of
Work” - a special mathematical puzzle one need to solve to append the block to the
blockchain [4]. It is computationally hard and requires a node to spend some time and
resources to solve it. It is a “right” to participate in blockchain. Since not every user is
interested in solving the mathematical puzzle to add the transaction to the blockchain, but
network requires such “workers” to operate, an incentive was introduced to engage those
“workers”. In general, this process is called mining and nodes that do a Proof of Work to
add block to the chain are called miners. Miners are the crucial part of the blockchain
ecosystem as they create a capability of processing certain number of transactions per
minute.
Another important aspect of blockchain system is that every user maintains a pair of keys
that verify ownership and allow to transfer units of account or digital tokens to other users.
This is accomplished through asymmetric cryptography, when one key is public and
second is private, known only to its holder. The former is shared with the network and is
used as a personal address to which other users can send digital assets, whereas the latter
one is used to create a unique digital signature and create transaction on the blockchain.
Public-private key schema ensures the validity of ownership, because only the person who
holds the private key can create a valid digital signature and create transaction to transfer
value over the net- work. In addition, this schema allows users to operate as anonymous
entities, not exposing their real identities. High fault tolerance and consensus mechanism
enable blockchain to operate in anonymized untrusted environment where ownership and
value transfer is verified by the system.
1.1.2 Ethereum
Ethereum is a decentralized platform that runs smart contracts: applications that run
exactly as programmed without any possibility of downtime, censorship, fraud or third-
party interference [7]. These apps run on a custom built blockchain, an enormously
powerful shared global infrastructure that can move value around and represent the
ownership of property.
The runtime environment for smart contract is Ethereum Virtual Machine. It is completely
isolated, that means that smart contract code has no access to network, file system or any
other process. Smart contracts have limited access to other contracts running in Ethereum.
1 Accounts
There are two types of Ethereum accounts: external accounts and contract accounts. Both
types share the same address space and are treated equally by Ethereum Virtual Machine.
External accounts are controlled the public-private key pairs used by humans to access
the accounts. Contract accounts are controlled by the smart contract code that is stored in
this address. The address of external account is determined from the public key whereas
contract address is created upon deployment and is derived from the creator address.
Every account has a persistent key-value store. Also, every account has balance that can
be changed by sending transactions that include Ether - a cryptocurrency backed by
Ethereum platform.
2 Transactions
A transaction is a message sent from one account to another. It can include payload and
Ether. If the target account stores smart contract code, that code is executed with the
payload provided as input parameters. If the target account is the zero-account (has
address 0), the transaction triggers the creation of new contract. The payload of such
transaction should be a EVM bytecode and is executed. The execution output is
permanently stored as the smart contract code. Therefore, to create a smart contract
transaction should contain not the actual code, but the code that will return the smart
contract code.
3 Gas
Gas is a special unit of measure which purpose is to limit the resources needed to execute
the smart contract code. While the EVM executes the code, the gas is gradually depleted
according to specific rules. To send a transaction, certain amount of Ether must be paid
for the gas consumed by the execution. The creator of the transaction defines the gas
price, because he needs to pay the following amount in Ether: gas amount multiplied by
gas price. Transactions with higher gas price get higher priority in the execution queue. It
is interesting to note that this payment should be made upfront with the transaction itself.
If there is any gas left, its cost will be refunded. If the amount of consumed gas exceeded,
then the exception is triggered and all modifications are reverted to the previous state.
Therefore, it is necessary to wisely plan the amount of gas consumed by a smart contract,
because in the latter case gas will not be refunded.
4 Storage, memory and stack
Every account has a persistent memory area which is called storage. Storage is a key-value
store. Both key and value is 256-bit word. It is not possible to enumerate storage from the
contract. It is costly to read from the storage. Write operations to storage are more
expensive than read operations. A contract has access to only its own storage.
Another memory area is called memory. For each message call smart contract receives a
clear instance of memory. Memory is linear and can be addressed in a byte level. Read
operations are limited to the size of 256 bits. Write operations can be either 8 bits or 256
bits wide. When memory is expanded it adds and offset equal to 256 bits and the gas for
extension must be paid. Memory cost increases quadratically.
The Ethereum Virtual Machine is a stack machine, so all computations are performed on
a memory area called stack. It has maximum size of 1024 elements and stores words of
256 bits. Access to stack is limited to 16 top elements. It is not possible to access arbitrary
elements without first removing the top of the stack.
7 Message calls
Smart contracts can call other contracts or send Ether to external accounts with help of
message calls. Message calls are similar to transactions: they have source, target, payload,
Ether, cost gas and return data. A called contract will receive cleared memory instance and
a access the payload - it is provided in a separate memory area called calldata. Call are
limited to the depth of 1024 because of the EVM stack peculiarities.
There is a specific type of a message call - a delegatecall. It allows to execute target address
code in the context of the calling contract. Using delegate calls contracts can dynamically
load code from a different address at runtime. It makes possible to implement libraries for
smart contracts.
8 Logs
Ethereum provides a way to store logs about transactions. The information is stored in a
specially indexed data structure. Smart contracts cannot access the logs. However, logs
can be accessed from outside the blockchain in an efficient and cryptographically secure
way. Therefore, peers in the network can check the logs without downloading the whole
block- chain.
1.2 Objectives
Low Commission Fees
Incentive System of Ratings and Bounces
Improved Security Measures
Automated Identity Verification
Creating Virtual Tour
1.3.1 Purpose
This project is concerned about real-estate business, where the whole ecosystem
developed in decentralized manaer that promotes
Shor-term loadging between Landlord and Tenants to conclude short-term real estate
rental contracts.
This will increases security measures, save lot of money that charged to both party
by real-estate broker as commission to introduce both party to each other, and as the whole
process is verified by blockchain, this will reduce mis-understaings often occurs between
landlords and tenants as landlord will be able to clearly state their rule and this application
also promotes the modern world travelers idea of “ Hand Luggage ”.
The limitaion that is present in the whole system is time constrain as blockchain need
time to approve and add the transaction to the ledger and return unique hash of it user has
to wait for it.
1.3.2 Scope
Project ecosystem most closely matches the expectations of young people of generation
Y: more adventures, exciting experiences, fewer formalities and pre-known routes. In the
modern world, most travelers choose the idea of "hand luggage" and full flexibility of
movement without burdening themselves with limitations. Having a smartphone and
access to the Internet, the traveler and the real estate owner will always be able to
negotiate and conclude a smart rental contract, and also to make a payment transaction
among themselves. It is convenient, simple and reliable for both parties. The use of crypto
currency in the transactions along with traditional methods of payment significantly
expands the possibilities for both sides.
“Generation Y (Millennials) - a generation born after 1981, met the new millennium at
a young age, characterized primarily by deep involvement in digital technology. And for
this generation traveling is one of life's priorities, higher than, for example, buying your
own home or buying a car. 44% of Millennials would spend free money on travels2.”
Project will make it possible to solve and simplify the problems that most of the guests
and landlords face. All this will not only save money on rental housing when traveling,
but will also open new countries and continents, for people who can’t and do not want to
spend large sums on expensive group journeys and tours. We expect that our ecosystem
will be able to significantly expand the existing short-term lodging market, improve
security, establish a high level of trust between users and will promote the development
of tourism both within countries and on the international level.
Now it is clearly evident that the generation Y is on the peak of technological innovation.
This generation of active young people is the main driving force in determining the vector
of development, not only of technology, but also of the future way of life of mankind.
With their flair, they choose the technologies of the future and promising ideas even at
the moment when those are at the earliest stages of inception.
1.3.3 Applicability
Project ecosystem is based on Full Node and Lite Client architecture. Full Nodes do all
the computational work and connect with Lite Clients. Computational core, based on
Node.js meets all the necessary requirements for reliable operation and fast transactions.
PostgreSQL combined with PostGIS is used for storing profile information, as well as
geographical locations. Using Fetch service provides quick access to required
information. IPFS protocol is used as a storage system for pictures and virtual tours of the
rented properties. API interface, provided by Full Nodes is used to connect Lite Clients
with Full Nodes. Lite Clients are mobile apps, for smartphones and tablets. Two
platforms, supported by ecosystem are Android and iOS where we first build this app for
Android user only. The combination of these time-tested technologies along with
Ethereum based smart contracts provides the overall reliability and speed of the entire
Project ecosystem.
PRINCIPLE OF OPERATION
Guests and real estate owners meet in the application ecosystem. The guest transfers the
full amount of the lease in application coin to a temporary wallet. The parties conclude a
smart contract for a short-term lease (on Ethereum) with the entry and its confirmation in
the blockchain.
The real estate owner can exchange received app coin for BTC, ETH and fiat money
(USD, EUR, JPY and CNY). As the number of rental smart contracts increases, the stable
demand for app coin among guest’s increases, thus the coin price starts to grow actively.
This growth and value are secured by the unique opportunities that the project’s
ecosystem provides to all its users.
EXAMPLES OF PROCESSES
The guest finds a suitable accommodation option in the application ecosystem and pays
for a reservation in app coin. Coins are transferred to a temporary wallet. A smart contract
containing all the terms is concluded between the guest and the property owner. Upon
check-in, the host gives keys to the guest and uses the application in his phone to scan the
QR code from the guest's phone screen. The system perceives this as "check-in" and app
coin are transferred from a temporary wallet to the wallet of the property owner. The guest
receives the right to use the property for the duration of the contract.
Check out of the guest and feedback:
When a guest leaves the rented property, the host, using the application in his phone,
scans the QR code from the guest's phone screen and receives the keys back. The system
sees this as a "check out". Guest leaves the rented room. The property owner and the guest
leave feedbacks for each other. Both sides get bonuses in app coin from application
ecosystem for leaving feedbacks. The platform generates user ratings based on reviews
and related data.
1.4 Achievements
While working on this project I learnt some of the core features of blockchain
technology stack that how people are working on it and the way it making foundation of
our next generation og web that is web3.0; I also come to know about other new
technology stack like React, Angular, Ionic, and the dependecy management using
Nodejs and framwork like Truffle, Drizzle and new programming language like solidity,
web3.js and tools like Ganache, Metamask as chrome extension and new file management
system like IPFS and the most important thing is a whole new decentralized DB called as
OrbitDB to store application data in full decentralized way which make our application
more robust.
This application help Landlord and tenants to made their agreement simple and
provides better understanding between them. This new ecosystem is oriented on the
markets of developing countries that attract travelers / tourists and have a great growth
potential.
This paper is divided into five chapters. Chapter 2 covers survey of technology that
are used while developing this project: Truffle, Ethereum, smart contracts. Chapter 3
describes the business processes of a real estate company and presents the domain model
that will be used in the proof-of-concept application. In Chapter 4 we discuss and define
which parts of the modeled business processes can be moved to the blockchain. Then, we
design and implement a proof-of-concept hybrid application that reflects the business
processes modeled in Chapter 3. We cover the technicalities related to smart contracts,
their deployment and integration with a traditional web application. Additionally, as a
part of Chapter 4, we discuss a tampering-resilient document storage. We consider IPFS
and Ethereum Swarm as two possible options, compare them and integrate one of this
solutions into our hybrid application.
Survey OF Technology
“In the modern world, already half of humanity are active users of the Internet , almost
4.33 billion active Internet users till -2019,Jan in world and In India only 493 million
users having Internet where 293 million resides in urban having Internet and 200
million in rural India.”
also.Here, we will use Ganache as our test network because it maintains the
blockchain ledger and also creates the whole setup for your test network in one
click using GUI or by one command in using ganache-cli. It also provides you
mnemonic to seed your metamask wallet with fake 100ETH ether.
The main problems faced by property owners are the difficulties associated with
increasing occupancy of facilities by guests, high commissions, security problems, trust,
difficulty in billing and linking the transactions with bank cards, as well as difficulties in
obtaining the feedback and positive ratings.
The real estate owners do not have the ability to fully show the property on a simple photo
the way it looks like in reality, and because of this, sometimes they face problems with
the guests. This understatement often entails guest discontent, and, as a consequence, a
bad review, low rating and poor occupancy.
Difficulties traditionally encountered by the guests are high commissions for services,
problems of trust due to lack of feedback, reliability of the contract, security, old and
irrelevant photos. The owners have few reviews, if any, and the payment possibilities for
accommodation are minimal.
Application ecosystem is created to solve most of the existing problems in the industry
and to bring the process of real estate rent to a new level of development.
Reservation description:
It includes tenants details, code number, landlord details, date of check-in, date of
check-out.
For each feedback both guest and the owner will also collect app coin, which they can
use for future trips.
The size of the bonus is determined by both the rating given by the opposite side as a
review, and by the number of leased days and nights. Users will be able to receive up to
30% of the commission paid back in the form of bonuses.
15
At the time guest departures from the apartment and returns the keys to the owner,
it is possible to repeat this process, confirming the check-out to the system.
Tenants Functions.
• Get all tenants who have house reserved on a given property.
• Get all house for a given tenants.
• View house schedule.
• Get all tenants whose check-in and check-out times are on time/delayed.
• Calculate total income for a given property.
Administrative
• Add/Delete a property
• Add a new property
• Update rule and regulation for property.
• Update check-out/in times for house in rule and day when one can take
his property for rent.
As shown in above figure client is lite client and there is full node developed
which have all business logic of application and if there is any file IO happens
will be managed by IPFS and all data entry related to DB will happen through
DB interface made to orbit-db using nosql that is a collecction will be created in
17
the document of json will be stored and all the transaction will be minied in block
by truffle and can be seen in ganache cli or GUI with corresponding block-hash.
Architecture of Application
This describes the external resources required or the action that to be performed
in oreder to get this prototype start working are as follow:
ER Diagram
22
3.2.6.1.2 Normalization
The basic objective of normalization is to reduce redundancy which means that
information is to be stored only once. Storing information several times leads to
wastage of storage space and increase in the total size of the data stored.
If a database is not properly designed it can give rise to modification anomalies.
Modification anomalies arise when data is added to, changed or deleted from a
database table. Similarly, in traditional databases as well as improperly designed
relational databases, data redundancy can be a problem. These can be eliminated
by normalizing a database.
Normalization is the process of breaking down a table into smaller tables. So that
each table deals with a single theme. There are three different kinds of
modifications of anomalies and formulated the first, second and third normal
forms (3NF) is considered sufficient for most practical purposes. It should be
considered only after a thorough analysis and complete understanding of its
implications.
Correctness: The flight should reach start from correct start terminal and
should reach the correct destination.
Software Requirements:
Truffle 5+
Ganache v2.0+
Meta-Mask
Hardware Requirements:
OS (Recommended macOSx)
o Windows 10
o Linux
o macOSx
RAM min: - 8GB DDR4
Graphics Card min: - 4GB DDR4
o NVidia 1050
o Radeon 560x
25
Processor: -
o Intel 8th gen i5
o Ryzen 5
Clock Speed: - min: - 2GHz, recommended: - 3.6GHz
Memory: - 10GB
If Hardware wallet for Met-Mask