# Crytic-compile
[](https://github.com/crytic/crytic-compile/actions?query=workflow%3ACI)
[](https://slack.empirehacking.nyc)
[](https://badge.fury.io/py/crytic-compile)
Library to help smart contract compilation. It includes support for:
- Direct solc compilation
- [Foundry](https://github.com/foundry-rs/foundry/)
- [Hardhat](https://github.com/nomiclabs/hardhat)
- [Brownie](https://github.com/iamdefinitelyahuman/brownie)
- [Buidler](https://github.com/nomiclabs/buidler)
- [Dapp](https://dapp.tools/dapp/)
- [Embark](https://embark.status.im/)
- [Etherlime](https://github.com/LimeChain/etherlime)
- [Etherscan](https://etherscan.io/) (including several alt-chain explorers and testnets)
- [Truffle](https://truffleframework.com/)
- [Waffle](https://github.com/EthWorks/Waffle)
To force compilation with a specific framework, use the `--compile-force-framework` flag. For example, to force compilation with Hardhat:
```shell
crytic-compile . --compile-force-framework hardhat
```
See the [Configuration](https://github.com/crytic/crytic-compile/wiki/Configuration) documentation for advanced usages.
The plugin is used in Trail of Bits tools, including:
- [Slither](https://github.com/crytic/slither)
- [Echidna](https://github.com/crytic/echidna)
- [Manticore](https://github.com/trailofbits/manticore/)
- [evm-cfg-builder](https://github.com/crytic/evm_cfg_builder)
## Installation
```shell
pip3 install crytic-compile
```
## Usage
In the root directory of your project e.g. same directory as `hardhat.config.js` or `foundry.toml`, run:
```shell
crytic-compile .
```
Crytic-compile will generate `crytic-export/contracts.json` containing the AST/ABI and bytecodes of the contracts.
Run `crytic-compile --help` for more options.
## Library Linking
If your project uses [libraries](https://docs.soliditylang.org/en/latest/contracts.html#libraries) with external functions, they can be linked to their deployed address with the `--compile-libraries` flag. For example, if you have a library `SafeMath` deployed at `0xff`, you can link it with:
```shell
crytic-compile . --compile-libraries "(SafeMath, 0xff)"
```
If you are fuzzing with Echidna or Medusa, follow this [tutorial on linking libraries](https://secure-contracts.com/program-analysis/echidna/advanced/working-with-libraries.html?highlight=library#linking-libraries).
### As a library
See the [library documentation](https://github.com/crytic/crytic-compile/wiki/Library-Documentation).
Raw data
{
"_id": null,
"home_page": "https://github.com/crytic/crytic-compile",
"name": "crytic-compile",
"maintainer": null,
"docs_url": null,
"requires_python": "!=3.12.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Trail of Bits",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/e7/32/dfacd10aedde8576594566c53de75904b4d99abbf5e256ac6de8d3baae18/crytic_compile-0.3.8.tar.gz",
"platform": null,
"description": "# Crytic-compile\n[](https://github.com/crytic/crytic-compile/actions?query=workflow%3ACI)\n[](https://slack.empirehacking.nyc)\n[](https://badge.fury.io/py/crytic-compile)\n\nLibrary to help smart contract compilation. It includes support for:\n- Direct solc compilation\n- [Foundry](https://github.com/foundry-rs/foundry/)\n- [Hardhat](https://github.com/nomiclabs/hardhat)\n- [Brownie](https://github.com/iamdefinitelyahuman/brownie)\n- [Buidler](https://github.com/nomiclabs/buidler)\n- [Dapp](https://dapp.tools/dapp/)\n- [Embark](https://embark.status.im/)\n- [Etherlime](https://github.com/LimeChain/etherlime)\n- [Etherscan](https://etherscan.io/) (including several alt-chain explorers and testnets)\n- [Truffle](https://truffleframework.com/)\n- [Waffle](https://github.com/EthWorks/Waffle)\n\nTo force compilation with a specific framework, use the `--compile-force-framework` flag. For example, to force compilation with Hardhat:\n\n```shell\ncrytic-compile . --compile-force-framework hardhat\n```\n\nSee the [Configuration](https://github.com/crytic/crytic-compile/wiki/Configuration) documentation for advanced usages.\n\nThe plugin is used in Trail of Bits tools, including:\n- [Slither](https://github.com/crytic/slither)\n- [Echidna](https://github.com/crytic/echidna)\n- [Manticore](https://github.com/trailofbits/manticore/)\n- [evm-cfg-builder](https://github.com/crytic/evm_cfg_builder)\n\n\n## Installation\n\n```shell\npip3 install crytic-compile\n```\n\n## Usage\n\nIn the root directory of your project e.g. same directory as `hardhat.config.js` or `foundry.toml`, run:\n\n```shell\ncrytic-compile .\n```\n\nCrytic-compile will generate `crytic-export/contracts.json` containing the AST/ABI and bytecodes of the contracts.\n\nRun `crytic-compile --help` for more options.\n\n## Library Linking\n\nIf your project uses [libraries](https://docs.soliditylang.org/en/latest/contracts.html#libraries) with external functions, they can be linked to their deployed address with the `--compile-libraries` flag. For example, if you have a library `SafeMath` deployed at `0xff`, you can link it with:\n\n\n```shell\ncrytic-compile . --compile-libraries \"(SafeMath, 0xff)\"\n```\n\nIf you are fuzzing with Echidna or Medusa, follow this [tutorial on linking libraries](https://secure-contracts.com/program-analysis/echidna/advanced/working-with-libraries.html?highlight=library#linking-libraries).\n\n### As a library\n\nSee the [library documentation](https://github.com/crytic/crytic-compile/wiki/Library-Documentation).\n",
"bugtrack_url": null,
"license": "AGPL-3.0",
"summary": "Util to facilitate smart contracts compilation.",
"version": "0.3.8",
"project_urls": {
"Homepage": "https://github.com/crytic/crytic-compile"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4897b78de6339f0daa7756470eb14ea51c01148d6a4ee0022f0328d2989589c0",
"md5": "24fc538b98c0522ab40761229734eaab",
"sha256": "adad7c7abf35770b9e4a7f9fe7e25e1734244bc72e098ee1f52f0ea61faf8ea6"
},
"downloads": -1,
"filename": "crytic_compile-0.3.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "24fc538b98c0522ab40761229734eaab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "!=3.12.0,>=3.8",
"size": 98418,
"upload_time": "2025-01-17T17:49:04",
"upload_time_iso_8601": "2025-01-17T17:49:04.723903Z",
"url": "https://files.pythonhosted.org/packages/48/97/b78de6339f0daa7756470eb14ea51c01148d6a4ee0022f0328d2989589c0/crytic_compile-0.3.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e732dfacd10aedde8576594566c53de75904b4d99abbf5e256ac6de8d3baae18",
"md5": "013ba1e2734ed1f78cd573b0bb275927",
"sha256": "dd8841701cfabf132ffff8b59e8dac32f5fafe369ec8b14b855f2f70565f11ad"
},
"downloads": -1,
"filename": "crytic_compile-0.3.8.tar.gz",
"has_sig": false,
"md5_digest": "013ba1e2734ed1f78cd573b0bb275927",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "!=3.12.0,>=3.8",
"size": 78650,
"upload_time": "2025-01-17T17:49:09",
"upload_time_iso_8601": "2025-01-17T17:49:09.185141Z",
"url": "https://files.pythonhosted.org/packages/e7/32/dfacd10aedde8576594566c53de75904b4d99abbf5e256ac6de8d3baae18/crytic_compile-0.3.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-17 17:49:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "crytic",
"github_project": "crytic-compile",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "crytic-compile"
}