0% found this document useful (0 votes)
93 views6 pages

Building An Ethereum and IPFS-based Decentralized Social Network System

1. The document describes a proposed decentralized social network system built on Ethereum blockchain and IPFS distributed storage. 2. It aims to address issues with centralized social networks like single points of failure, censorship, and data privacy by leveraging the decentralized and immutable nature of blockchain and distributed storage. 3. The proposed system implements a social media application frontend that interacts with users, saves user information on the blockchain via smart contracts, and stores larger files like media in IPFS distributed storage.

Uploaded by

Nda-jiya Suberu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views6 pages

Building An Ethereum and IPFS-based Decentralized Social Network System

1. The document describes a proposed decentralized social network system built on Ethereum blockchain and IPFS distributed storage. 2. It aims to address issues with centralized social networks like single points of failure, censorship, and data privacy by leveraging the decentralized and immutable nature of blockchain and distributed storage. 3. The proposed system implements a social media application frontend that interacts with users, saves user information on the blockchain via smart contracts, and stores larger files like media in IPFS distributed storage.

Uploaded by

Nda-jiya Suberu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

2018 IEEE 24th International Conference on Parallel and Distributed Systems (ICPADS)

Building an Ethereum and IPFS-based Decentralized


Social Network System

Quanqing Xu∗ , Zhiwen Song† , Rick Siow Mong Goh∗ , Yongjun Li‡
∗ Institute
of High Performance Computing, A∗ STAR, Singapore
† School
of Computing, National University of Singapore
‡ School of Computer, Northwestern Polytechnical University

{Xu Quanqing, gohsm}@ihpc.a-star.edu.sg, [email protected], [email protected]

Abstract—Evolvement of blockchain technology has greatly to the government intervention and censorship based on the
changed the network and it makes many applications to be IPs used by the social media servers. Some have raised the
distributed, decentralized without loss of security. Ethereum is point that blockchain technology can be used to tackled some
an open-source blockchain platform that provides a runtime en- of the issues existing in the industry. Blockchain technology
vironment for running smart contracts, which is called Ethereum enables decentralization and security for the social media
Virtual Machine (EVM). Ethereum-based applications are usually
services, which make it available during server downtime or
referred to as Decentralized Applications (DApps), since they
are based on the decentralized EVM, and its smart contracts. even against censorship from governments or Internet Service
Meanwhile, distributed data store also evolves fast with the Providers (ISPs). In this paper, an application is developed to
blockchain technology. Distributed storage develops to reduce the prove the possibility of incorporating blockchain technology
cost of the server side hardware and increase data availability. into social media network to empower it against existing
InterPlanetary File System (IPFS) is a protocol for distributed problems.
storage. IPFS stores immutable data, remove duplication, and
obtain address information for storage nodes to search for files We use social media industry for our experiment to
in the network. Many DApps have been created with the use of demonstrate the capability of blockchain to enhance other
these technologies and one example is to use this design for a existing industry. In this paper, we propose a social media
decentralized Twitter-like system that is resistant to censorship application based on Ethereum platform [5] for recording data
and single point of failure. This paper involves researching the and use InterPlanetary File System (IPFS) [6] as distributed
blockchain technology and implementing a decentralised social data storage service to support a decentralized application. The
network application on the Ethereum private blockchain with social media application uses a frontend webpage UI to interact
the use of smart contract and IPFS. In addition, it examines how with users and save users’ information on blockchain while
blockchain and distributed storage can enable more functionali-
ties of traditional social network systems.
storing the larger file data in the IPFS system. The purpose of
developing this application is to give an brief idea about how
blockchain technology can be used to enhance the existing
I. I NTRODUCTION industry. Relevant smart contracts have been developed to
Since Satoshi Nakamoto introduced Bitcoin to the demonstrate the usage of blockchain to record data including
world [1], blockchain technology has gained increasing popu- the social media messages from the users. This is a system
larity over the past few years. Blockchain begins with the core prototype and further improvement on the system prototype is
technology as a distributed ledger supporting cryptocurrency necessary to make it a holistic application.
exchanges and has shown capability for even other sectors or The remainder of this paper is organized as follows: In
areas as a secure, immutable and reliable platform to record Section II, we give the background of this system. Section III
data and transactions. Social network services, e.g., Facebook describes overall design structure. Section IV shows system
and Twitter, have already become part of our daily life and have deployment and demo. Section V reviews the related work.
a significant number of users across the world. There was a Section VI concludes this paper.
data leakage issue from Facebook to Cambridge Analytica [2],
which brought the security and privacy issues of social media II. BACKGROUND
to a higher level. Many researches and discussions have been
running through to seek appropriate solution to tackle the In this section, we discuss some concepts and tools used
problems existing currently in the social media services. in our system.
Currently, the main problems challenging the social media A. Blockchain
networks [3] include many aspects. Due to the traditional
client-server model, social media clients often suffer from Blockchain is a chain or list of blocks. Each block in
unavailable service during server downtime or when server the blockchain has its own digital signature or cryptographic
faces issues of single point of failure or DDoS attacks. For hash, which contains digital signature of the previous block,
example, Bitcoin blockchain was used to provide decentralized and it has data including state data and transaction data. Each
content trust for docker images to resist potential threats in block is generated within a specific epoch (i.e., period of time)
docker content trust [4]. Besides that, it is well known that and pointed towards its parent in the blockchain, forming a
social media services are not available in some countries due long chain of hashed blocks. Ethereum is a blockchain-based

