Interacting with smart contracts

To interact with your smart contract that resides in Ethereum blockchain, execute this command inside your Truffle project directory:

$ truffle console

Then, in the truffle console prompt, execute the following command:

truffle(development)> Donation.deployed().then(function(instance) { return instance.useless_variable.call(); });'Donation string'

If you are confused about then, the Truffle console uses the concept of callback, on which accessing the smart contract object is executed asynchronously. This statement in the Truffle console returns immediately before the callback is being executed. In the callback function, you will accept the smart contract instance as an instance parameter. Then, we can access ...

Get Hands-On Blockchain for Python Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.