[Ethereum] modify truffle console command to execute function on ropsten deployed contract thru geth

go-ethereumropstentestrpc-to-ropstentruffle

There are a couple of commands, reproduced below, which I've used successfully in the truffle console, executing on testrpc, which work and elicit the responses that I expect.

How can I change them to make them applicable to ropsten? How can I send them through the geth console?

The contract I'm trying to interact with was deployed to the ropsten testnet in this transaction.

The code of the contract can be found on my GitHub.

The first command I want to use is to increase the iteration variable:

Incrementer.deployed().then(function(instance) {
      meta = instance;
      return meta.increment(1);
})

The next thing I want to do is verify the result:

Incrementer.deployed().then(function(instance) { 
    meta = instance; 
    return meta.getIteration(); 
})

At this point I've figured out that I have to use the ABI, but that's as far as I got.

How can I transmogrify those commands into something that I can send through the geth console into the ropsten testnet?

Best Answer

Is the Geth instance running on Ropsten using the default rpc port, 8545? If you haven't specified it as a command line argument then it will be. If you are also using testrpc without specifying a port then testrpc will also be using 8545. Make sure to kill testrpc if this is the case. Two applications can't use the same port at once.

If you have specified the port that the Ropsten Geth instance is running on then it needs to be changed in the truffle.js config as specified here: http://truffleframework.com/docs/advanced/configuration

As a side note, consider using the Rinkeby testnet: https://www.rinkeby.io/ It's more reliable and has everything you need to use it in that one page.

I hope this helps.