978-1-5386-7308-9/18/$31.00 ©2018 IEEE 986


DOI 10.1109/ICPADS.2018.00131
decentralized platform featuring smart contract functionali- trusting individuals without an authorized intermediary. This
ty [7]. Ethereum supports a variant of Nakamoto consensus via system aims to research on the relevant technologies on the
transaction-based state transitions. It supports stateful contracts Blockchain 2.0 platform and apply the knowledge of the
in which values can persist on the blockchain to be used in Ethereum blokchain and smart contract into solving problems
multiple invocations. and finding solutions in the real world situations. Blockchain
has been seen as great possibility in enhancing the current
B. Ethereum Virtual Machine (EVM) social media network [10]. Established identities, lesser fake
The Ethereum Virtual Machine is the component on the content, resistant against censorship are all properties that
Ethereum platform that handles the deployment and execution social media network desires and blockchain technology can
of the smart contract. The EVM is a quasi-Turing complete bring these merits to the current social media network and
state machine as all transactions on the EVM involve limit improve it. This task is to build a decentralized social network
commands and change of the state values due to the gas application based on Ethereum private blockchain with the use
limit given to the contract execution. EVM has a stack-based of InterPlanetary File System as the distributed storage service
architecture, involving ROM, memory and account storage. and examine how the blockchain technology can improve the
They are used to store the state values as well as the contract current social media system.
program bytecode. EVM executes its own bytecode instruction
set, which can be compiled from a higher level smart contract B. Architecture Design
languages such as Solidity and Serpent [8]. When a transaction
Each user will have one separate individual User Smart
involving state changes from contract functions, an EVM will
Contract (See Appendix B) when he/she registers his/her
be instantiated to load the program bytecode and execute the
accounts with his/her wallet/account address and this User
function and states will be updated upon successful execution
address will be sent to a standalone AccountManager (See
of the transaction.
Appendix A) for record purpose. Each account will be bind
C. Smart Contract with one social media User smart contract only and this map-
ping will be stored in AccountManager contract so that later
A smart contract is a piece of program which runs on the user will not create many instances of User. After they have
blockchain and its execution is examined and enforced by the registered their account, they can later use their own account
relevant consensus protocol. Smart contract is a special proto- addresses and passphrases to login and retrieve the respective
col designed to contribute, verify or implement the negotiation User contracts they own. This forms a structure where each
or performance of the contract [9]. Smart contracts allows user client only communicates with its own User contract
automatic execution of transactions without any supervision (see Figure 1) and User contracts interact with each other
from third parties. Users invoke a smart contract in present with themselves to register and bind with the AccountManager
cryptocurrencies by sending transactions to the contract ad- contract. Figure 1 shows a brief overview of the designed
dress deployed on the blockchain. Transactions sent by the architecture. The system is formed with User smart contract
user to the blockchain will cause a state change that will be with communicates with its own user client, registers with
reflected in the change of account balance or the state value AccountManager and interacts with other User smart contract
of the contract. These transaction calls to the smart contract for the social media activities.
are traceable and immutable, and they can be verified by any
participants in the blockchain network.

