I have a working contract that I made in ether.camp with solidity, it functions as desired through the IDE contract interface and now I am trying to tie it into an html GUI with web3.

To this end I have been following a series of tutorials, but as far as I can see - what I am doing should be working but it looks like it is not connecting to the contract?


   <button id="call"  type="submit">Call</button>
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
<script src="dist/app.js"></script>


var async = require('async');
var Web3 = require('web3');
var ethTx = require('ethereumjs-tx');
var SolidityFunction = require('web3/lib/web3/function');

var abi = [{
    "name": "removeElement(address)",
    "type": "function",
    "inputs": [
        "name": "key",
        "type": "address"

var sandboxId = '<my sandbox id>';
var url = 'https://<my user>.by.ether.camp:8555/sandbox/' + sandboxId;
var web3 = new Web3(new Web3.providers.HttpProvider(url));

web3.eth.defaultAccount = '0xdedb49385ad5b94a16f236a6890cf9e0b1e30392';

$( "button" ).click(function() {
    alert("button was clicked"); //just checking the jquery was working 
    var contract = web3.eth.contract(abi).at('0x17956ba5f4291844bc25aedb27e69bc11b5bda39'); //The contract address as per the ethercamp IDE

The removeElement(address key) function in the contract works absolutley fine from the IDE. I suspect the above code is not actually 'connecting' to the contract? Wish I could be more detailed but I'm not sure whats not working here

Thank you!

  • contract.call().removeElement("0x2ad..."); looks strange to me. I am more used to seeing contract.removeElement.call("0x2ad..."); or contract.removeElement("0x2ad...");. Sep 4, 2016 at 10:29
  • I will try without call() - repositioning it still seems to do nothing :( Sep 4, 2016 at 10:30
  • Removing call() does not seem to work. I get the alertbox fine showing the button click is being triggered but nothing happens to the contract. Doing the exact same removeElement in the IDE works - just not from web3 Sep 4, 2016 at 10:40
  • Open your browser console, type var contract = web3.eth.contract(abi).at('0x179...'); then contract.removeElement() and see what comes out. Sep 4, 2016 at 10:53
  • Okay I get ReferenceError: web3 is not defined but we can see above that I am ? Sep 4, 2016 at 11:05

1 Answer 1


I wanted to ask for details, but I can't post comments.

  1. It should be contract.removeElement("0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba")
  2. Do you see any error messages in the browser console?
  3. When you click on the button do you see the transaction in the transactions dialog of the IDE?
  4. The code is built by browserify with gulp, that's why it uses CommonJS require. If you want to use web3 from the console, add window.web3 = web3;
  • 1
    I've upvoted and now you have enough reputation to post comments. Please start posting comments and then edit this to be a full, valid, answer. Thanks
    – eth
    Sep 7, 2016 at 21:04
  • 1
    @eth thanks! I'll change it when I have more details. Sep 8, 2016 at 7:39

Your Answer

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

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