forked from rsksmart/rskj
-
Notifications
You must be signed in to change notification settings - Fork 0
Module 4 – Interacting with contracts (20 minutes)
herrerameri edited this page Nov 30, 2017
·
6 revisions
Ok, it's the moment to interact with the deployed contract. First of all, we have to know that every interaction is a promise, so asynchronic. Let's open the console:
truffle console
Inside the console, we can get a contract reference.
var helloWorldContract;
HelloWorld.deployed().then(function(contract){ helloWorldContract = contract; });
With this reference let's get the default greeting, calling the getGreeting function.
helloWorldContract.getGreeting.call().then(console.log)
Now let's change the greeting and get it again.
helloWorldContract.setGreeting("Hola mundo inteligente!").then(console.log)
helloWorldContract.getGreeting.call().then(console.log)
Great! :) Next module consists on deploying the same contract but on a RSK node.