Building DApps and APIs using Truffle
Truffle provides a contract abstract that can be used in Node.js and in a browser. This allows us to create distributed applications right from the Truffle project. This abstract provides some additional features such as promises, default values, and returning logs and receipts from each transaction. In this recipe, you will learn how to create apps using Truffle.
Getting ready
To try this recipe, you need to have Truffle installed on your system. Your application needs to connect to a running Ethereum network to perform read and write operations. So, ensure you have a working Ethereum client in place.
How to do it...
- Truffle provides a truffle-contract module, which creates the smart contract abstract. It is distributed via npm; run the following command to install it:
npm install truffle-contract
- Import the browser module provided by Truffle for your frontend application:
<script type="text/javascript" src="web3.js"></script> <script type...