Skip to content

Instantly share code, notes, and snippets.

@achiko
Created March 25, 2016 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achiko/af60046f08c8e1dba302 to your computer and use it in GitHub Desktop.
Save achiko/af60046f08c8e1dba302 to your computer and use it in GitHub Desktop.
var Web3 = require('Web3');
if(typeof web3 !== 'undefined')
web3 = new Web3(web3.currentProvider);
else
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8000"));
var lockmyetherContract = web3.eth.contract([{"constant":true,"inputs":[],"name":"getTrickleBlock","outputs":[{"name":"TrickleBlock","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"getBalance","outputs":[{"name":"Balance","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"_blocknumber","type":"uint256"}],"name":"setExpirationBlock","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"getTrickle","outputs":[{"name":"Trickle","type":"bool"}],"type":"function"},{"constant":false,"inputs":[],"name":"withdrawFees","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"getExpirationBlock","outputs":[{"name":"ExpirationBlock","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"getLatestBlock","outputs":[{"name":"BlockNumber","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"getFeeBalance","outputs":[{"name":"FeeBalance","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[],"name":"setTrickleOn","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"main","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"setTrickleOff","outputs":[],"type":"function"},{"inputs":[],"type":"constructor"}]);
// creation of contract object
var MyContract = web3.eth.contract(lockmyetherContract);
// initiate contract for an address : 0x3f4d6246bd11297be47e6ab1c2b1b72559c68a82 Mined contract address
var myContractInstance = MyContract.at('0x3f4d6246bd11297be47e6ab1c2b1b72559c68a82');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment