Skip to Content
Mastering Blockchain Programming with Solidity
book

Mastering Blockchain Programming with Solidity

by Jitendra Chittoda
August 2019
Intermediate to advanced
486 pages
13h 52m
English
Packt Publishing
Content preview from Mastering Blockchain Programming with Solidity

Avoiding floating pragma

The first line of a Solidity contract always starts with defining the pragma solidity version. This indicates the Solidity compiler version, using which the code should be compiled. The pragma is defined as follows:

// Bad Practicepragma solidity ^0.5.0;

The preceding code signifies that the code should be compiled with any Solidity version starting from 0.5.0 to 0.5.x because the version starts with a ^ (caret sign). For example, if the latest compiler version of Solidity available is 0.5.8, then the contract can be compiled with any compiler version between 0.5.0 and 0.5.8

It is always recommended that pragma should be fixed to the version that you are intending to deploy your contracts with. The contracts should ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Ethereum

Mastering Ethereum

Andreas M. Antonopoulos, Gavin Wood
Complete Cryptocurrency and Blockchain Course | Learn Solidity

Complete Cryptocurrency and Blockchain Course | Learn Solidity

Ravinder Deol, Codestars By Rob Percival, Thomas Wiesner

Publisher Resources

ISBN: 9781839218262Supplemental Content