Compiling Solidity source code
Last updated
Was this helpful?
Last updated
Was this helpful?
Compilation to bytecode is performed by the Solidity compiler, solc
. You can install the compiler, locally following the instructions as per .
To compile the Solidity code run:
The --bin
and --abi
compiler arguments are both required to take full advantage of working with smart contracts from web3j.
--bin
Outputs a Solidity binary file containing the hex-encoded binary to provide with the transaction request. This is required only for deploy
and isValid
methods.
--abi
Outputs a Solidity file which details all of the publicly accessible contract methods and their associated parameters. These details along with the contract address are crucial for interacting with smart contracts. The ABI file is also used for the generation of
There is also a --gas
argument for providing estimates of the required to create a contract and transact with its methods.
Alternatively, you can write and compile Solidity code in your browser via the project. browser-solidity is great for smaller smart contracts, but you may run into issues working with larger contracts.