Compiling contracts

Solidity is a high-level programming language we can understand but an EVM can't. An EVM understands instructions written in the contract in the form of bytecode generated after contract compilation.

After the compilation of any contract, the compiler returns a JSON file containing two main parts

  1. ABI - Application binary interface describes smart contract methods and functions.

  2. Bytecode - it contains instructions to EVM in the form of binary.

Compile smart contracts using Hardhat

Hardhat is a development environment that facilitates building on Ethereum. It helps developers manage and automate the recurring tasks that are inherent to the process of building smart contracts and dApps, and it allows you to easily introduce more functionality around this workflow.

To compile contracts using the Hardhat development environment we recommend you follow this page:

Compile smart contracts using Remix IDE

Remix IDE is one the most popular web-based code editor to write smart contracts. you can also use compiled contracts from Remix IDE in Ethcode for contract deployment and contract method calls.

  1. Compile smart contract on Remix IDE.

  2. After compilation copy the JSON file of your compiled contract from artifacts/ContractName_metadata.json

  3. After copying create a new folder named artifacts and then create a subfolder contracts.

  4. create a new file in the contracts folder <contractName>.json

  5. paste the content copied from RemixIDE in <contractName>.json file.

Last updated