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
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 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.
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.
- 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.
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.
- 7.
- 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.
- 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.
- 12.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Santiago Palladino
About this chapter
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
DOI: https://doi.org/10.1007/978-1-4842-5278-9_5
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-5277-2
Online ISBN: 978-1-4842-5278-9
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books