Solidity Programming Essentials A beginner's guide to build smart contracts for Ethereum and blockchain Ritesh Modi BIRMINGHAM - MUMBAI Solidity Programming Essentials Copyright © 2018 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Commissioning Editor: Merint Methew Acquisition Editor: Sandeep Mishra Content Development Editor: Priyanka Sawant Technical Editor: Vibhuti Gawde Copy Editor: Safis Editing Project Coordinator: Vaidehi Sawant Proofreader: Safis Editing Indexer: Rekha Nair Graphics: Jason Monteiro Production Coordinator: Deepika Naik First published: April 2018 Production reference: 1180418 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78883-138-3 www.packtpub.com mapt.io Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website. Why subscribe? Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals Improve your learning with Skill Plans built especially for you Get a free eBook or video every month Mapt is fully searchable Copy and paste, print, and bookmark content PacktPub.com Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at and as a print book customer, www.PacktPub.com you are entitled to a discount on the eBook copy. Get in touch with us at for more details. [email protected] At , you can also read a collection of free technical www.PacktPub.com articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks. Contributors About the author Ritesh Modi is an ex Microsoft senior technology evangelist and Microsoft regional lead. He has worked on Ethereum and Solidity, extensively helping and advising companies. Ritesh is a regular speaker on blockchain and Solidity at conferences and local meetups. He is an architect, evangelist, speaker, and a known leader for his contributions toward blockchain, data centers, Azure Bots, cognitive services, DevOps, Artificial Intelligence, and automation. He is the author of five books. I have personally grown into a person who has more patience, perseverance, and tenacity while writing this book. I must thank the people who mean the world to me. I am talking about my mother, Bimla Modi, my wife, Sangeeta Modi, and my daughter, Avni Modi. I also thank the Packt team for their support. About the reviewer Pablo Ruiz has been involved in the creation of dozens of tech products over the past 12 years, working with the latest, cutting- edge technologies. In 2008, he became deeply involved in the creation of mobile games and applications; later on, he participated in many projects as an advisor or investor in the digital space. During 2015/2016, he was a director at one of the top venture capital firms in Latin America, where he built their Fintech ecosystem from the ground up. In 2018, after actively working on several ICOs, he joined Polymath as their VP of engineering to lead the development of the first Ethereum-based platform for issuing regulatory-compliant security tokens.