0

How can I get truffle to compile contracts over my local testrpc setup without an internet connection for test purposes.

I do not have the privilege of internet access at home, but I prefer working at home. When deploying a contract via truffle with internet connection everything works fine.

Running "truffle deploy" without internet connection gives me the following error.

>Could not connect to your Ethereum client. Please check that your Ethereum clien                                        
 t:
     - is running
     - is accepting RPC connections (i.e., "--rpc" option is used in geth)
     - is accessible over the network
     - is properly configured in your Truffle configuration file (truffle.js)

So I run "testrpc" then on a separate console I navigate to my project folder and run "truffle depoly". This works with internet connection, but gives error, when not connected to an internet connection.

truffle.js

> module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    }
  }
};

How can I deploy contracts without internet connection on my local testrpc?

Update on System information:

OS: Windows 7 Profession Service Pack 1
Truffle v4.0.0 (core: 4.0.0)
Solidity v0.4.18 (solc-js)
  • I've tried your setup without internet and it worked. Launch testrpc in a console "EthereumJS TestRPC v4.1.3", and execute truffle migrate in another console "Truffle v3.4.11 (core: 3.4.11)". Everything under Ubuntu 16.04 x64. The project used as a test was the default created by truffle init. Make sure testrpc is running before executing truffle migrate or (deploy is an alias of migrate). Which OS are you running? – Ismael Nov 1 '17 at 3:30
  • I am using windows 7. Using Truffle v3.4.11 (core: 3.4.11) Solidity v0.4.15 (solc-js). Actually testing using the pet-shop-tutorial tutorial, [truffleframework.com/tutorials/pet-shop] – GSari Nov 1 '17 at 4:03
1

For anyone, who may experience similar issue. Here's a quick solution I found to get truffle v4 working offline.

So truffle deploy doesn't work offline (specifically without connected to a wifi/LAN connection) because of truffle's need to create an external RPC IP Address, as it seems.

A quick solution to this issue of truffle deploy not working, was simply running a mobile hotspot from my Smart phone and connecting my host machine to the wifi. Then running truffle deploy without internet connection disabled from Smart phone got it working as expected, at least for now.

0

They released Truffle 4.0 just today which comes with a built-in replacement for testrpc.

After updating truffle and initializing it you can run $ truffle develop to get a development blockchain without testrpc. You could give it a try to check if it works offline. Here are the release notes:

https://github.com/trufflesuite/truffle/releases

  • Ok great, let me try the new release. be back here to update how it goes. – GSari Nov 1 '17 at 4:08
  • So, I updated to latest version of Truffle 4.0. And the problem seems to persist. $ truffle develop Truffle Develop started at http://localhost:9545/ Could not connect to your Ethereum client. Please check that your Ethereum client: - is running - is accepting RPC connections (i.e., "--rpc" option is used in geth) - is accessible over the network - is properly configured in your Truffle configuration file (truffle.js) – GSari Nov 1 '17 at 4:20
  • Works fine with internet connection, but does not work when disconnect and rerun using truffle develop. Currently using Windows 7 Pro SP1 – GSari Nov 1 '17 at 4:23
0

Make sure your new contract is included in the "2_deploy_contracts.js" file like this.

var ContractFileName= artifacts.require("./contractfilename.sol");

module.exports = function(deployer) { deployer.deploy(ContractFileName); };

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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