Skip to content

ericxtang/browser-solc

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

browser-solc

Solc is the solidity compiler. It usually runs on the Ethereum node. Browser-solidity is an example for Solc in the browser, but it's hard to pick apart just the solc library from the entire application. This repo is a wrapper that helps you do that. browser-solc is a browserified version of solc-js.

Demo app

You should use browser-solc if you:

  • Want to do solc.compile() in your Dapp
  • Don't want to worry about browserify the solc-js npm package

Usage:

<!-- Include this in your HTML page -->
<script src="http://code.dappbench.com/browser-solc.min.js" type="text/javascript"></script>
//Get a list of all possibile solc versions
BrowserSolc.getVersions(function(soljsonSources, soljsonReleases) {
  console.log(soljsonSources);
  console.log(soljsonReleases);
});

//Load a specific compiler version
BrowserSolc.loadVersion("soljson-v0.4.6+commit.2dabbdf0.js", function(compiler) {
  source = 'contract x { function g() {} }';
  optimize = 1;
  result = compiler.compile(source, optimize);
  console.log(result);
});

Development

To build browser-solc.js, run browserify src/index.js -g yo-yoify -o browser-solc.js; babel browser-solc.js --out-file browser-solc.js

Note: browser-solc does NOT implement the whole interface of solc-js.

Releases

No releases published

Packages

No packages published