Compile Your Contract
Run the following command in your flipper directory to compile your smart contract:
- Pop
- cargo-contract
pop build
cargo contract build
This command will build the following for your contract:
a binary (.polkavm), a metadata file (.json), and a .contract file which bundles both.
If all goes well, you should see a target folder that contains these files:
target
└─ ink
└─ flipper.polkavm <-- Raw contract binary
└─ flipper.json <-- Metadata for the contract
└─ flipper.contract <-- JSON file that combines binary + metadata
Learn more about metadata and the ink! metadata format for detailed information about the structure of these files.
Debug vs. Release Build
By default, contracts are built in debug mode, which includes debugging information and
increases the contract's size. For production deployments, you should always build with the
--release flag:
- Pop
- cargo-contract
pop build --release
cargo contract build --release
This will ensure that nothing unnecessary is compiled into the binary blob, making your contract faster and cheaper to deploy and execute.