Skip to main content

Sending Transactions

  • Chapter
  • First Online:
  • 1130 Accesses

Abstract

After reviewing in the previous chapter how to read data and monitor changes on the network, we will now go into how to write this data by sending transactions. We will start by setting up a development environment for easily playing with smart contracts, then move into a web3-enabled context, and finally go into the details of issuing transactions and monitoring their lifecycle. Once again, we will wrap up with a sample application that puts all the learnings of the chapter together.

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

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.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

Learn about institutional subscriptions

Notes

  1. 1.

    This makes interactions extremely fast, but at the same time a poor representation of how an actual blockchain works. Keep this in mind when testing your application.

  2. 2.

    We will use the --experimental-repl-await flag when starting the console. This allows us to use top-level await in the REPL, which is particularly handy for playing around with promises. Note that more modern versions of node may not require this flag.

  3. 3.

    https://wiki.parity.io/Private-development-chain

  4. 4.

    See https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum for installation instructions. This chapter uses geth version 1.8 for all examples.

  5. 5.

    See https://solidity.readthedocs.io/en/v0.5.3/installing-solidity.html . You can also just run npm install -g solc@0.5 to install a javascript version via npm.

  6. 6.

    See https://0x.org/docs/sol-compiler#types-CompilerOptions

  7. 7.

    https://github.com/ethereum/wiki/wiki/RLP

  8. 8.

    Unfortunately, sometimes the amount of gas estimated will not match due to a bug. In complex transactions, certain versions of ganache estimate a lower gas amount than what is actually required. If you run into an “out of gas” error when running a transaction using the estimated gas, try updating your ganache version or switching to geth or parity in development mode.

  9. 9.

    https://facebook.github.io/create-react-app/

  10. 10.

    You may also eject your react-app, which allows you to manually modify the webpack configuration, in order to remove this limitation. Alternatively, the react-app-rewired package lets you do the same without ejecting.

  11. 11.

    See https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#recommendation-fully-uncontrolled-component-with-a-key

  12. 12.

    https://mycrypto.com/contracts/deploy

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). Sending Transactions. In: Ethereum for Web Developers. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5278-9_5

Download citation

Publish with us

Policies and ethics