D. InterPlanetary File System (IPFS)


IPFS is a protocol designed to create a content-addressable,
P2P method of storing and sharing hypermedia in a distributed hƐĞƌĐůŝĞŶƚ
file system. IPFS attempts to address the deficiencies of the
client-server model and HTTP web through a novel P2P file hƐĞƌƐŵĂƌƚ
sharing system. This system is a synthesis of several new and ĐŽŶƚƌĂĐƚ
existing innovations. It combines a self-certifying namespace, ĐĐŽƵŶƚDĂŶĂŐĞƌ
an incentivized block exchange, and a distributed hash table ƐŵĂƌƚĐŽŶƚƌĂĐƚ
(DHT). IPFS has no single point of failure, and nodes do not
need to trust each other not to tamper with data in transit. The
IPFS can be accessed via many approaches such as HTTP.
After local file is transmitted to the IPFS system, it is available Fig. 1. Architecture Design
to the entire network and can be traced and identified by
its content hash. In this case, IPFS offers a high-throughput The entire system forms a three level architecture where
content-addressed block storage model to provide support for FrontEnd UI is responsible for interacting with users, and
many use cases. web3 library and IPFS library are responsible for API calls
from frontend client to the backend blockchain and the IPFS
III. OVERALL D ESIGN S TRUCTURE storage. Figure 2 shows a top down view of the structure.
The top level service, which is the frontend UI, is in charge of
A. System Overview
receiving the user’s input, including commands and tweet data,
Blockchain 2.0 technology (i.e., smart contract) makes and passing them to the relevant web3 library and IPFS library.
it possible to have a distributed P2P network between non- The web3 library will then interact with the relevant underlying

987
blockchain system for function call, contract deployment and When the client wants to update the tweets from the follows
fund transfer. IPFS library is triggered when user posts tweet (see Figure 5), it will first retrieve all the tweets from the User
with picture or video that is stored in IPFS data storage, and contract, currently Solidity does not support return of complex
receives an IPFS hash in return. data structure including array and struct. In this case the logic
for retrieval of tweets from all the follows is handled in the
frontend. Frontend client will retrieve the follow address list
C. Application design and request for the latest tweet for each of the follow.
The whole system consists of three main components, hƐĞƌŽŶƚƌĂĐƚ
namely backend private blockchain, IPFS storage and frontend
web UI. When client starts and user attempts to register or
login as shown in Figure 3, it will first check if current account Ϯ͘ZĞƚƵƌŶƚǁĞĞƚƐ
address has already created a User contract by calling function ĚĂƚĂ
from AccountManager contract, if a valid contract address is
returned, it will take it as a valid User contract address, else ϯ͘^ĞŶĚ/W&^
ϭ͘'ĞƚůĂƚĞƐƚ ƌĞƋƵĞƐƚ ϰ͘ZĞƚƌŝĞǀĞ
a 0x0 address is returned, meaning that the current account ƚǁĞĞƚƐĨƌŽŵ
has not initialized a User account in the blockchain. In this ƉŝĐƚƵƌĞ
ĨŽůůŽǁƐ ĨƌŽŵ/W&^
case, client frontend will send a transaction to the blockchain
to deploy a User contract for the current account.

hƐĞƌŽŶƚƌĂĐƚ ĐĐŽƵŶƚDĂŶŐĞƌŽŶƚƌĂĐƚ
Fig. 5. Workflow for update

D. Smart Contract Design


