Git Product home page Git Product logo

solidity_compiler_helper's Introduction

This is a helper to compile and deploy smart contracts through geth.

Install solc compiler.

Move solc_helper to somewhere in your path. To compile your code run

solc_helper contract.sol

This will generate a javascript file and print out a statement like the following.

loadScript('/path/contract.js')

Paste this statement into the geth console. Your code will be loaded and your contract will be deployed automatically.

There are also a few helper functions to easily deploy the contracts.

create(abiDefinition);
deploy(account, value, gas, contract, code, input=optional);

You can use them to deploy the contract.

var contract = create(compiled.SimpleStorage.info.abiDefinition);
var instance = deploy(eth.coinbase, 0, 10000, contract, compiled.SimpleStorage.code,10);
var instance = deploy(eth.coinbase, 10, 10000, contract, compiled.SimpleStorage.code); // if there are no constructor parameters.

To call a function in the contract you can use the call function

call(accountIndex, gas, contractInstance.function, input);

//For example to call using ether from eth.accounts[1]
call(1, 100000, multiplier.multiply, 1, 2);

To watch an event you can use the watcher function.

contractInstance.eventName(watcher);

To send some ether from your account to another. You can use send function

send(accountIndex, toAccount, valueInEther, gas);

//For example to send some ether from eth.accounts[2]
send(2, '0xb8290f9757b5c9daa11a8016d663829af812fc0e', 10, 30000);

Use bal() function to check balance of all accounts.

The script will also printout the gas estimates when you try to compile.

solidity_compiler_helper's People

Contributors

rakeshbs avatar

Watchers

Krzysztof Kura avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.