Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Blockchain Quick Reference

You're reading from  Blockchain Quick Reference

Product type Book
Published in Aug 2018
Publisher Packt
ISBN-13 9781788995788
Pages 350 pages
Edition 1st Edition
Languages
Concepts
Authors (4):
Mariko Amekodommo Mariko Amekodommo
Brenn Hill Brenn Hill
Profile icon Brenn Hill
Samanyu Chopra Samanyu Chopra
Profile icon Samanyu Chopra
Paul Valencourt Paul Valencourt
Profile icon Paul Valencourt
View More author details

Table of Contents (24) Chapters

Preface Blockchain 101 Components and Structure of Blockchain Decentralization Versus Distributed Systems Cryptography and Mechanics Behind Blockchain Bitcoin Altcoins Achieving Consensus Advanced Blockchain Concepts Cryptocurrency Wallets Alternate Blockchains Hyperledger and Enterprise Blockchains Ethereum 101 Solidity 101 Smart Contracts Ethereum Development Ethereum Accounts and Ether Tokens Decentralized Applications Mining ICO 101 Creating Your Own Currency Scalability and Other Challenges Future of Blockchain Other Books You May Enjoy

Solidity 101

In the previous chapters, we learned about Ethereum in detail. We read about the Ethereum network, clients, gas, Ethereum virtual machine, and other elements of the Ethereum blockchain. One of the interesting facts about Ethereum is that anyone can create their own blockchain using Ethereum.

Ethereum runs smart contracts on its platform; these are applications that use blockchain technology to perform the required action, enabling users to create their own blockchain and also issue their own alternative cryptocurrency. This is made possible by coding in Solidity, which is a contract-oriented programming language used for writing smart contracts that are to be executed on the Ethereum blockchain and perform the programmed tasks.

Solidity is a statically typed programming language that runs on the Ethereum virtual machine. It is influenced by C++, Python, and JavaScript...

Basics of Solidity

Solidity is not the only language to work on Ethereum smart contracts; prior to solidity, there were other languages that were not as successful. Here is a brief list of languages currently (as of August 2018) compatible with Ethereum:

  • Mutan: Inspired from Golang and deprecated in March 2015.
  • LLL: Short for lisp-like language. While it is still supported, it is rarely used.
  • Serpent: While this language is similar to Python, it is no longer recommended for use.
  • Solidity: The fourth language introduced by the Ethereum foundation, and so far the most successful language for developing smart contracts. It is the most documented, stable, and has a large community support.
  • Vyper: Newly introduced, much simpler and easier than Solidity, although it does not have much community support yet. It is influenced by Python.

Solidity is also known as a contract-oriented...

Programming in Solidity

In this section, we will be discussing the structure and elements of a Solidity source file; we will discuss the layout, structure, data types, its types, units, controls, expressions, and other aspects of Solidity. The format extension of a solidity file is .sol.

Laying out a Solidity file

Solidity is going through active development and has lot of regular changes and suggestions from a huge community; hence, it is important to specify the version of a solidity file at the start of the source file, to avoid any conflict. This is achieved by the Pragma version. This is defined at the start of the solidity file so that any person looking to run the file knows about the previous version. Take a look at...

Summary

In this chapter, we discussed Solidity in detail, we read about the compiler, and we did a detailed study programming in solidity that included studying about the layout of a solidity file, the structure of a contract, and the types of values and reference. We also learned about mapping.

In the next chapter, we will apply our new knowledge from this chapter to develop an actual contract and deploy the same on a test network.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Blockchain Quick Reference
Published in: Aug 2018 Publisher: Packt ISBN-13: 9781788995788
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}