ϭ͘ŚĞĐŬŝĨhƐĞƌ
ĞdžƐŝƚƐ User contract as shown in Figure 6 consists of two arrays:
ϯ͘/ĨŶŽƚĞdžŝƐƚƐ͕ Ϯ͘ZĞƚƵƌŶhƐĞƌ one is for the list of people that this contract is following
ĐƌĞĂƚĞĂ ĂĚĚƌĞƐƐŝĨ or listening to, and the other is for the list of tweets posted
ŶĞǁhƐĞƌ ĞdžŝƐƚƐ
ĐŽŶƚƌĂĐƚ by the user. A tweet consists of three components, namely
tweet comment, IPFS hash and timestamp. Tweet comment is
the comment in type string and IPFS hash is the hash string
of the IPFS path when the pictures or videos are sent to the
IPFS for storage. The user follows others and unfollows others
Fig. 3. Workflow for register/login via addFollow and deleteFollow functions, and he/she can
post tweets and get tweets via postTweet and getLatestTweet
When posting the tweet from client (see Figure 4), if a functions respectively.
picture or a video is uploaded together with the tweet, the
frontend client will load the picture or video into byte array hƐĞƌŽŶƚƌĂĐƚ
and then the client will send the picture or video byte data to
IPFS storage endpoint configured in the system and retrieve &ŽůůŽǁ͗ĂĚĚƌĞƐƐ΀΁ ƚǁĞĞƚƐ͗dǁĞĞƚ΀΁
the corresponding IPFS hash in return. This hash is used to
retrieve the picture or video data afterwards. After that, the
client will send the tweet comment, IPFS hash and current ĂĚĚ&ŽůůŽǁ;Ϳ ƉŽƐƚdǁĞĞƚ;Ϳ
timestamp to the User contract via a transaction in postTweet
function in the User contract and in this case after miner has ĚĞůĞƚĞ&ŽůůŽǁ;Ϳ
included this transaction in a block, it will be finalized and the ŐĞƚ>ĂƚĞƐƚdǁĞĞƚ;Ϳ
tweet will be stored in the User contract. ĐŚĞĐŬ/Ĩ&ŽůůŽǁ;Ϳ
ŐĞƚEƵŵdǁĞĞƚ;Ϳ
hƐĞƌŽŶƚƌĂĐƚ ŐĞƚEƵŵ&ŽůůŽǁ;Ϳ

ŐĞƚ&ŽůůŽǁĚĚƌĞƐƐ;Ϳ

ϭ͘^ĞŶĚƉŝĐƚƵƌĞ
ƚŽ/W&^ Fig. 6. User smart contract
ϯ͘^ĞŶĚƚǁĞĞƚ Ϯ͘ZĞƚƵƌŶ/W&^
ƚƌĂŶƐĂĐƚŝŽŶƐ ŚĂƐŚĨŽƌ The User contract also includes functions for checking the
ƚŚĞƉŝĐƚƵƌĞ status of the follows and their tweets. Currently, user can get
the number of the follows via getNumFollow function and get
the follow’s address via getFollowAddress function. Regarding
the tweets, users can always check their number of tweet
by calling getNumTweet function. So far, the functionalities
Fig. 4. Workflow for posting tweet proposed for user is still at a very simple stage, later more

988
&ƌŽŶƚŶĚ h/;ZĞĂĐƚ:ƐͿ
ZĞŐŝƐƚĞƌͬůŽŐŝŶͬ dƌĂŶƐĂĐƚŝŽŶ ^ĂǀĞĨŝůĞͬ ZĞƚƵƌŶ/W&^ŚĂƐŚͬ
ƉŽƐƚƚǁĞĞƚ ƌĞƐƵůƚͬƌĞĐĞŝƉƚ ƌĞƚƌŝĞǀĞĨŝůĞ ĨŝůĞďLJƚĞĐŽŶƚĞŶƚ

tĞďϯ>ŝďƌĂƌLJ /W&^>ŝďƌĂƌLJ

ƐĞŶĚdƌĂŶƐĂĐƚŝŽŶ /W&^ƌĞƋƵĞƐƚ

ĐĐŽƵŶƚ
hƐĞƌ DĂŶĂŐĞƌ /W&^^ƚŽƌĂŐĞ

ƚŚĞƌĞƵŵ sŝƌƚƵĂůDĂĐŚŝŶĞ

ƚŚĞƌĞƵŵ ůŽĐŬĐŚĂŝŶ

