While I was working on the Solidity abitrary-length integer math library, the admittedly hefty contract suddenly stopped working when being published to the local Web3 Provider Endpoint (Geth client at “localhost”).
I suspected (since no error was reported), that this was a problem with the initial gas amount being supplied to the contract; it would work fine if I pasted it into Geth from the “Web3 deploy” output of Browser Solidity with an updated “gas” parameter but would fail if I simply clicked “Create”.
It seems I wasn’t the only person experiencing this issue but unfortunately I wasn’t able to find any solutions so I decided to do some digging into the code. The following response, originally posted in the Ethereum Community Forum, reflects what my digging unearthed. Maybe it’ll help you if you’re running into similar issues.
I’m not sure if there exist any tools to do specifically what you describe but after running into the same problems and doing some testing I’ve found what appears to be a code-level solution that may work for you. I’m not in any way associated with the Ethereum project so what I’m describing here is 100% unofficial (use at your own risk).
The first solution applies to a self-hosted compiler – when you run Browser Solidity from your own web server – the second applies when running it from the officially hosted location (https://ethereum.github.io/browser-solidity/#version=soljson-latest.js).
Update the file “app.js” in the “build” folder of your installation. Find the function
UniversalDApp.prototype.runTx (currently on line 99455). Scroll down and find the following line:
var gas = self.options.getGas ? self.options.getGas : 1000000;
Comment this line out and replace with:
(or whatever you want the default gas amount to be)
Replace the file on the web server and reload the app to use the new gas amount.
You may also be able to set the
self.options.getGas value but since I’m not sure what else this may effect I can’t recommend doing this.
Download a copy of the “app.js” file to your local computer (https://ethereum.github.io/browser-solidity/build/app.js). Update the file as described above.
Download and install a web debugging proxy like Fiddler or Charles. Use the autoresponder (or analogous) feature of the software to respond with your local file whenever the browser attempts to load the .js file from the official URL.
Here’s a sample Fiddler configuration that loads the “app.js” file from my desktop (obviously your local path will differ):
Note that you need to ensure that “Unmatched requests passthrough” is enabled otherwise all other requests will fail and the app won’t load.
In Charles this functionality is called “Map Local Tool” (https://www.charlesproxy.com/documentation/tools/map-local/), and it may also be possible to do this using your browser’s built-in tools or plugins.
Either way, be sure to reload the site to ensure that the browser picks up the updated .js file.
P.S. You can also use my customized version of Browser Solidity. The gas amount has been increased to 200000000 and the app is delivered over HTTP so there should be no security domain issues when communicating with Geth: http://patrickbay.ca/browser-solidity/