remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
chriseth bc90b28ae6 Merge pull request #64 from d11e9/web3endpoint 9 years ago
assets remove console log 9 years ago
.npmignore add icon font 9 years ago
LICENSE.md Top-level license file. 9 years ago
README.md Fix typo 9 years ago
index.html better naming for RHP toggle 9 years ago
index.js bump npm publish version 9 years ago
package.json bump npm publish version 9 years ago
worker.js Handle multiple files. 9 years ago

README.md

#Browser-solidity

Browser solidity is a browser based solidity compiler. To use either visit https://chriseth.github.io/browser-solidity or clone/download this repo and open index.html in your browser.

#Nodejs usage

To use the solidity compiler via nodejs you can install it via npm

npm install solc

And then use it like so:

var solc = require('solc');
var input = "contract x { function g() {} }";
var output = solc.compile(input, 1); // 1 activates the optimiser
for (var contractName in output.contracts)
	console.log(contractName + ': ' + output.contracts[contractName].bytecode);

Starting from version 0.1.6, multiple files are supported with automatic import resolution by the compiler as follows:

var solc = require('solc');
var input = {
	'lib.sol': 'library L { function f() returns (uint) { return 7; } }',
	'cont.sol': 'import "lib.sol"; contract x { function g() { L.f(); } }'
};
var output = solc.compile({sources: input}, 1);
for (var contractName in output.contracts)
	console.log(contractName + ': ' + output.contracts[contractName].bytecode);

Note that all input files that are imported have to be supplied, the compiler will not load any additional files on its own.

###Using a legacy version

In order to allow compiling contracts using a specific version of solidity, the solc.useVersion method is available. This returns a new solc object using the version provided. Note: version strings must match the version substring of the files availble in /bin/soljson-*.js. See below for an example.

var solc = require('solc');
// by default the latest version is used
// ie: solc.useVersion('latest')

// getting a legacy version
var solcV011 = solc.useVersion( 'v0.1.1-2015-08-04-6ff4cd6' );
var output = solcV011.compile( "contract t { function g() {} }", 1 );