Fig. 2. System Architecture

functionalities will be added, including commenting for the retrieve the latest tweet from the ones the user is following.
tweet, retweeting, reporting and “Like” functions. All the tweets and followers addresses will be stored in their
User smart contract.
As shown in Figure 7, AccountManager contract includes
a mapping data structure from client account address to User
contract address. This is to ensure that each client account
is only created once, and to avoid any problems caused.
AccountManager includes register and retrieve functions such
that each User contract is able to bind its address with account
address and be retrieved for later reusage. When a User
contract is created, the client will call the register function
such that the newly created User contract address and current
client contract address are stored in the mapping. Later when
login, after authentication, the client will be able to retrieve
the User contract address by calling Retrieve function.

ĐĐŽƵŶƚDĂŶĂŐĞƌ ŽŶƚƌĂĐƚ
Fig. 8. System Demo

hƐĞƌƐ͗ŵĂƉƉŝŶŐ;ĂĚĚƌĞƐƐсхĂĚĚƌĞƐƐͿ
After successful login or registration, a contract address
will be displayed and status will be updated to be successfully
login. When the users post tweets to the User contract, they can
ZĞŐŝƐƚĞƌ;Ϳ ZĞƚƌŝĞǀĞ;Ϳ
send pictures together with their tweets, and pictures are sent
to IPFS file storage and stored as IPFS hash in the contract.
After that, when the user wants to retrieve the tweet from their
Fig. 7. AccountManager contract follows, they can click the Update button and when retrieving
the tweets, the picture will be fetched in the frontend React
application from the IPFS storage using the hash stored in the
E. UI Design contract.
We use ReactJs as the frontend framework to call relevant
Web3 API so as to interact with the private blockchain running IV. S YSTEM D EPLOYMENT AND D EMO
on machines. This entire social media DApp follows a similar A. Set up Private blockchain
style as Twitter where users can follow/unfollow others, post
tweets and receive the tweets from the ones they are following. Currently Ethereum provides three types of Ethereum
For simplification purpose, in this simple system, we only clients, namely cpp-ethereum, go-ethereum and py-ethereum.

989
Any of the clients is able to be used in initializing a private D. Configure the frontend client
blockchain. In the example, go-ethereum is used for demo
purpose. To create an Ethereum private blockchain, we first We need to set certain environmental variables before the
install the Ethereum client, geth using the following command start of the program, which include the IPFS endpoint, Ethre-
(or any other commands depends on the OS used, here the rum endpoint, contract Application Binary Interface (ABI),
command provided is for Linux system, for Mac users, Geth AccountManager contract address and User contract bytecode
can be simply installed via Homebrew). A genesis block is (if modified). We set the AccountManager contract address in
shown in Figure 9. the frontend source code as follows:
ManagerContract.options.address =
^ ’0xBF35ebb108a70A092CF63F4ae1F1C552edC5F23e’;
FRQILJ^ We set the IPFS configuration in ipfs.js that depends on
FKDLQ,G the current configuration. Both public free space and private
KRPHVWHDG%ORFN local configuration are provided, switch if needed.
HLS%ORFN
FRQVW ,3)6 UHTXLUH
LSIVDSL

HLS%ORFN FRQVW LSIV QHZ,3)6 ^KRVW
LSIVLQIXUDLR
SRUWSURWRFRO

