Skip to main content

A Crash Course on Smart Contracts

  • Chapter
  • First Online:
Ethereum for Web Developers
  • 1177 Accesses

Abstract

Smart contracts are the key component in Ethereum. They hold the logic to be executed on the network, keep track of their own state, and can interact with other smart contracts as well. However, they have some limitations, such as limited computation per transaction and expensive storage costs. They also cannot initiate new transactions – they depend on external accounts to trigger them. And since they run on the Ethereum network, they cannot directly interact with anything outside it. In this chapter, we will

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Nick Szabo, “Formalizing and Securing Relationships on Public Networks,” 1997.

  2. 2.

    In Chapters 7 and 8, we will review advanced techniques, such as meta transactions and state channels, that rely on message signatures.

  3. 3.

    See https://github.com/OpenZeppelin/openzeppelin-sdk for a development framework that provides out-of-the-box upgradeability for smart contracts. We will also briefly touch contract upgrades in Chapter 7.

  4. 4.

    Technically, these functions are not implemented as assembly opcodes, but as precompiled contracts with reduced execution cost.

  5. 5.

    http://hackingdistributed.com/2016/06/18/analysis-of-the-dao-exploit/

  6. 6.

    https://ethgasstation.info/

  7. 7.

    However, as we will see later, not all nodes actually persist all historical data, so this feature may not always be available.

  8. 8.

    https://solidity.readthedocs.io/

  9. 9.

    https://consensys.github.io/smart-contract-best-practices/

  10. 10.

    https://remix.ethereum.org/

  11. 11.

    Solidity uses the same notation as npm for specifying version restrictions. See https://docs.npmjs.com/misc/semver for more info.

  12. 12.

    “I call it my billion-dollar mistake. It was the invention of the null reference in 1965.” Tony Hoare, QCon London, 2009.

  13. 13.

    https://github.com/OpenZeppelin/openzeppelin-solidity/blob/v2.0.0/contracts/math/SafeMath.sol

  14. 14.

    https://eips.ethereum.org/EIPS/eip-20

  15. 15.

    https://github.com/OpenZeppelin/openzeppelin-solidity

  16. 16.

    At the time of this writing, EIP 1047 is in draft state, and includes a proposal for JSON metadata to be associated with a token.

  17. 17.

    We typically use the term off-chain to refer to actions that occur outside the Ethereum network. This is not inside a smart contract or as part of a transaction, but in a front-end application or a script interacting with the blockchain.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Santiago Palladino

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Palladino, S. (2019). A Crash Course on Smart Contracts. In: Ethereum for Web Developers. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5278-9_3

Download citation

Publish with us

Policies and ethics