solcjs
JavaScript-based Solidity compiler
TLDR
Compile contract
SYNOPSIS
solcjs [--bin] [--abi] [--optimize] [-o dir] files
DESCRIPTION
solcjs is a JavaScript/WebAssembly implementation of the Solidity compiler, installable via npm. It compiles Solidity smart contracts into EVM bytecode and ABI (Application Binary Interface) definitions needed for deploying and interacting with contracts on Ethereum and compatible blockchains.
The compiler produces bytecode (--bin) for deployment and ABI JSON (--abi) that describes the contract's functions and events for client interaction. The optimizer reduces bytecode size and gas costs when enabled.
solcjs provides the same core compilation functionality as the native solc compiler but runs in Node.js environments, making it easy to integrate into JavaScript-based development workflows and build tools like Truffle and Hardhat. It is somewhat slower than the native compiler and may lack some advanced features.
PARAMETERS
--bin
Output bytecode.--abi
Output ABI JSON.--optimize
Enable optimizer.-o DIR
Output directory.--base-path DIR
Base path for imports.--include-path DIR
Include path.
CAVEATS
Slower than native solc. JavaScript implementation. Some features missing.
HISTORY
solcjs is a JavaScript/WebAssembly port of solc, the Solidity compiler for Ethereum smart contracts.
