Solidity – How to Load Solidity Source File into Geth

compilationgo-ethereumsolidity

Is it possible to load Solidity source file .sol file to go-ethereum.

I am using the 'loadScript' method by saving a .js file like the following and loads it.

source = "contract test {\n" +
"   /// @notice will multiply `a` by 7.\n" +
"   function multiply(uint a) returns(uint d) {\n" +
"      return a * 7;\n" +
"   }\n" +
"} ";

Is there any better way? I don't want to use browser-solidity

Best Answer

I found this Solidity Compile Helper ruby wrapper

Usage

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.

Related Topic