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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.