3

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?

2 Answers 2

0

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.

2
  • I appreciate your desire to help, but the question is more about how to change a command from the truffle console/testrpc into something that I can issue to ropsten thru the geth console, so what you've written doesn't really answer the question Jul 31, 2017 at 13:12
  • Ah yeah this doesn't actually answer your question, my bad. It is a solution if your end goal is to interact with the Ropsten testnet though.
    – willjgriff
    Aug 1, 2017 at 9:56
0

How can I send them through the geth console?

If by that you mean how to setup up a geth node on the ropsten testnetwork and interact with it using truffle, keep reading.

In the terminal type: geth --testnet --rpc console

wait till the node is fully synced. You can check by typing eth.syncing if eth.syncing = false its done. (This part could take a while)

check your http endpoint it will look something like this: HTTP endpoint opened url=http://127.0.0.1:8545

In your truffle.js file add ropsten like so:

On windows its may be named truffle-config.js

networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    },
    ropsten: {
        host: "localhost",
        port: 8545,
        network_id: "*",
        gas: 4600000
    }
  }

If you don't already have an account type personal.newAccount() and follow the prompts. Then go to : http://faucet.ropsten.be:3001/ and add testnet ether to your account

Go back to the terminal and type personal.unlockAccount("your address")

Create a second terminal tab in you project directory and run truffle migrate --network ropsten

Assuming your contract and migrations has been setup properly. Your contract should be successfully deployed to the ropsten network.

Also a great tutorial on this: https://medium.com/@guccimanepunk/how-to-deploy-a-truffle-contract-to-ropsten-e2fb817870c1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.