Ethereum Based Domain Name System Using Smart Contracts
Total Page:16
File Type:pdf, Size:1020Kb
ETHEREUM BASED DOMAIN NAME SYSTEM USING SMART CONTRACTS (BC-DNS) A Project Presented to the faculty of the Department of Computer Science California State University, Sacramento Submitted in partial satisfaction of the requirements for the degree of MASTER OF SCIENCE in Computer Science by Rodney Pinto SPRING 2019 © 2019 Rodney Pinto ALL RIGHTS RESERVED ii ETHEREUM BASED DOMAIN NAME SYSTEM USING SMART CONTRACTS (BC-DNS) A Project by Rodney Pinto Approved by: __________________________________, Committee Chair Dr. Jun Dai. __________________________________, Second Reader Dr. Xuyu Wang. ____________________________ Date iii Student: Rodney Pinto I certify that this student has met the requirements for format contained in the university format manual, and that this project is suitable for shelving in the library and credit is to be awarded for the project. __________________________, Graduate Coordinator ____________________ Dr. Jinsong Ouyang, Ph.D. Date Department of Computer Science iv Abstract of ETHEREUM BASED DOMAIN NAME SYSTEM USING SMART CONTRACTS (BC-DNS) by Rodney Pinto One of the most critical resources that ensure the current working of the internet is the domain name system (DNS). It is a decentralized, hierarchical naming system that is responsible for translating the human-readable domain name to its associated IP address. The use of DNS thus eliminates the need for humans to remember the IP address of all their favorite websites (such as 172.217.6.68 an IPV4 address for google.com). Despite its widespread use, DNS is vulnerable to various security issues. This project focuses on replicating the basic functionality of the existing DNS on the blockchain and deploying it on a peer to peer network making it completely decentralized and, in the process, make it a bit more secure and reliable by addressing few of the security vulnerabilities of the existing system. _______________________, Committee Chair Dr. Jun Dai. _______________________ Date v DEDICATION To my family Who instilled courage in me to believe anything I dream is possible to achieve To my friends Who helped me to accomplish my dreams Finally, to my almighty God vi ACKNOWLEDGEMENTS This project has helped me widen my technical expertise and it would not have been possible without the assistance of my mentors and guides. It has been an excellent learning experience researching and building this project. The encouragement, support, and guidance received from professor Dr. Jun Dai all along helped me to complete the project successfully. With deep gratitude, I extend my heartfelt thanks to him, for having guided me all along till the completion of my project work. I would also like to thank and appreciate my second reader Dr. Xuyu Wang for his valuable feedbacks and efforts in reviewing the project report. Finally, I would also like to thank all the reviewers for their valuable time and constructive comments. vii TABLE OF CONTENTS Page Dedication .......................................................................................................................... vi Acknowledgements ........................................................................................................... vii List of Tables ...................................................................................................................... x List of Figures .................................................................................................................... xi Chapter 1 INTRODUCTION ....................................................................................................... 1 2 RELATED WORK ...................................................................................................... 4 3 TOOLS AND TECHNOLOGY .................................................................................. 8 3.1 Ethereum Blockchain: .......................................................................................... 8 3.2 Solidity ............................................................................................................... 10 3.3 Remix ................................................................................................................. 10 3.4 Visual studio code .............................................................................................. 11 3.5 Truffle................................................................................................................. 12 3.6 Metamask ........................................................................................................... 12 3.7 IPFS .................................................................................................................... 13 4 SYSTEM DESIGN .................................................................................................... 14 4.1 Decentralized Application (Dapp) Layer: .......................................................... 15 viii 4.2 Blockchain Layer: .............................................................................................. 15 4.3 P2P Network Layer: ........................................................................................... 16 5 IMPLEMENTATION ............................................................................................... 17 5.1 Domain name registration: ................................................................................. 18 5.2 Domain Name lookup: ....................................................................................... 21 5.3 Bid on an existing Domain Name: ..................................................................... 23 5.4 Transfer Domain Name Ownership: .................................................................. 26 5.5 Extending Term of reservation:.......................................................................... 28 5.6 Updating zone file: ............................................................................................. 30 6 EVALUATION ......................................................................................................... 33 6.1 Operational cost of BC-DNS: ............................................................................ 33 6.2 Ethereum platform response time ...................................................................... 34 6.3 Improvements in security. .................................................................................. 36 7 CONCLUSION ......................................................................................................... 38 References ................................................................................................................. 39 ix LIST OF TABLES Tables Page Table 1- Difference In Design Of BNS, ENS, And BC-DNS. ........................................... 6 Table 2 - BC-DNS Transaction Cost ................................................................................ 34 x LIST OF FIGURES Figures Page Figure 1- Difference in bitcoin and Ethereum state handling method. ............................... 9 Figure 2- Remix web browser-based IDE ........................................................................ 11 Figure 3 - Web3 injection using metamask. ..................................................................... 13 Figure 4 - Transaction in metamask .................................................................................. 13 Figure 5 - Ethereum based domain name system using smart contracts architecture. ..... 14 Figure 6 - Basic structure of the BC-DNS smart contract. ............................................... 18 Figure 7- Domain name registration implementation in smart contract. .......................... 20 Figure 8 - User interface for domain name registration. ................................................... 21 Figure 9 - Domain name lookup implementation in smart contract. ................................ 23 Figure 10 - User interface for name lookup. ..................................................................... 23 Figure 11 - Domain name bidding implementation in smart contract. ............................. 25 Figure 12 - User interface for domain name bidding. ....................................................... 25 Figure 13 - Transfer ownership implementation in smart contract. .................................. 27 Figure 14 - User interface for transfer domain name ownership. ..................................... 27 Figure 15 - Extend name reservation implementation in smart contract. ......................... 29 Figure 16 - User interface for extending the term of reservation. .................................... 30 Figure 17 - Update zone file implementation in smart contract. ...................................... 32 Figure 18 - User interface for updating zone file. ............................................................. 32 xi 1 1 INTRODUCTION If you want to access the internet or communicate with a friend over the internet or even want to watch videos of cats, all of this is accomplished by accessing servers that host these services. Every device connected on the Internet must have a unique IP address which can be used by other devices to access its services [1]. It is difficult for humans to remember the IP address of each machine that they are interested in but rather it is easier for humans to associate a friendly readable name with their favorite website. This process of looking up the IP address using a human-readable domain name is accomplished using Domain Name System (DNS) [1]. Without the help of the