KWWSV
` 
` UXQZLWKORFDOGDHPRQ
GLIILFXOW\[ FRQVW LSIV$SL UHTXLUH þLSIVDSLÿ 
FRQVW LSIV QHZLSIV$SL þORFDOKRVWÿþÿ^SURWRFROþKWWSÿ` 
JDV/LPLW[VHWWKLVUHDOO\KLJKIRUWHVWLQJ
DOORF^` Fig. 10. IPFS configuration
`

Fig. 9. Genesis block E. Start the frontend UI


We start the frontend client via the command: npm start.
We can initialize our private blockchain with the genesis Then the frontend webpage is accessible at localhost:3000.
block using the following command: geth -datadir ./miner1
init genesis.json. Note that datadir means the location of
the working directory. We can start the Ethereum private V. R ELATED W ORK
blockchain as follows:
A number of previous and current works have been work-
geth –networkid 42 –datadir “∼/miner1” –rpc – ing on developing decentralized applications with the use of
rpcport “8545” –ipcpath “∼/Library/Ethereum/geth.ipc” IPFS or Swarm as distributed data store. We will discuss
–rpcapi=“db,eth,net,web3,personal,web3” –rpccorsdomain several applications that make use of these technologies and
“*” also work that we have been referring to for insights on
development of DApps.
Note that datadir locates where the working directo-
ry is, rpc port can be tuned if 8545 is in used, it is
used to as an API port to communicate with the frontend A. AKASHA project
web3 library. ipcpath is different for different OS, where
“∼/Library/Ethereum/geth.ipc” is for Mac user while for Linux Akasha [11] is another social media application devel-
user the path will be “∼/.ethereum/geth.ipc”. oped using Ethereum and IPFS on dedicated blockchain.
The Akasha team has found a suitable technology stack to
implement a decentralized and distributed Internet after a lot
B. Set up the frontend web UI of study and prototyping work. The cornerstones of the Akasha
stack are IPFS and Ethereum, augmented by React with Redux,
In the source code folder, currently no dependencies for Node.js, and Electron. The Akasha project provides a guideline
the javascript library is installed. It is necessary to install the of how social media applications can be built with the merits
relevant dependencies so that the program can run normally. of the blockchain system.
To install the dependencies, in the source folder for the social
media application, we run a command: npm install.
B. DesignCourse

C. Deploy the AccountManager Contract They have provided detailed explanation on how to build a
decentralized application with the use of Ethereum platform,
Since AccountManager contract is a permanent contract web3.js library and ReactJs as the frontend. This provides
used for logging the User contract address, it is initialized a brief understanding of how these components can come
separately. Here we can initialize it either with Mist client, together to build a successful DApp. Meanwhile, they also
Remix Web tool, Geth javascript console or any other means. provide explanation for other concepts including IPFS system
Details are not listed here. After setting up the AccountMan- which is currently used in the social media application in this
ager contract, we can retrieve its contract address for later use. paper. They provide a lot of insights and tips on setting up a
The account address can be seen from the Mist client if it is private blockchain and make the entire DApp works at a ready
created from Mist client or Geth javascript console. state.

990
VI. C ONCLUSIONS AND F UTURE W ORK ’”ƒ‰ƒ •‘Ž‹†‹–› ɋɥŜɫŜɩɨŚ

…‘–”ƒ…– •‡”Ƈ
This system prototype is done for the purpose of system ƒ††”‡••ƃƄˆ‘ŽŽ‘™Ś
ƒ††”‡••‘™‡”Ś
implementation according to the knowledge learnt through the ™‡‡–ƃƄ–™‡‡–•Ś
•–”—…– ™‡‡–Ƈ
research. The whole system still remains on the prototype or •–”‹‰…‘‡–Ś
proof-of-concept stage and should not be used for production •–”‹‰‹’ˆ• ƒ•ŠŚ
•–”‹‰–‹‡–ƒ’Ś
purpose. This system prototype has demonstrated the idea ƈ

of using IPFS and smart contracts together on the Ethereum ‘†‹ˆ‹‡” ‘Ž›”‡ƒ–‘”ſƀƇ
blockchain and further work needs to be done to examine the ”‡“—‹”‡ſ•‰Ŝ•‡†‡” ʰʰ‘™‡”ƀŚ
ɏŚ
performance and improve the smart contract based on the real ƈ

needs of the social media network. …‘•–”—…–‘”ſƀ’—„Ž‹… ’ƒ›ƒ„އ Ƈ


‘™‡”ʰ•‰Ŝ•‡†‡”Ś
ƈ
It is hard to gather enough surveys or feedbacks for
requirements from the users of social media applications. ˆ—…–‹‘ ’‘•–™‡‡–ſ•–”‹‰ɏ…‘‡–ř•–”‹‰ ɏ‹’ˆ• ƒ•Šř•–”‹‰ɏ–‹‡•–ƒ’ƀ
’—„Ž‹… ‘Ž›”‡ƒ–‘” Ƈ
Functionalities are based on the common usages of the public –™‡‡–•Ŝ’—•Šſ™‡‡–ſɏ…‘‡–řɏ‹’ˆ• ƒ•Šřɏ–‹‡•–ƒ’ƀƀŚ
ƈ
social media applications and more requirement analysis need
ˆ—…–‹‘ ‰‡–ƒ–‡•–™‡‡–ſƀ’—„Ž‹… …‘•–ƒ– ”‡–—”• ſ•–”‹‰ř•–”‹‰ř•–”‹‰ƀƇ
to be done for the completeness of the system. Currently ‹ˆ ſ–™‡‡–•Ŝއ‰–Š ʴɥƀƇ
solidity does not support return of complex data type such ™‡‡–‡‘”› Žƒ–‡•–ʰ–™‡‡–•ƃ–™‡‡–•Ŝއ‰–Š Ş ɨƄŚ
”‡–—” ſŽƒ–‡•–Ŝ…‘‡–řŽƒ–‡•–Ŝ‹’ˆ• ƒ•ŠřŽƒ–‡•–Ŝ–‹‡–ƒ’ƀŚ
as struct, it only supports returning of tuples of basic data ƈ‡Ž•‡ Ƈ
”‡–—” ſɐɐřɐɐřɐɐƀŚ
types. User contract needs to be improved in the future if ƈ
ƈ
the later version of solidity provides these functionalities. The
User Interface (UI) design is remained on a basic level since ˆ—…–‹‘ ‰‡–—™‡‡–•ſƀ’—„Ž‹… …‘•–ƒ– ”‡–—”• ſ—‹–ƀƇ
”‡–—” –™‡‡–•Ŝއ‰–ŠŚ
this is just a prototype application, more work needs to be ƈ

done to beautify the UI of the application and re-arrange the ˆ—…–‹‘ ƒ†† ‘ŽŽ‘™ſƒ††”‡••ɏˆ‘ŽŽ‘™‹‰ƀ’—„Ž‹… ‘Ž›”‡ƒ–‘” Ƈ
ˆ‘ŽŽ‘™Ŝ’—•Šſɏˆ‘ŽŽ‘™‹‰ƀŚ
components on the web page to make it more logical. ƈ

ˆ—…–‹‘ †‡Ž‡–‡ ‘ŽŽ‘™ſƒ††”‡••ɏ—ˆ‘ŽŽ‘™ƀ’—„Ž‹… ‘Ž›”‡ƒ–‘” Ƈ


ˆ‘” ſ—‹– ‹ʰɥŚ‹ʳˆ‘ŽŽ‘™Ŝއ‰–ŠŚ‹ʫʫƀƇ
A PPENDIX ‹ˆ ſˆ‘ŽŽ‘™ƃ‹Ƅʰʰɏ—ˆ‘ŽŽ‘™ƀƇ
™Š‹Ž‡ ſ‹ ʳˆ‘ŽŽ‘™Ŝއ‰–ŠŞɨ ƀƇ
A. Account Manager Smart Contract ˆ‘ŽŽ‘™ƃ‹Ƅʰˆ‘ŽŽ‘™ƃ‹ʫɨƄŚ
‹ʫʫŚ
ƈ
Account manager smart contract’s source code is shown in ˆ‘ŽŽ‘™Ŝއ‰–ŠŞŞŚ
ƈ
Figure 11. ƈ
ƈ

’”ƒ‰ƒ •‘Ž‹†‹–› ɋɥŜɫŜɩɨŚ ˆ—…–‹‘ …Ї… ˆ ‘ŽŽ‘™‹‰ſƒ††”‡••ɏˆ‘ŽŽ‘™ƀ’—„Ž‹… …‘•–ƒ– ”‡–—”• ſ„‘‘ŽƀƇ


ˆ‘” ſ—‹– ‹ʰɥŚ‹ʳˆ‘ŽŽ‘™Ŝއ‰–ŠŚ‹ʫʫƀƇ
…‘–”ƒ…– ‘–”ƒ…–ƒƒ‰‡” Ƈ ‹ˆ ſˆ‘ŽŽ‘™ƃ‹Ƅʰʰɏˆ‘ŽŽ‘™ƀƇ
ƒ’’‹‰ ſƒ††”‡••ʰʴƒ††”‡••ƀ—•‡”•Ś ”‡–—” –”—‡Ś
ƈ
ƒ††”‡••‘™‡”Ś ƈ
”‡–—” ˆƒŽ•‡Ś
…‘•–”—…–‘”ſƀ’—„Ž‹… Ƈ ƈ
‘™‡”ʰ•‰Ŝ•‡†‡”Ś
ƈ ˆ—…–‹‘ ‰‡–— ‘ŽŽ‘™ſƀ…‘•–ƒ– ’—„Ž‹… ”‡–—”• ſ—‹–ƀƇ
”‡–—” ˆ‘ŽŽ‘™Ŝއ‰–ŠŚ
ˆ—…–‹‘ ‡‰‹•–‡”ſƒ††”‡••ɏƒ††”‡••ƀ’—„Ž‹… Ƈ ƈ
—•‡”•ƃ•‰Ŝ•‡†‡”Ƅʰɏƒ††”‡••Ś
ƈ ˆ—…–‹‘ ‰‡– ‘ŽŽ‘™††”‡••ſ—‹– ‹†šƀ…‘•–ƒ– ’—„Ž‹… ”‡–—”• ſƒ††”‡••ƀƇ
”‡“—‹”‡ſ‹†š ʳˆ‘ŽŽ‘™Ŝއ‰–ŠƀŚ
ˆ—…–‹‘ ‡–”‹‡˜‡ſƀ’—„Ž‹… …‘•–ƒ– ”‡–—”• ſƒ††”‡••ƀƇ ”‡–—” ˆ‘ŽŽ‘™ƃ‹†šƄŚ
”‡–—” —•‡”•ƃ•‰Ŝ•‡†‡”ƄŚ ƈ
ƈ
ƈ ˆ—…–‹‘ſƀ’—„Ž‹… ’ƒ›ƒ„އ Ƈ
ƈ
ƈ
Fig. 11. Account manager smart contract
Fig. 12. User smart contract

B. User Smart Contract


User smart contract’s source code is shown in Figure 12. [5] (2018) Ethereum project. [Online]. Available: http-
s://www.ethereum.org/
[6] (2018) Interplanetary file system. [Online]. Available: https://ipfs.io/
R EFERENCES [7] Q. Xu, K. M. M. Aung, Y. Zhu, and K. L. Yong, “A blockchain-based
[1] S. Nakamoto, “Bitcoin: A peer-to-peer electronic cash system,” 2008. storage system for data analytics in the internet of things,” in New
Advances in the Internet of Things. Springer, 2018, pp. 119–138.
[2] (2018) Facebook Cambridge Analytica da-
ta scandal. [Online]. Available: http- [8] G. W. Andreas M. Antonopoulos, Mastering Ethereum:
s://en.wikipedia.org/wiki/Facebook%E2%80%93Cambridge Analytica da- Building Smart Contracts and Dapps, 2018. [Online]. Available:
ta scandal https://github.com/ethereumbook/ethereumbook
[3] Y. Li, Z. Zhang, Y. Peng, H. Yin, and Q. Xu, “Matching user accounts [9] A. Tar. (July 26 2018) Smart contracts, explained. [Online]. Available:
based on user generated content across social networks,” Future Gen- https://cointelegraph.com/explained/smart-contracts-explained
eration Computer Systems, vol. 83, pp. 104–115, 2018. [10] Y. Li, Y. Peng, W. Ji, Z. Zhang, and Q. Xu, “User identification based
[4] Q. Xu, C. Jin, M. F. B. M. Rasid, B. Veeravalli, and K. M. M. Aung, on display names across online social networks,” IEEE Access, vol. 5,
“Blockchain-based decentralized content trust for docker images,” Mul- pp. 17 342–17 353, 2017.
timedia Tools and Applications, pp. 1–26, 2017. [11] (2018) Akasha project. [Online]. Available: https://akasha.world/

991

You might also like