solcjs
Compile Solidity smart contracts to bytecode
TLDR
Compile a specific contract to hex
Compile the ABI of a specific contract
Specify a base path to resolve imports from
Specify one or more paths to include containing external code
Optimise the generated bytecode
SYNOPSIS
solcjs [options] input_file(s)
PARAMETERS
--bin
Output binary code.
--abi
Output application binary interface.
--ast
Output abstract syntax tree.
--asm
Output assembly code.
--opcodes
Output opcodes.
--optimize
Enable bytecode optimizer.
--combined-json output-types
Output a combined JSON object containing the specified output types.
--devdoc
Output developer documentation.
--userdoc
Output user documentation.
--metadata
Output metadata file.
--standard-json
Read and write to standard JSON format.
--via-ir
Compile via the intermediate representation (IR).
--base-path path
Base path for import remapping.
--include-path path
Include path for import resolving.
--overwrite
Overwrite existing files.
--output-dir dir
Output directory.
--evm-version version
EVM version to target.
--version
Show compiler version information.
--help
Show help message.
DESCRIPTION
The solcjs command is the command-line interface for the Solidity compiler.
It allows you to compile Solidity source code into various output formats, including ABI, bytecode, and assembly. Solcjs is essential for deploying Solidity smart contracts to the Ethereum blockchain or other compatible platforms.
It provides options to control optimization levels, EVM versions, target platforms, and debugging information.
The compiler enables the creation of deployable smart contracts by translating high-level Solidity code into machine-readable instructions for the Ethereum Virtual Machine (EVM).
COMPILER VERSIONS
It is vital to use the correct compiler version for a particular Solidity smart contract.
Smart contracts are often written to work best with a specific compiler version, and using the wrong one may result in unexpected behavior or errors.
SECURITY CONSIDERATIONS
Always audit your smart contracts after compiling to verify they perform as intended and are free from vulnerabilities.
While solcjs checks for some common errors, it is not a substitute for manual security review.
HISTORY
solcjs is the official command-line compiler for the Solidity programming language.
It was developed alongside the Solidity language itself to provide a crucial tool for developers to build and deploy smart contracts.
Its development closely follows the evolution of Solidity, incorporating new features, optimizations, and security improvements.
Originally created by the Ethereum Foundation, now it's maintained by the Solidity team and contributors.
SEE ALSO
abigen(1)